{iframe:src=http://update.sonarsource.org/plugins/flex.html|width=700|height=250|frameborder=0}
Your browser does not support iframes.
{iframe} |
If you want to see a live example of the capabilities of the Flex plugin, you can have a look at the analysis of the AS3 Core Lib project on Nemo. |
The plugin enables analysis of ActionScript projects within Sonar.
It is compatible with the Issues Report plugin to run pre-commit local analysis.
To launch a Sonar analysis of your Flex project, use the Sonar Runner.
A sample project is available on github that can be browsed or downloaded: /projects/languages/flex/flex-sonar-runner.
Maven and Ant can also be used to launch analysis on Flex projects.
If you want to have unit test results in your Sonar dashboard, execute your unit tests before running the Sonar analysis and use the "sonar.dynamicAnalysis=reuseReports" property along with the "sonar.surefire.reportsPath" one to specify where Sonar should retrieve the XML reports.
You can provide the path to the code coverage report (in cobertura xml format) using the "sonar.cobertura.reportPath" property (the value must point to the file location, not its folder).
See Metrics documentation page.
New coding rules can be added using XPath. See the related documentation.
To navigate the AST, download the SSLR Flex Toolkit.
FlexPMD engine - that is embedded in the Flex plugin, suffers from some bugs which can break Sonar analyses. Here are some of them you might encounter if FlexPMD rules are activated in the Flex quality profile that you are using:
<!-- this crashes FlexPMD -->
<fx:Metadata>
<![CDATA[[HostComponent("spark.components.ToggleButton")]]]>
</fx:Metadata>
<!-- this crashes FlexPMD as well (note the space between the 2 opening brackets -->
<fx:Metadata>
<![CDATA[ [HostComponent("spark.components.ToggleButton")]]]>
</fx:Metadata>
<!-- this does not crash -->
<!--fx:Metadata>
<![CDATA[
[HostComponent("spark.components.ToggleButton")]
]]>
</fx:Metadata--> |
private function foo(partName:String):void
{
switch (partName)
{
/*comment*/
case "test":
trace("foo");
break;
case "foo":
trace("foo");
break;
case "bar":
trace("foo");
break;
}
} |