shipmonk-rnd / composer-dependency-analyser

🚀 Fast detection of composer dependency issues (unused dependencies, shadow dependencies, misplaced dependencies)
MIT License
332 stars 8 forks source link

Summarize usage in JUnit report is difficult to exploit #157

Closed llaville closed 23 hours ago

llaville commented 1 week ago

Hello,

While I may understand that we can summarize usage in console output format like this

cda-summarize-console-output

It's very difficult to exploit from JUnit report. Here are a chunk of it corresponding to previous screenshot.

  <testsuite name="dev dependencies in production code" failures="2">
    <testcase name="php-parallel-lint/php-console-highlighter">
      <failure>PHP_Parallel_Lint\PhpConsoleHighlighter\Highlighter\n  src/Converter/AbstractConverter.php:461</failure>
    </testcase>
    <testcase name="symfony/console">
      <failure>Symfony\Component\Console\Command\Command\n  src/Console/Command/ConvertCommand.php:44\n  src/Console/Command/ConvertCommand.php:164\nSymfony\Component\Console\Input\InputArgument\n  src/Console/Command/ConvertCommand.php:53\n  src/Console/Command/ConvertCommand.php:58\nSymfony\Component\Console\Input\InputInterface\n  src/Console/Command/ConvertCommand.php:88\n  src/Converter/Reporter/PhpInsightsFormatter.php:27\n  src/Converter/Reporter/PhpInsightsFormatter.php:36\n  + 3 more symbols</failure>
    </testcase>
  </testsuite>

Uses of EOL \n and + 3 more symbols terms

Unless we specify --show-all-usages

llaville commented 1 week ago

Rather than previous JUnit report results, I'd like to have this one :

  <testsuite name="dev dependencies in production code" failures="4" tests="2">
    <testcase name="php-parallel-lint/php-console-highlighter">
      <failure message="PHP_Parallel_Lint\PhpConsoleHighlighter\Highlighter">
        src/Converter/AbstractConverter.php:461
      </failure>
    </testcase>
    <testcase name="symfony/console">
      <failure message="Symfony\Component\Console\Command\Command">
        src/Console/Command/ConvertCommand.php:44
        src/Console/Command/ConvertCommand.php:164
      </failure>
      <failure message="Symfony\Component\Console\Input\InputArgument">
        src/Console/Command/ConvertCommand.php:53  
        src/Console/Command/ConvertCommand.php:58
      </failure>
      <failure message="Symfony\Component\Console\Input\InputInterface">
        src/Console/Command/ConvertCommand.php:88
        src/Converter/Reporter/PhpInsightsFormatter.php:27
        src/Converter/Reporter/PhpInsightsFormatter.php:36
      </failure>
    </testcase>
  </testsuite>

That follows better Junit schema : see at https://llg.cubic.org/docs/junit/

Especially the testsuite failures and tests counter that match reality (that should be adapted if we use of course the --show-all-usages option)

PS: without \n it's better

janedbal commented 1 week ago

I generally agree, lets get rid of that + 3 symbols and invalid \n.