Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-6709

Simplify RulesDefinition API when two plugins define the same repository

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2
    • Component/s: Plugin API, Rules
    • Labels:
      None

      Description

      A plugin can contribute to the rule engine of another plugin. For example the FbContrib plugin adds rules to the repository "findbugs" defined and executed by the Findbugs plugin (that is an unrealistic example as fbcontrib project was recently merged into the findbugs plugin).

      Previously API was different for the two plugins :

      // findbugs plugin
      NewRepository repository = context.createRepository("findbugs", "java").setName("Findbugs");
      // define rules...
      repository.done();
      
      // fbcontrib plugin
      NewExtendedRepository repository = context.extendRepository("findbugs", "java");
      // define rules...
      repository.done();
      

      The class NewExtendedRepository was used just to forbid plugins to change the repository name (no method #setName(String)).

      This brings useless complexity. Both plugins should share the same API. The contributing plugin can optionally set the name. The only important constraint is that the name is set at least once.

      // fbcontrib plugin : executing createRepository() with an existing key must not fail
      NewRepository fbcontrib = context.createRepository("findbugs", "java");
      // define rules...
      fbcontrib.done();
      

        Attachments

          Activity

            People

            Assignee:
            simon.brandhof Simon Brandhof (Inactive)
            Reporter:
            simon.brandhof Simon Brandhof (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: