Hi all,
I'm writing a plugin to report custom violations (Class A may not access class B, to report layering problems in the project).
The code for analyzing the project has already been written, and it generates a simple report in XML (which class, line number, ...)
Now I'm trying to write a plugin to parse the XML and add the violations to Sonar. But before parsing the XML, I'm trying to just add a hard-coded violation to see if this works. I can add measures without any problem (based on the HelloWorld, but with INT instead of string, so I get a tendency as well). But the violations don't seem to show anywhere in the timeline or violations drilldown.
So, my question(s) :
- if the report is already generated (ant build), I suppose I don't need a MavenPluginHandler ?
- Can I do something like this in my Sensor ? :
<--->
...
Rule testRule = new Rule(HelloPlugin.PLUGIN_KEY, "violation_key",
"Test violation !", Iso9126RulesCategories.MAINTAINABILITY,
RulePriority.BLOCKER); Violation violation = new Violation(repository.getRule(), new JavaFile("some.package.SomeClass"));
Violation.setLineId(20);
Context.saveViolation(violation);
...
<--->
I got the feeling I'm missing something stupid here, as this does't work. The documentation doesn't seem to mention anything about the RulesRepository (which I already tried without success), or any plugin development besides the HelloWorld in fact.
Thanks in advance,
Geert
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email