Comments (9)
third method on StyleGuide from your link?
from pycodestyle.
This is a big step forward. But the 3rd method input_file
does not return a list of PEP issues; rather it prints them to stdout. Looks like it return the count of how many issues were found.
Do I need to capture stdout by some sort of re-direction? Or is there a different method I should call?
from pycodestyle.
You can provide your own report class to capture them. It needs only implement what is documented for BaseReport
from pycodestyle.
Sorry, but I don't see any documented method in BaseReport
which returns a list of issues, or generator or or or. I see methods which count the issues, and methods which report the issues by printing them. There are some comments about collecting issues, but the documentation does not indicate how to access the collected issues without printing them and parsing the output. Anyway, I'm not confident about parsing the output.
A line looks like this:
/Users/jnewton/Repos/courses/dir-algebra-1/bcs-algebra-1/algebra/tests/../algebra/choose.py:8:1: E303 too many blank lines (3)
But the file name or the trailing text might contain a :
so I don't really know how to parse the text output.
If I am expected to create a subclass of BaseReport
, then I think I'd need a call which will give me programmatic access the the issues generated. Right? Or am I failing to understand something fundamental?
from pycodestyle.
a bit annoying to need to repeat what was said above: you need to write a subclass of Base report
from pycodestyle.
@jimka2001 If you subclass BaseReport you can add whatever additional attributes you want to store the issues and methods you like to return them to you. We have an API that maybe isn't the best documented but it will allow you to do exactly what you want. If you don't want to put in that work, you can instead use flake8
and flake8-json
to get more easily machine parsed output.
from pycodestyle.
a bit annoying to need to repeat what was said above: you need to write a subclass of Base report
No need to be annoyed, just state plainly that what I'm trying to do is impossible with the currently documented interface.
If I understand your terse response, I'd have to implement a subclass at the application level, which cannot use the publicly documented interface but rather depends on internal implementation details which may change in future releases and render the application code incompatible.
from pycodestyle.
it's literally not impossible. I've done it before but you haven't even showed your attempt so it's a bit frustrating to try and help you when you're in "give me the code" mode
from pycodestyle.
@jimka2001 It seems like you're engaging in a bad faith discussion here. You want something similar, and when provided with an interface that has stayed stable for something like a decade, you're accusing us of providing you something we intend to break. What you're attempting to do is far from impossible. It's just not possible with a single function in the API. As a result, I'm locking this.
from pycodestyle.
Related Issues (20)
- E306 clarification HOT 1
- `exclude` is applied to `.`
- Inconsistent handling of indented comments (E116) HOT 3
- Use setuptools.build_meta HOT 1
- How to get in touch regarding a security concern HOT 2
- Latest version doesn't seem to handle self-documenting f-string syntax added back in 3.8 HOT 1
- pyproject.toml is not supported HOT 1
- False-positive E704 with single-line stubs (black 2024 style) HOT 1
- reporting incorrect information in format strings HOT 1
- Doc: StyleChecker(quiet) not documented HOT 1
- docs directory not shipped in pypi sdist HOT 1
- suppress <name> may be undefined, or defined from star imports HOT 3
- flake8 E704 Errors Triggered by Inline Ellipsis Formatting in Newer black Versions #1926 HOT 1
- docs: meta.pycqa.org code-of-conduct hyperlinks are not redirecting as expected.
- E251: keyword `=` vs. expressions with spaces HOT 1
- Spurious E231 for nested format substitutions
- E122: No valid indent for long function call nested in f-string? HOT 2
- f-string varialbes shows wrong E251 and E202 since python 3.12 upgrade HOT 2
- Not all errors get ignored when comment on same line HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycodestyle.