Hello,
When I use this plugin with flake8, I run the following:
flake8 \
--tee \
--format codeclimate \
--output-file "${flake8_json}" \
.
The output I get is a set of JSON objects, each on a new line, representing CodeClimate issues.
{"type": "issue", "check_name": "F401", "description": "'conans.tools' imported but unused", "fingerprint": "577d8c7e937e52346d5ec5772244c7989e50b81eefad5728c88a26195d09d2ac", "content": {"body": "`from conans import ConanFile, tools, CMake\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 1, "end": 1}, "positions": {"begin": {"line": 1, "column": 1}, "end": {"line": 1, "column": 1}}}, "remediation_points": null}
{"type": "issue", "check_name": "F401", "description": "'conans.tools.Version' imported but unused", "fingerprint": "1bb35ecea90301cfcf2a4db42f1ff6d871eb790617840ae893adf566b1da0a0d", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null}
{"type": "issue", "check_name": "F401", "description": "'conans.tools.check_min_cppstd' imported but unused", "fingerprint": "bb5b829450a82791c3e4b4247f8089de368106b3ef7b84085f5be60b3ab314e2", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null}
The problem is that this is technically invalid JSON, since these objects should be in an array, which requires square braces around the objects ([]) and commas after each entry (except the last one).
[
{"type": "issue", "check_name": "F401", "description": "'conans.tools' imported but unused", "fingerprint": "577d8c7e937e52346d5ec5772244c7989e50b81eefad5728c88a26195d09d2ac", "content": {"body": "`from conans import ConanFile, tools, CMake\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 1, "end": 1}, "positions": {"begin": {"line": 1, "column": 1}, "end": {"line": 1, "column": 1}}}, "remediation_points": null},
{"type": "issue", "check_name": "F401", "description": "'conans.tools.Version' imported but unused", "fingerprint": "1bb35ecea90301cfcf2a4db42f1ff6d871eb790617840ae893adf566b1da0a0d", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null},
{"type": "issue", "check_name": "F401", "description": "'conans.tools.check_min_cppstd' imported but unused", "fingerprint": "bb5b829450a82791c3e4b4247f8089de368106b3ef7b84085f5be60b3ab314e2", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null}
]
Would it be possible to tweak the output from this plugin to be valid JSON?
Thanks!
Hello,
When I use this plugin with flake8, I run the following:
flake8 \ --tee \ --format codeclimate \ --output-file "${flake8_json}" \ .The output I get is a set of JSON objects, each on a new line, representing CodeClimate issues.
{"type": "issue", "check_name": "F401", "description": "'conans.tools' imported but unused", "fingerprint": "577d8c7e937e52346d5ec5772244c7989e50b81eefad5728c88a26195d09d2ac", "content": {"body": "`from conans import ConanFile, tools, CMake\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 1, "end": 1}, "positions": {"begin": {"line": 1, "column": 1}, "end": {"line": 1, "column": 1}}}, "remediation_points": null} {"type": "issue", "check_name": "F401", "description": "'conans.tools.Version' imported but unused", "fingerprint": "1bb35ecea90301cfcf2a4db42f1ff6d871eb790617840ae893adf566b1da0a0d", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null} {"type": "issue", "check_name": "F401", "description": "'conans.tools.check_min_cppstd' imported but unused", "fingerprint": "bb5b829450a82791c3e4b4247f8089de368106b3ef7b84085f5be60b3ab314e2", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null}The problem is that this is technically invalid JSON, since these objects should be in an array, which requires square braces around the objects (
[]) and commas after each entry (except the last one).[ {"type": "issue", "check_name": "F401", "description": "'conans.tools' imported but unused", "fingerprint": "577d8c7e937e52346d5ec5772244c7989e50b81eefad5728c88a26195d09d2ac", "content": {"body": "`from conans import ConanFile, tools, CMake\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 1, "end": 1}, "positions": {"begin": {"line": 1, "column": 1}, "end": {"line": 1, "column": 1}}}, "remediation_points": null}, {"type": "issue", "check_name": "F401", "description": "'conans.tools.Version' imported but unused", "fingerprint": "1bb35ecea90301cfcf2a4db42f1ff6d871eb790617840ae893adf566b1da0a0d", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null}, {"type": "issue", "check_name": "F401", "description": "'conans.tools.check_min_cppstd' imported but unused", "fingerprint": "bb5b829450a82791c3e4b4247f8089de368106b3ef7b84085f5be60b3ab314e2", "content": {"body": "`from conans.tools import Version, check_min_cppstd, OSInfo\n`"}, "categories": ["Bug Risk"], "location": {"path": "./conanfile.py", "lines": {"begin": 2, "end": 2}, "positions": {"begin": {"line": 2, "column": 1}, "end": {"line": 2, "column": 1}}}, "remediation_points": null} ] Would it be possible to tweak the output from this plugin to be valid JSON? Thanks!