Giter Site home page Giter Site logo

Comments (9)

asottile avatar asottile commented on May 25, 2024

third method on StyleGuide from your link?

from pycodestyle.

jimka2001 avatar jimka2001 commented on May 25, 2024

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.

sigmavirus24 avatar sigmavirus24 commented on May 25, 2024

You can provide your own report class to capture them. It needs only implement what is documented for BaseReport

from pycodestyle.

jimka2001 avatar jimka2001 commented on May 25, 2024

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.

asottile avatar asottile commented on May 25, 2024

a bit annoying to need to repeat what was said above: you need to write a subclass of Base report

from pycodestyle.

sigmavirus24 avatar sigmavirus24 commented on May 25, 2024

@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.

jimka2001 avatar jimka2001 commented on May 25, 2024

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.

asottile avatar asottile commented on May 25, 2024

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.

sigmavirus24 avatar sigmavirus24 commented on May 25, 2024

@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)

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.