truebrain / actions-flake8 Goto Github PK
View Code? Open in Web Editor NEWFlake8 with GitHub Actions -- including annotations for Pull Requests
License: MIT License
Flake8 with GitHub Actions -- including annotations for Pull Requests
License: MIT License
It is possible to run the action on only those files that have changes in the PR via:
- uses: actions/checkout@v2
with:
fetch-depth: -1
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- id: find_changed_files
run: echo ::set-output name=changed_files::$(git diff --name-only ${{github.sha}} ${{github.event.pull_request.base.sha}} | tr ' ' '\n' | grep .py | tr '\n' ' ')
- uses: TrueBrain/actions-flake8@v2
with:
plugins: flake8-docstrings dlint flake8-bugbear flake8-simplify flake8-debugger flake8-print flake8-pep3101
only_warn: 1
extra_arguments: "${{steps.find_changed_files.outputs.changed_files}}"
It would be nice if this was supported directly (although, just documenting would be good also). Also it would be nice if warnings could be shown only for changed files while errors are shown for all files. One simple way of doing so is to run flake8 twice, a much more difficult way of getting this done is to skip the changed files in the regex.
If I provide a pyproject.toml
file where I store the configuration parameter for flake8, like max-line-length
, will the action use these?
EDIT: also, is it possible to use both, pyproject.toml
and action parameter?
When using
- name: flake8 Lint
uses: TrueBrain/actions-flake8@v2
with:
plugins: flake8-simplify
error_classes: 'E,F'
warning_classes:'SIM'
I would expect SIM errors to become a warning, but it becomes a failing error
Hello! Thanks for the great action.
I'm trying to add a list of items to the flake8 --per-file-ignores
argument. I've tried just about everything I can think of to supply it via the extra arguments
line. The relevant part of my .yml:
- name: Annotate PR after running flake8
uses: TrueBrain/actions-flake8@v2
with:
max_line_length: 88
extra_arguments:
--per-file-ignores=__init__.py:F401 test_granules.py:E501
results in a file-not-found error for test_granules.py. I've tried every combination of spaces, newlines, quotes, etc. I can think of and cannot figure out how to properly pass multiple --per-file-ignores
to flake8 via this action. For reference, passing --per-file-ignores='__init__.py:F401 test_granules.py:E501'
to flake8 locally has the expected/desired behavior.
Any suggestions for how to make this work? Thanks!
The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
Please add all flake8 settings support
E.g.: max-complexity
, exclude
, e.t.c.
flake8
automatically reads configuration from files like setup.cfg
โ however, my setup.cfg
is placed in my src
directory. With this (very cool, btw) action, my settings file would never get parsed, because it will invoke flake8 src
.
I'd like to suggest a new option, "working-directory", to allow for this kind of scenario.
This suggests they aren't required if you tweak the regex a bit:
https://github.com/actions/runner/blob/d6179242ca92823bda0bcfc0aa9a75bbbc6ae618/docs/adrs/0276-problem-matchers.md#default-severity-level
Would be nice to limit linting to the current set of changed files.
I tested the same source code with v1.2
and v1.3
, and when using v1.3
, my workflow fails even though there aren't any linting errors. I'm seeing output in the logs of Flake8 found no problems
.
It appears that the issue is within the final lines of entrypoint.sh
as you're using $res
for the exit code, but that variable is no longer being set in the new version.
# If we are in warn-only mode, return always as if we pass
if [ -n "${INPUT_ONLY_WARN}" ]; then
exit 0
else
exit $res
fi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.