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

JUnit format improvements #164

Merged
merged 1 commit into from
Jul 17, 2024
Merged

JUnit format improvements #164

merged 1 commit into from
Jul 17, 2024

Conversation

janedbal
Copy link
Member

@janedbal janedbal requested a review from JanTvrdik July 16, 2024 11:54
@janedbal janedbal merged commit db52364 into master Jul 17, 2024
36 checks passed
@janedbal janedbal deleted the junit-improvements branch July 17, 2024 11:43
@llaville
Copy link

@janedbal I like the new version, but I've a comment to improved reusability again.

When CDA found multiple files failures, rather than having such results :

    <testcase name="PHPStan\Command\AnalysisResult">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PhpStanNormalizer.php:37
/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PhpStanNormalizer.php:53
/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpStanFormatter.php:32</failure>
    </testcase>

I'd like to have :

    <testcase name="PHPStan\Command\AnalysisResult">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PhpStanNormalizer.php:37</failure>
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PhpStanNormalizer.php:53</failure>
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpStanFormatter.php:32</failure>
    </testcase>

Are you agree with such changes ?

@janedbal
Copy link
Member Author

janedbal commented Jul 17, 2024

That would duplicate the symbol in failure.message, let me think about that.

<failure message="Shadow\Comparator">src/Printer.php:25</failure>
<failure message="Shadow\Comparator">src/Printer.php:29</failure>

@janedbal
Copy link
Member Author

janedbal commented Aug 6, 2024

Done in #174

@llaville
Copy link

llaville commented Aug 6, 2024

Done in #174

Like it, gave better results, but found still an issue with failures counter.

Testing with my repo (https://github.com/llaville/sarif-php-converters/tree/1.0) as source code.

And when I run command :

bin/composer-dependency-analyser --composer-json ../../bartlett/sarif-php-converters/composer.json --verbose --format junit

I got these results

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="unknown classes" failures="19">
    <testcase name="Overtrue\PHPLint\Output\LinterOutput">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpLintReport.php:33</failure>
    </testcase>
    <testcase name="PHPMD\AbstractRenderer">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpMdRenderer.php:25</failure>
    </testcase>
    <testcase name="PHPMD\Report">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PhpMdNormalizer.php:55</failure>
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpMdRenderer.php:39</failure>
    </testcase>
    <testcase name="PHPStan\Command\AnalysisResult">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PhpStanNormalizer.php:31</failure>
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpStanFormatter.php:32</failure>
    </testcase>
    <testcase name="PHPStan\Command\ErrorFormatter\ErrorFormatter">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpStanFormatter.php:21</failure>
    </testcase>
    <testcase name="PHPStan\Command\Output">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpStanFormatter.php:32</failure>
    </testcase>
    <testcase name="PHP_CodeSniffer\Files\File">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpCsReport.php:50</failure>
    </testcase>
    <testcase name="PHP_CodeSniffer\Reports\Report">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/PhpCsReport.php:26</failure>
    </testcase>
    <testcase name="PhpCsFixer\Preg">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Source/EcsSource.php:156</failure>
    </testcase>
    <testcase name="Psalm\Plugin\EventHandler\Event\AfterAnalysisEvent">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/PsalmNormalizer.php:29</failure>
    </testcase>
    <testcase name="Rector\ChangesReporting\Contract\Output\OutputFormatterInterface">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/RectorFormatter.php:26</failure>
    </testcase>
    <testcase name="Rector\Contract\Rector\ConfigurableRectorInterface">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/RectorNormalizer.php:86</failure>
    </testcase>
    <testcase name="Rector\Contract\Rector\RectorInterface">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/RectorNormalizer.php:133</failure>
    </testcase>
    <testcase name="Rector\ValueObject\Configuration">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/RectorFormatter.php:42</failure>
    </testcase>
    <testcase name="Rector\ValueObject\ProcessResult">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/RectorNormalizer.php:41</failure>
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/RectorFormatter.php:42</failure>
    </testcase>
    <testcase name="Symplify\RuleDocGenerator\ValueObject\RuleDefinition">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/RectorNormalizer.php:124</failure>
    </testcase>
    <testcase name="TwigCsFixer\Report\Report">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/TwigCsFixerReporter.php:40</failure>
    </testcase>
    <testcase name="TwigCsFixer\Report\Reporter\ReporterInterface">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Reporter/TwigCsFixerReporter.php:26</failure>
    </testcase>
    <testcase name="TwigCsFixer\Report\Violation">
      <failure>/shared/backups/bartlett/sarif-php-converters/src/Converter/Normalizer/TwigCsFixerNormalizer.php:34</failure>
    </testcase>
  </testsuite>
  <testsuite name="shadow dependencies" failures="1">
    <testcase name="php-parallel-lint/php-console-color">
      <failure message="PHP_Parallel_Lint\PhpConsoleColor\ConsoleColor">/shared/backups/bartlett/sarif-php-converters/src/Converter/AbstractConverter.php:488</failure>
    </testcase>
  </testsuite>
  <testsuite name="dev dependencies in production code" failures="2">
    <testcase name="php-parallel-lint/php-console-highlighter">
      <failure message="PHP_Parallel_Lint\PhpConsoleHighlighter\Highlighter">/shared/backups/bartlett/sarif-php-converters/src/Converter/AbstractConverter.php:488</failure>
    </testcase>
    <testcase name="symfony/console">
      <failure message="Symfony\Component\Console\Application">/shared/backups/bartlett/sarif-php-converters/src/Console/Application.php:24</failure>
      <failure message="Symfony\Component\Console\Command\Command">/shared/backups/bartlett/sarif-php-converters/src/Console/Command/ConvertCommand.php:45</failure>
      <failure message="Symfony\Component\Console\Command\Command">/shared/backups/bartlett/sarif-php-converters/src/Console/Command/ConvertCommand.php:174</failure>
    </testcase>
  </testsuite>
  <!-- showing only first 3 example failure usages -->

Got

  <testsuite name="unknown classes" failures="19">

And expect to have 22 failures count.

Got

  <testsuite name="dev dependencies in production code" failures="2">

And expect to have 4 failures count.

@janedbal
Copy link
Member Author

janedbal commented Aug 6, 2024

Currently, it counts erroneous dependencies, not usages. But since the attribute is optional, we may remove it to avoid similar confusions...

@llaville
Copy link

llaville commented Aug 6, 2024

No keep it, I'm sorry I misunderstood.

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

Successfully merging this pull request may close these issues.

Summarize usage in JUnit report is difficult to exploit Allow to print Junit report in human-readable format
3 participants