ruby-sonar-plugin-utils
Contains a bunch of utility scripts to perform some file conversions and other preparation stuffs for original plugin.
Requirements
All scripts are pure Ruby scripts, so to be able to run provided scripts on your local machine you need:
- Have installed Ruby. The
rvmis a good choice to do it! - Install
bundlergem bygem install bundler - Install dependencies by running
bundle install
Utility scripts
Convert rubocop rules into SonarQube profile rules
Command specification:
$ ./rubocop_rules_to_profile.rb -i <INPUT_FILE_PATH> -o <OUTPUT_FILE_PATH>Converts an YAML file with Rubocop rules into XML file of SonarQube profile rules.
Details
Example of Rubocop rules file:
Style/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
StyleGuide: '#indent-public-private-protected'
Enabled: trueExample of SQ profile rule definition part:
<rule>
<repositoryKey>rubocop</repositoryKey>
<key>Style/AccessModifierIndentation</key>
<priority>MINOR</priority>
</rule>Default severity level mapping depending on the Rubocop's rule key:
KEY_PREFIX_MAPPING_TO_PRIORITY = {
/^Style/ => SonarQube::RulePriorities::MINOR,
/^Metrics/ => SonarQube::RulePriorities::INFO,
/^Lint/ => SonarQube::RulePriorities::MINOR,
/^Bundler/ => SonarQube::RulePriorities::INFO,
/^Performance/ => SonarQube::RulePriorities::MINOR,
/^Rails/ => SonarQube::RulePriorities::MINOR,
/^Security/ => SonarQube::RulePriorities::CRITICAL
}Convert rubocop rules into SonarQube rule definitions
Command specification:
$ ./rubocop_rules_to_sq_rule_definitions.rb -i <INPUT_FILE_PATH> -o <OUTPUT_FILE_PATH>Converts an YAML file with Rubocop rules into XML file of SonarQube rule definitions.
Details
Example of Rubocop rules file:
Style/AccessModifierIndentation:
Description: Check indentation of private/protected visibility modifiers.
StyleGuide: '#indent-public-private-protected'
Enabled: trueExample of SQ rule definition part:
<rules>
<rule>
<key>Style/AccessModifierIndentation</key>
<priority>MINOR</priority>
<name>Check indentation of private/protected visibility modifiers.</name>
<description>Check indentation of private/protected visibility modifiers.</description>
<type>CODE_SMELL</type>
<status>ready</status>
</rule>
</rules>Developing
Testing
All scripts are fully tested by unit tests. For running tests, please, use the following command:
$ bundle exec rake
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
