Skip to content

Exporting to JSON does not honor score option #3504

@Yenthe666

Description

@Yenthe666

Steps to reproduce

  1. Run pylint on some random Python file or module:
pylint  ~/Desktop/pylint_test.py

As you can see this outputs some warnings/scoring:

************* Module pylint_test
/home/administrator/Desktop/pylint_test.py:1:0: C0111: Missing module docstring (missing-docstring)
/home/administrator/Desktop/pylint_test.py:1:0: W0611: Unused import requests (unused-import)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
  1. Now run the same command but with -f json to export it to JSON:
pylint ~/Desktop/pylint_test.py  -f json

The output doesn't contain the scores now anymore:

[
    {
        "type": "convention",
        "module": "pylint_test",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "/home/administrator/Desktop/pylint_test.py",
        "symbol": "missing-docstring",
        "message": "Missing module docstring",
        "message-id": "C0111"
    },
    {
        "type": "warning",
        "module": "pylint_test",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "/home/administrator/Desktop/pylint_test.py",
        "symbol": "unused-import",
        "message": "Unused import requests",
        "message-id": "W0611"
    }
]
  1. Now execute it with -f json again but also supply the --score=y option:
[
    {
        "type": "convention",
        "module": "pylint_test",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "/home/administrator/Desktop/pylint_test.py",
        "symbol": "missing-docstring",
        "message": "Missing module docstring",
        "message-id": "C0111"
    },
    {
        "type": "warning",
        "module": "pylint_test",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "/home/administrator/Desktop/pylint_test.py",
        "symbol": "unused-import",
        "message": "Unused import requests",
        "message-id": "W0611"
    }
]

Current behavior

The score is not outputted when exporting to JSON, not even when --score=y is activated.

Expected behavior

The score is added to the JSON, at least when --score=y is activated.

pylint --version output

pylint 2.3.0
astroid 2.2.0
Python 3.7.5 (default, Nov 20 2019, 09:21:52) 
[GCC 9.2.1 20191008]

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions