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

feature request: annotate warnings diff only #46

Open
eivindjahren opened this issue Jul 23, 2022 · 2 comments
Open

feature request: annotate warnings diff only #46

eivindjahren opened this issue Jul 23, 2022 · 2 comments

Comments

@eivindjahren
Copy link

eivindjahren commented Jul 23, 2022

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.

@r-ichard
Copy link

Totally agree with you @eivindjahren ! And thanks a lot for your code :)

@TrueBrain
Copy link
Owner

Oops, sorry, keep forgetting to reply to you :(

I would appreciate a PR that adds documentation about these kind of things. Just in the README as far as I am concerned, under a new topic like Advanced use-case or something. If you wouldn't mind, I would appreciate that!

I am not going to integrate support for it, as I strongly believe an action should do one thing, and one thing well. Covering all use-cases is impossible, and exactly the chain of actions you do is what you want :) So if it is flake8 related, it can go in this action, but if it is git related, it shouldn't :)

r-ichard pushed a commit to r-ichard/actions-flake8 that referenced this issue Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants