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

add post PR review #8

Merged
merged 14 commits into from
Dec 3, 2024
26 changes: 8 additions & 18 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
name: Python Flake8, black and pylint code quality check
name: Python flake8, black, pylint and ruff code quality check and post PR code suggestions

on: [push]
on: [push, pull_request]

jobs:
lint:
# TODO: change branch of workflow repo (2x)
uses: mundialis/github-workflows/.github/workflows/linting.yml@main
with:
VALIDATE_HTML: false
ruff:
name: ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install apt dependencies
run: |
sudo apt-get install -y -qq python3 python3-pip
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
pip3 install ruff==0.5.7
ruff --version
- name: Lint with ruff
run: |
ruff check --config pyproject.toml .

post-pr-reviews:
needs: lint
if: ${{ needs.lint.result == 'failure' }}
uses: mundialis/github-workflows/.github/workflows/post-pr-reviews.yml@main
34 changes: 16 additions & 18 deletions pyproject.toml → ruff.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
[project]
name = "r.dop.import"
requires-python = ">=3.9"

[tool.black]
required-version = '24'
line-length = 88
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']

[tool.ruff]
required-version = ">=0.5.0"

# In addition to the standard set of exclusions, omit the following files or folders.
extend-exclude = [
exclude = [
".git",
"__pycache__",
".env",
Expand All @@ -25,7 +13,10 @@ extend-exclude = [
"pydispatch",
]

[tool.ruff.lint]
line-length = 79
target-version = "py38"

[lint]
# See https://docs.astral.sh/ruff/rules/
select = [
"AIR", # Airflow (AIR)
Expand Down Expand Up @@ -68,7 +59,6 @@ select = [
]

ignore = [
# See https://docs.astral.sh/ruff/rules/
"E402", # module-import-not-at-top-of-file
"E501", # line-too-long
"F821", # undefined-name
Expand All @@ -77,15 +67,23 @@ ignore = [
"ANN102", # missing-type-cls
"ANN206", # missing-return-type-class-method
"ANN001", # missing-type-function-argument
"S310", # suspicious-url-open-usage
"B909", # loop-iteration-mutation
"A002", # builtin-argument-shadowing
"EXE001", # shebang-not-executable
"PT009", # pytest-unittest-assertion
"SLF001", # private-member-access
"PLC1901", # compare-to-empty-string
"PLR0913", # too-many-arguments
"PLR0915", # too-many-statements
"PLR0912", # too-many-branches
"A002", # builtin-argument-shadowing
"PLR0914", # too-many-local-variables
"PLR0917", # too-many-positional-arguments
"PLR1730", # if-stmt-min-max
"PLR6201", # literal-membership
]

[tool.ruff.lint.per-file-ignores]
[lint.per-file-ignores]
# See https://docs.astral.sh/ruff/settings/#lint_per-file-ignores
"lib_dop/r_dop_import_lib.py" = ["ERA001", "PLR2004"]
"testsuite/r_dop_import_test_base.py" = ["PLR2004"]
"testsuite/r_dop_import_test_base.py" = ["PLR2004"]
Loading