Code Monkey home page Code Monkey logo

Comments (7)

carlio avatar carlio commented on June 23, 2024

@guykisel What format does pre-commit require? There are several output options available already (see http://prospector.readthedocs.org/en/latest/usage.html#output-format). Are any of them useful?

If not, feel free to create a new output formatter which can fix exactly what you need. Examples are here: https://github.com/landscapeio/prospector/tree/master/prospector/formatters

I'm happy to answer any questions :)

from prospector.

guykisel avatar guykisel commented on June 23, 2024

There's no particular required format, it normally just displays whatever is written to stdout with no modifications. Your default human-readable format is actually pretty much perfect, I just want to skip the headers because they end up being a little redundant.

Example output (with -M arg):

13:22 $ pre-commit run prospector --all-files
prospector..................................................................................................................................................................................Failed
hookid: prospector

Messages
========

Messages
========

__init__ (services/platform/base/__init__.py):
    L17:4 Base.url: pylint - W0221
    Arguments number differs from overridden method

__init__ (services/platform/base/__init__.py):
    L17:17 Base.url: pylint - W0613
    Unused argument 'secure'

Messages
========

Messages
========

Messages
========

Messages
========

preferences (services/platform/data/preferences.py):
    L21:24 Preferences.get_preferences: pylint - W0613
    Unused argument 'ship_id'

from prospector.

guykisel avatar guykisel commented on June 23, 2024

Looks like I could make my own version of the text.py formatter that just doesn't include the header. Is it possible to tell prospector to use a 3rd party formatter?

from prospector.

carlio avatar carlio commented on June 23, 2024

Right now there's no ability to use a third-party formatter, but I don't mind merging in one called "precommit" or whatever you want. Also happy to merge in a change to allow third-party formatters!

Maybe a feature which allows 'output template' strings would be nice, so you could say:

prospector --output-template "%(code)s %(message)s %(linenumber)s"

from prospector.

guykisel avatar guykisel commented on June 23, 2024

Cool, that would be nice. I was also thinking, an alternative would be to modify prospector to allow an arbitrary number of positional path arguments, as opposed to being limited to one. I suspect this would require more significant modifications, though.

from prospector.

carlio avatar carlio commented on June 23, 2024

@guykisel Yes, I think that is the better solution but it requires fiddling with setoptconf a bit so it is perhaps non-trivial. That is something I'd like to do though.

from prospector.

guykisel avatar guykisel commented on June 23, 2024

I think once prospector can accept multiple input paths, the pre-commit hook would work great without needing a custom formatter.

Until then, the pylint formatter provides output that doesn't have a header, so I'll just suggest that users of the hook specify that formatter.

Thank you for your help!

from prospector.

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.