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

Fix score option for JSON export #3514

Conversation

Pierre-Sassoulas
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas commented Apr 26, 2020

Steps

  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.

Description

This fix #3504, but I wonder... It looks like the fabled bug that will break countless integration by being fixed. --score=y is the default setting, and JSON is probably a prime candidate for automation. Is it reasonable to fix it and ask everyone to change their option to -s n? I'm pretty sure no one read the pylint's changelog and even if they do we can't know how many poeple have a working continuous integration that iwll be broken by this.

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes #3504

@coveralls
Copy link

coveralls commented Apr 26, 2020

Coverage Status

Coverage increased (+0.005%) to 91.48% when pulling f6b5a72 on Pierre-Sassoulas:fix-3504-json-reporter into 6721cd1 on PyCQA:master.

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the fix-3504-json-reporter branch 2 times, most recently from 1119f87 to 94442df Compare April 26, 2020 10:44
"""Don't do anything in this reporter."""
output = io.StringIO()
TextWriter().format(layout, output)
score = output.getvalue().split("\n")[1]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a better way, but understanding the way the VNode works and how one can finally get the message encapsulated in ten layers of linked list and visitor pattern does not seem worth it.

@PCManticore
Copy link
Contributor

Uf, this is tough. I don't think we should fix it as the JSON integration is most likely at the basis of multiple CI tools for consuming and displaying pylint results (e.g. tools like Codacy or custom Jenkins integrations come to mind).

Seems like a good candidate for a potential 3.0 release though, but for now we should keep it as is.

This is a fix but I wonder... This looks like the fabled bug that will
break countless integration by being fixed. `--score=y` is the default setting,
and json is probably a prime candidate for automation. Is it reasonable to fix
it and ask everyone to change their option to `-s n`? I'm pretty sure no one
read the pylint's changelog unless we break their build.
@Pierre-Sassoulas Pierre-Sassoulas force-pushed the fix-3504-json-reporter branch from f6b5a72 to 46b050d Compare March 7, 2021 09:51
@Pierre-Sassoulas Pierre-Sassoulas changed the base branch from master to 3.0.0.alpha March 7, 2021 09:52
@Pierre-Sassoulas Pierre-Sassoulas merged commit 2eae8a4 into pylint-dev:3.0.0.alpha Mar 7, 2021
@Pierre-Sassoulas Pierre-Sassoulas deleted the fix-3504-json-reporter branch March 7, 2021 09:56
@angristan
Copy link

This looks very unhandy to consume programmatically:

[
    {
        "type": "convention",
        "module": "fib",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "fib.py",
        "symbol": "missing-module-docstring",
        "message": "Missing module docstring",
        "message-id": "C0114"
    },
    {
        "score": "Your code has been rated at 3.33/10"
    }
]

Wouldn't something like this be better?

{
    "score": 0.333,
    "violations": [
        {
            "type": "convention",
            "module": "fib",
            "obj": "",
            "line": 1,
            "column": 0,
            "path": "fib.py",
            "symbol": "missing-module-docstring",
            "message": "Missing module docstring",
            "message-id": "C0114"
        }
    ]
}

@Pierre-Sassoulas
Copy link
Member Author

You're right. And as 3.0 is an alpha version, everything can change right now :) Could you open an issue for this, please ?

@angristan
Copy link

Sure 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exporting to JSON does not honor score option
4 participants