Repository navigation
Conversation
|
Hum. remembered that the github does not do a rebase for pull-requests, so getting the files names as I did is not accurate. |
|
Do you want to address the new lint issues in this PR? |
|
I believe we first need to decide if the provided format config meets the expectations by checking out the branch and running pre-commit. To test the get changed files logic: |
|
Generated documentation for this PR is available at Link |
black- and isort-like features are built-in ruff. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Obtaining the fetch depth is not clean because of the force push, new branch corner cases, and overall different GitHub contexts between events, so I hid away the logic on Doctools. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Fix the test/emu exclude typo, and set force-exclude so excludes also apply to files passed explicitly, as pre-commit does. Exclude notebooks, which black and isort did not check, and ignore the rules and paths ignored by .flake8, keeping import sorting for all files as isort did. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
The run step is executed with bash -e, so a failing pre-commit exited before printing the formatter diff. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Bump hooks to the latest release: * codespell: v2.4.3 * pre-commit-hooks: v6.0.0 * ruff-pre-commit: v0.17.6 * Lucas-C/pre-commit-hooks: v1.5.6 The flake8 hook was removed from pre-commit-hooks at v4.0.0, use PyCQA/flake8 (7.5.0) instead. The ruff hook is a legacy alias of ruff-check. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Description
Follow-up to #660, as a draft because we probably need to further tune the rules to execute
[tool.ruff.lint] select = [...].Not a fan of jumping between tools, but I am glad that ruff can be installed from pip as usual.
This also changes the test.yml to run the checkers only on touched files (limited to 2048 commits (GH context window)).
In the case of force-push or new-branch-push event, it will check only the 6 top commits (arbitrary value, can be changed), and the environment variable FETCH_DEPTH_FALLBACK=true is also set.
The latter is used to fallback to check all files.
Another minor change is logging git diff with --no-pager instead of
> ; cat.I don't think we can 100% match the previous format checker.
Also, doesn't fully implements black-docs, only markdown/reST inside docstrings are checked.
Type of change
Please delete options that are not relevant.
How has this been tested?
Test Configuration:
Documentation
Relevant docs:
https://docs.astral.sh/ruff/settings/#lint_select
https://docs.astral.sh/ruff/settings/#lintisort
astral-sh/ruff#9030
astral-sh/ruff#8854
astral-sh/ruff#8860
astral-sh/ruff#8237
but https://github.com/pydantic/pytest-examples
Checklist: