Uploaded image for project: 'Minimal Marketable Features'
  1. Minimal Marketable Features
  2. MMF-1378

SonarRuby provides support for the Ruby language

    Details

    • Type: MMF
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Labels:

      Description

      WHY

      See the WHY section in MMF-1214

      WHAT

      SLang AST Generation

      Based on the work done on SLang for SonarKotlin, we want to generate the SLang AST from the Ruby AST. We need to find a parser/compiler easy to use, easy to integrate and allowing us to feed the SLang AST nodes we defined in SLang. We need to play with the open source parsers available on the market and see which one suits our needs. It is better to try things for ourselves rather than relying on their documentation, thus we will do the following for each parser:

      • allocate a time-box (2 days?)
      • use the parser to generate the SLang AST
      • list the pros and cons of each parser

      Parser Candidates:

      Once this is done, we should be able to take a decision and quickly finalize the implementation.

      Duplication and Highlighting

      Once the uAST is fed, detection of duplications and source code highlighting should work out of the box. We just need to validate that it's working fine and handle at best the corner cases like the one of Kotlin vs import (SONARSLANG-62).

      Coverage

      SonarRuby should support the output generated by https://github.com/colszowka/simplecov which is the de facto standard.

      We have three options:

      1. develop our own SimpleCov Formatter supporting the Generic Test Data format: https://github.com/colszowka/simplecov/blob/master/doc/alternate-formatters.md (preferred option)
      2. rely on SimpleCov::Formatter::JSONFormatter: the generated json file shows SimpleCov has everything we need to feed the coverage data:
        • absolute file path: "filename"
        • details of covered lines, not covered lines, non-coverable lines available in the "coverage" field.
      3. rely on the default output generated by SimpleCov (HTML): it may be complex to parse the HTML format and to maintain the parser over time: this option is rejected

      If the option to develop our own SimpleCov Formatter is not chosen (option 1), the JSON output is probably the best alternative (option 2).

      External Analyzers

      SonarRuby 1.0 should support the import of external issues generated by RuboCop and embed the title/description/type of all rules provided RuboCop. RuboCop is the linter embedded in RubyMine, the IDE dedicated to Ruby.

      Out of Scope

      Test Frameworks on the Ruby world are:

      We don't know yet which standard is used to output test results on the Ruby world and this is not a top priority for SonarRuby 1.0 to have this feature. That's why the import of unit tests is out of the scope of this MMF.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alexandre.gigleux Alexandre Gigleux
                Reporter:
                alexandre.gigleux Alexandre Gigleux
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: