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

[Fix #9780] Support summary report for JUnitFormatter #9781

Merged

Commits on May 6, 2021

  1. [Fix rubocop#9780] Support summary report for JUnitFormatter

    Fixes rubocop#9780.
    
    This PR supports summary report for `JUnitFormatter`.
    
    It adds the following attributes to the `<testsuite>` element.
    
    - `tests` attribute ... Inspected file count.
    - `failures` attribute ... Total offense count.
    
    This is a JUnit format example:
    
    ```xml
    % rubocop -f junit --display-only-failed lib/rubocop/formatter/junit_formatter.rb
    <?xml version='1.0'?>
    <testsuites>
      <testsuite name='rubocop' tests='1' failures='2'>
        <testcase classname='lib.rubocop.formatter.junit_formatter' name='Layout/LineLength'>
          <failure type='Layout/LineLength' message='Layout/LineLength: Line is too long. [110/100]'>
            /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/formatter/junit_formatter.rb:65:101
          </failure>
        </testcase>
        <testcase classname='lib.rubocop.formatter.junit_formatter' name='Metrics/AbcSize'>
          <failure type='Metrics/AbcSize' message='Metrics/AbcSize:
    Assignment Branch Condition size for file_finished is too high. [&lt;8, 16, 2&gt; 18/17]'>
            /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/formatter/junit_formatter.rb:29:7
          </failure>
        </testcase>
      </testsuite>
    </testsuites>
    ```
    
    These mean the values of `1 file inspected` and `2 offenses detected` below.
    
    ```console
    % rubocop lib/rubocop/formatter/junit_formatter.rb
    Inspecting 1 file
    (snip)
    
    1 file inspected, 2 offenses detected, 2 offenses auto-correctable
    ```
    koic committed May 6, 2021
    Configuration menu
    Copy the full SHA
    5922b24 View commit details
    Browse the repository at this point in the history