Rules Repository

2 messages Options
Embed this post
Permalink
Alexander von Zitzewitz () Rules Repository
Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Rules Repository Hello !

Is it possible to create a new Rule Category like “Architecture”?  If I used that the rule never became visible. Moreover, is it possible to add the SonarJ rules to the default profiles or do user have to activate them manually?

Regards

Alexander

public class SonarJRulesRepository implements RulesRepository<Java> {    public final static Rule ARCH = new Rule(SonarJPlugin.KEY, "sonarj.architecture", "SonarJ Architecture Constraint", new RulesCategory("Maintainability"), RulePriority.MAJOR);    static    {        ARCH.setConfigKey("sonarj.architecture");        ARCH.setPluginName(SonarJPlugin.KEY);        ARCH.setDescription("Constraints are defined in the SonarJ architecture description");    }        public List<Rule> getInitialReferential()    {        return Arrays.asList(ARCH);    }    public Java getLanguage()    {        return Java.INSTANCE;    }    public List<RulesProfile> getProvidedProfiles()    {        return new ArrayList<RulesProfile>();    }    public List<Rule> parseReferential(String fileContent)    {        return new ArrayList<Rule>();    } }


Alexander von Zitzewitz



www.hello2morrow.com

SonarJ Elevator Pitch: http://www.hello2morrow.com/videos/benefits

+1 (877) 294-6327



Simon Brandhof () Re: Rules Repository
Reply Threaded More More options
Print post
Permalink
Categories are hardcoded and can not be changed. They represent ISO 9126 classification.
We plan to develop a tag mechanism in order to add any custom categories to rules. For example we could imagine a rule with tags "architecture" and "sonarj". Unfortunatly I can't give you any release date.

It's possible to add some rules to default profiles. Implement the method getProvidedProfiles() and return profiles named "Sonar way" or "Sun checks". Have a look at FindbugsRulesRepository or CheckstyleRulesRepository classes.