Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use modern linters #237

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/.pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CI

<!--
<!--
Note: In order for the CI to test against the correct database backend, please label this pull request with the name of the backend you'd like to test against, e.g. "postgres" for running the postgres tests on each commit.
-->
-->
27 changes: 0 additions & 27 deletions .github/actions/pytest/action.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ on:
pull_request:
push:
branches:
- 'main'
- "main"
tags:
- 'v*'
- "v*"
release:
types:
- published
Expand Down
24 changes: 3 additions & 21 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ on:
# to the main branches and tags.
push:
branches:
- 'main'
- 'pre-commit-autoupdate'
- "main"
- "pre-commit-autoupdate"
tags:
- 'v*'

- "v*"

jobs:

pre-commit-checks:
name: Pre-commit Checks
runs-on: ubuntu-latest
Expand All @@ -29,21 +27,6 @@ jobs:
- name: pre-commit
run: pixi run pre-commit-run --color=always --show-diff-on-failure

mypy-type-checks:
name: Mypy Type Checks
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: default lint
- name: mypy
run: |
pixi run -e mypy postinstall
pixi run -e mypy mypy .

unit-tests:
name: "unit tests"
strategy:
Expand Down Expand Up @@ -168,7 +151,6 @@ jobs:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}


db2:
if: ${{ contains(github.event.pull_request.labels.*.name, 'db2') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: DB2
Expand Down
63 changes: 31 additions & 32 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ "main", main_protection ]
branches: ["main", main_protection]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '16 4 * * 4'
- cron: "16 4 * * 4"

jobs:
analyze:
Expand All @@ -32,45 +32,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
56 changes: 37 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,55 @@ repos:
always_run: true
require_serial: true
pass_filenames: false
- id: black
name: black
entry: pixi run -e lint black
# ruff
- id: ruff
name: ruff
entry: pixi run -e lint ruff check --fix --exit-non-zero-on-fix --force-exclude
language: system
types_or: [python, pyi]
require_serial: true
- id: flake8
name: flake8
entry: pixi run -e lint flake8
- id: ruff-format
name: ruff-format
entry: pixi run -e lint ruff format --force-exclude
language: system
types_or: [python, pyi]
require_serial: true
- id: pyupgrade
name: pyupgrade
entry: pixi run -e lint pyupgrade
# mypy
- id: mypy
name: mypy
entry: pixi run -e mypy mypy
language: system
types: [python, pyi]
- id: isort
name: isort
entry: pixi run -e lint isort
types: [python]
require_serial: true
# prettier
- id: prettier
name: prettier
entry: pixi run -e lint prettier --write --list-different --ignore-unknown
language: system
types: [text]
files: \.(md|yml|yaml)$
# taplo
- id: taplo
name: taplo
entry: pixi run -e lint taplo format
language: system
types: [toml]
# pre-commit-hooks
- id: trailing-whitespace-fixer
name: trailing-whitespace-fixer
entry: pixi run -e lint trailing-whitespace-fixer
language: system
types: [python, pyi]
types: [text]
- id: end-of-file-fixer
name: end-of-file-fixer
entry: pixi run -e lint end-of-file-fixer
language: system
types: [text]
# typos
- id: typos
name: typos
entry: pixi run -e lint typos --force-exclude
language: system
types: [text]
exclude: "\\.csv$"
require_serial: true
- id: taplo
name: taplo
entry: pixi run -e lint taplo format
language: system
types: [toml]
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ build:
sphinx:
configuration: docs/source/conf.py
formats:
- pdf

- pdf
1 change: 0 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,3 @@ Changelog
**Bug fix:**

- The method :meth:`is_deprecated` of :class:`~datajudge.Condition` was called despite not existing.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ companies_between_req = BetweenRequirement.from_tables(
companies_between_req.add_row_superset_constraint(
columns1=["name"], columns2=["name"], constant_max_missing_fraction=0
)
```

```
2 changes: 0 additions & 2 deletions docs/source/examples/example_exploration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,3 @@ could for instance be:

Column 'col_varchar' has type 'varchar' in table1 and type 'varchar' in table2.
Column 'col_int' has type 'integer' in table1 and type 'integer' in table2.


2 changes: 1 addition & 1 deletion docs/source/examples/twitch_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,4 @@ <h2>Results</h2>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>
<div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>
3 changes: 1 addition & 2 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ this growth limitation is expressed relative to the number of rows of the first
Generally, such relative limitations can be defined in two ways:

- manually, based on domain knowledge (e.g. 'at least 5% growth')

- automatically, based on date ranges

The former would translate to
Expand Down Expand Up @@ -205,4 +205,3 @@ The Snowflake behavior is due to an upstream `bug <https://github.com/snowflaked
in snowflake-sqlalchemy.

This behavior is subject to change.

1 change: 0 additions & 1 deletion docs/source/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,3 @@ an html report, this can look as follows:

.. image:: report_failing_query2.png
:width: 800

Loading