nunomaduro / phpinsights

πŸ”° Instant PHP quality checks from your console
https://phpinsights.com
MIT License
5.28k stars 281 forks source link

Reusing Json and Checkstyle report with shortener filenames is hardest #683

Closed llaville closed 2 months ago

llaville commented 3 months ago
Q A
Bug report? no
Feature request? yes
Library version 2.11.0

Hello

IMO using path shortener for files into JSON and CheckStyle output format is a non-sense. Especially if we want to reuse these reports with a third-party tool.

The only way I may accept (because I understand the console width limitation) is the default console report.

Who can be able to retrieve easily file(s) in source tree ?

May I suggest to provide absolute paths, especially if there is provide on command-line.

Thanks.

Here are a chunk of code reports produced by PHP Insights 2.11.0

Console

[MISC] 96.4 pts on coding style

β€’ [Code] Forbidden setter:
  BuilderDeclarationInterface.php:21: Setters are not allowed. Use constructor injection and behavior naming instead.

β€’ [Code] Declare strict types:
  SourceFactoryInterface.php:1: Expected 1 line before declare statement, found 0.
  SourceInterface.php:1: Expected 1 line after declare statement, found 0.
  SourceInterface.php:1: Expected 1 line before declare statement, found 0.
  +11 issues omitted

JSON format

{
    "summary": {
        "code": 95,
        "complexity": 100,
        "architecture": 94.1,
        "style": 96.4,
        "security issues": 0,
        "fixed issues": 0
    },
    "Code": [
        {
            "title": "Forbidden setter",
            "insightClass": "NunoMaduro\\PhpInsights\\Domain\\Sniffs\\ForbiddenSetterSniff",
            "file": "BuilderDeclarationInterface.php",
            "line": 21,
            "message": "Setters are not allowed. Use constructor injection and behavior naming instead."
        },
        {

Checkstyle format

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
    <file name="BuilderDeclarationInterface.php">
        <error severity="error" source="NunoMaduro.PhpInsights.Domain.Sniffs.ForbiddenSetterSniff" line="21"
               message="Setters are not allowed. Use constructor injection and behavior naming instead."/>
        <error severity="error" source="SlevomatCodingStandard.Sniffs.TypeHints.DeclareStrictTypesSniff" line="1"
               message="Expected 1 line after declare statement, found 0."/>
        <error severity="error" source="SlevomatCodingStandard.Sniffs.TypeHints.DeclareStrictTypesSniff" line="1"
               message="Expected 1 line before declare statement, found 0."/>
        <error severity="error" source="SlevomatCodingStandard.Sniffs.TypeHints.DisallowMixedTypeHintSniff" line="19"
               message="Usage of &quot;mixed&quot; type hint is disallowed."/>
        <error severity="error" source="SlevomatCodingStandard.Sniffs.Classes.SuperfluousInterfaceNamingSniff" line="16"
               message="Superfluous suffix &quot;Interface&quot;."/>
        <error severity="error" source="PHP_CodeSniffer.Standards.Generic.Sniffs.Files.LineLengthSniff" line="21"
               message="Line exceeds 80 characters; contains 82 characters"/>
        <error severity="error" source="SlevomatCodingStandard.Sniffs.Namespaces.NamespaceSpacingSniff" line="8"
               message="Expected 1 line before namespace statement, found 0."/>
        <error severity="error" source="SlevomatCodingStandard.Sniffs.Commenting.DocCommentSpacingSniff" line="14"
               message="Expected 1 line between different annotations types, found 0."/>
    </file>
    <file name="BuilderFactoryInterface.php">