Giter Site home page Giter Site logo

Comments (6)

Cjkjvfnby avatar Cjkjvfnby commented on July 21, 2024 1

I end up with a simple solution via flake8 --format argument. Any reported item is a blocker in my case.

- name: Lint with flake8
        run: |
          flake8 default/python --count --format="::error file=%(path)s,line=%(row)d,col=%(col)d::%(path)s:%(row)d:%(col)d: %(code)s %(text)s" --config=default/python/tox.ini

PS. I tried to use working-directory: default/python an flake8 . --format="::error file=default/python/%(path)s, but github error does not set comment with paths like default/python/./file.py. The plugin does not catch such cases as well.

from flake8-annotations.

philosofool avatar philosofool commented on July 21, 2024 1

Thank your for your suggestions!
The annotations are generated by Githubs own annotator. Searching for warnings/errors is configured via regex in a static configuration file for the problemMatcher. It would very well be possible to include further annotations generated by flake8 plugins.
The regex for warnings is "^([^:]+):(\\d+):(\\d+):\\s+([CFNW]\\d+\\s+.+)$" right now. C, F, N and W are valid prefixes for warnings recognized for annotations. This can be extended for additional prefixes, or simply defined as a negation of error prefixes (only E right now, so [^E]).
If it's fine to classify additional plugins output as warnings only, I would prefer the second option, otherwise plugin outputs have to be categorized in warning and error level each. But it's definitely doable.

I tried coping the two problem-matcher.json files to my local .github and editing to include 'D' in the warning regex to add docstring violations to the annotations, but it does not appear to have worked. I'm a new two github actions---it there something else I have to reference to change this functionality?

If figured out that if I add to my workflow

run: |
  echo "::add-matcher::.github/flake8-error-problem-matcher.json"
  echo "::add-matcher::.github/flake8-warning-problem-matcher.json"

and those files are in my .github directory, it runs correctly. The files can then be edited.

from flake8-annotations.

rbialon avatar rbialon commented on July 21, 2024

Thank your for your suggestions!

The annotations are generated by Githubs own annotator. Searching for warnings/errors is configured via regex in a static configuration file for the problemMatcher. It would very well be possible to include further annotations generated by flake8 plugins.
The regex for warnings is "^([^:]+):(\\d+):(\\d+):\\s+([CFNW]\\d+\\s+.+)$" right now. C, F, N and W are valid prefixes for warnings recognized for annotations. This can be extended for additional prefixes, or simply defined as a negation of error prefixes (only E right now, so [^E]).

If it's fine to classify additional plugins output as warnings only, I would prefer the second option, otherwise plugin outputs have to be categorized in warning and error level each. But it's definitely doable.

from flake8-annotations.

Cjkjvfnby avatar Cjkjvfnby commented on July 21, 2024

Some plugins use long prefixes, for example, ANN001 in https://pypi.org/project/flake8-annotations/

from flake8-annotations.

Cjkjvfnby avatar Cjkjvfnby commented on July 21, 2024

If it's fine to classify additional plugins output as warnings only

In the CI context, I prefer to treat anything reported by flake8 as errors. If something is reported it should be fixed, suppressed, or disabled. It does not matter for me which annotation will highlight these errors.

from flake8-annotations.

philosofool avatar philosofool commented on July 21, 2024

Thank your for your suggestions!

The annotations are generated by Githubs own annotator. Searching for warnings/errors is configured via regex in a static configuration file for the problemMatcher. It would very well be possible to include further annotations generated by flake8 plugins.
The regex for warnings is "^([^:]+):(\\d+):(\\d+):\\s+([CFNW]\\d+\\s+.+)$" right now. C, F, N and W are valid prefixes for warnings recognized for annotations. This can be extended for additional prefixes, or simply defined as a negation of error prefixes (only E right now, so [^E]).

If it's fine to classify additional plugins output as warnings only, I would prefer the second option, otherwise plugin outputs have to be categorized in warning and error level each. But it's definitely doable.

I tried coping the two problem-matcher.json files to my local .github and editing to include 'D' in the warning regex to add docstring violations to the annotations, but it does not appear to have worked. I'm a new two github actions---it there something else I have to reference to change this functionality?

from flake8-annotations.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.