Fix Version/s: None
See the WHY section in
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
Once this is done, we should be able to take a decision and quickly finalize the implementation.
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 (
SonarRuby should support the output generated by https://github.com/colszowka/simplecov which is the de facto standard.
We have three options:
- develop our own SimpleCov Formatter supporting the Generic Test Data format: https://github.com/colszowka/simplecov/blob/master/doc/alternate-formatters.md (preferred option)
- 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.
- 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).
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.
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.