Index: src/main/resources/org/sonar/plugins/flex/flexpmd/default-flex-profile.xml =================================================================== --- src/main/resources/org/sonar/plugins/flex/flexpmd/default-flex-profile.xml (revision 2093) +++ src/main/resources/org/sonar/plugins/flex/flexpmd/default-flex-profile.xml (working copy) @@ -1,9 +1,14 @@ - - - - - 3 - + + + + 3 + - - - Monkey patching can be a risky undertaking because it is not using intended extensibility points and thus may have unintended consequences or make migration to newer versions of the SDK more difficult - 1 - - - If you have different functionalities, you probably don't want every class of each to be accessible from any other functional areas. + + + Monkey patching can be a risky undertaking because it is not using intended extensibility points and thus may have unintended consequences or make migration to newer versions of the SDK more difficult + 1 + + + If you have different functionalities, you probably don't want every class of each to be accessible from any other functional areas. So you probably want to use this packaging: [org].[project].func1.api [org].[project].func1.restricted [org].[project].func2.api [org].[project].func2.restricted This rule makes sure that no restricted classes is accessed from outside its own function area. - 1 - 1 + - - - - 3 - - - 50 - - - - - - 1 - + + + 5 + + + + 3 + + + + 3 + + + 50 + + + + + Code behind files are tightly coupled with the view, not unit-testable, not easy to navigate the code code base and not reusable. Try using presentation model pattern, or observer pattern + 5 + + + + 3 + + + 5 + + + + + + 1 + - - - - 1 - + + + 1 + - - - A bindable ModelLocator could leads to performance issues due to bindings - 1 - + + A Binding expression is executed as soon as one of the bindable attributes changed. If a binding expression contains too many expression, there could be some performance issue. + 3 + + + 3 + + + + ]]> + + + A bindable ModelLocator could leads to performance issues due to bindings + 1 + - - - The ModelLocator should be only accessible from the main application file. Then sub-models should be injected to the nested views. - 5 - + + The ModelLocator should be only accessible from the main application file. Then sub-models should be injected to the nested views. + 3 + - - - Try split them into methods where you add commands depending on their functional area. - 3 - + + Try split them into methods where you add commands depending on their functional area. + 3 + + + + You would have something like 'productManagement.getProducts' as an event name. + 3 + - - - - 1 - + + + 3 + - - - - 5 - - - - 5 - - - - 3 - + + + 3 + + + UpdateDisplayList is called everytime a child is invalidated. So calling addChild or removeChild in this function could be really CPU consuming + 1 + + + If you needed to call 'callLater' explicitly, then you probably did not extend the correct component life cycle. + 1 + + + It is not a good practice to embed style blocks inside the MXML component. Prefer using external CSS files. + 3 + + + + 5 + + + + 3 + - - - Empty If Statement finds instances where a condition is checked but nothing is done about it. - 3 - + + Empty If Statement finds instances where a condition is checked but nothing is done about it. + 3 + - - - Why do you need to override clone? Well, the clone method creates a copy of your event (or object - whatever object has the clone event; this isn't limited to Event objects). The default clone method inherited by the Event class or whatever class your custom class extends, will return an event object of the type of that class, not your custom event subclass. In the situations where a clone is needed, it is needed to be of the same type of your class, not the class it extends. - 3 - + + When creating your own custom Event class, you must override the inherited Event.clone() method in order for it to duplicate the properties of your custom class. If you do not set all the properties that you add in your event subclass, those properties will not have the correct values when the event is cloned. This is important because the Flex SDK clones events whenever redispatching takes place. + 1 + - - - In order to improve encapsulation in your custom event, it is better not to have public variable in your event. Prefer having read-only attributes, set by the event constructor. - 5 - + + In order to improve encapsulation in your custom event, it is better not to have public variable in your event. Prefer having read-only attributes, set by the event constructor. + 3 + - - - This is pointless, since event listeners cannot be attached to an object before it has been constructed, so nothing can ever hear the event - 1 - + + This is pointless, since event listeners cannot be attached to an object before it has been constructed, so nothing can ever hear the event + 1 + - - - - 3 - + + + 3 + - - - You should not dispatch a plain string. If you rename this string, you need to replace the string listener as well. Use constants instead - 3 - + + You should not dispatch a plain string. If you rename this string, you need to replace the string listener as well. Use constants instead + 1 + - - - You should not listen for a plain string. If you rename this string, you need to replace the string listener as well. Use constants instead - 3 - + + You should not listen for a plain string. If you rename this string, you need to replace the string listener as well. Use constants instead + 1 + - - - Specifying a type will allow Flash builder and the class to have this event exposed in its API - 3 - + + + 1 + + + + Specifying a type will allow Flash builder and the class to have this event exposed in its API + 3 + - - - You should not Alert.show() directly. If an error occurred in the system, you should probably use an ErrorManager to have a consistent way to manage those errors. - 1 - - - A high number of imports can indicate a high degree of coupling within an object. Rule counts the number of unique imports and reports a violation if the count is above the user defined threshold. - 5 - - - 30 - - - + + + 3 + + + You should not Alert.show() directly. If an error occurred in the system, you should probably use an ErrorManager to have a consistent way to manage those errors. + 1 + + + A high number of imports can indicate a high degree of coupling within an object. Rule counts the number of unique imports and reports a violation if the count is above the user defined threshold. + 3 + + + 15 + + + + + + + 3 + - - - - 3 - - - When using dynamic classes, you cannot control how the developer will use your class. It makes refactoring really difficult - 1 - + + + 3 + + + When using dynamic classes, you cannot control how the developer will use your class. It makes refactoring really difficult + 1 + - - - It is a bad practice to use the dynamic class Object. Prefer using strongly typed object, or marker interface in order to avoid silent compilation errors while refactoring - 3 - + + It is a bad practice to use the dynamic class Object. Prefer using strongly typed object, or marker interface in order to avoid silent compilation errors while refactoring + 1 + - - - It is a bad practice to use the dynamic class Dictionary. Prefer using strongly typed object, or marker interface in order to avoid silent compilation errors while refactoring - 1 - + + It is a bad practice to use the dynamic class Dictionary. Prefer using strongly typed object, or marker interface in order to avoid silent compilation errors while refactoring + 1 + - - - - 1 - + + + 1 + - - - - 3 - + + + 1 + - - - This function is not needed. - 5 - + + This function is not needed. + 3 + - - - - 3 - + + + 3 + - - - - 3 - - - - 5 - + + + 3 + + + + 3 + - - - - 3 - + + + 3 + - - - - 3 - + + + 3 + - - - - 5 - + + + 5 + - - - Detects when a field, local, or parameter has a very short name. - 5 - - - 3 - - - + + + 1 + + + + + 1 + + + + 1 + + + Detects when a field, local, or parameter has a very short name. + 5 + + + 3 + + + - - - - 3 - + + Detects when a package definition contains upper case characters. + 3 + + + + + 3 + - - - - 3 - + + + 3 + - - - - 3 - + + + 3 + - - - - 3 - + + + 3 + - - - - 3 - - - 10 - - - - - The Just-In-Time compiler does not compile constructors. Make them as lightweight as possible, or move the complexity of the code to a method called by the constructor. Then the complexity will be compiled by the JIT. - 3 - - - - 1 - - - - 5 - - - A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. - 3 - - - 10 - - - + + Parsley can only process metadata that is placed onto public members. + 1 + + + + Each managed event should have matching [Event] metadata. + 1 + + + + + 1 + + + + + 1 + + + + 3 + + + + + 3 + + + + + 1 + + + + Prefer using embed filters in assets + 3 + + + + 3 + + + 10 + + + + + The Just-In-Time compiler does not compile constructors. Make them as lightweight as possible, or move the complexity of the code to a method called by the constructor. Then the complexity will be compiled by the JIT. + 3 + + + + 1 + + + + 3 + + + + 3 + + + + 3 + + + A recursive style manager call can be a very expensive operation, causing parts of the UI to flicker visibly. Instead it is preferable to defer the creation of parts of the UI that depend on a runtime CSS SWF until after the SWF has been loaded. In this case a recursive call is not required. + 3 + + + + 5 + + + + + 5 + + + + + 5 + + + + A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. + 3 + + + 10 + + + - - - Violations of this rule usually indicate that the method has too much responsibility. Try to reduce the method size by creating helper methods and removing any copy/pasted code. - 3 - - - 20 - - - + + Violations of this rule usually indicate that the method has too much responsibility. Try to reduce the method size by creating helper methods and removing any copy/pasted code. + 3 + + + 20 + + + - - - A switch case statement should be either empty, or contain a break, or call another method. - 3 - - - 3 - - - + + A switch case statement should be either empty, or contain a break, or call another method. + 3 + + + 3 + + + - - - Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together. - 3 - - - 4 - - - + + Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together. + 3 + + + 4 + + + - - - A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it. - 3 - - - 10 - - - + + A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it. + 3 + + + 10 + + + - - - Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zipcode fields could instead have one Address field. - 3 - - - 5 - - - + + Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zipcode fields could instead have one Address field. + 3 + + + 5 + + + - - - - 3 - - - Even if this is syntactically correct, there should not be a return type for a constructor. - 5 - + + + 3 + + + Even if this is syntactically correct, there should not be a return type for a constructor. + 5 + - - - - 5 - + + + 5 + + + 200 + + + + + + 5 + - - - - 5 - - - - 5 - - - Switch statements should have a default label in order to detect corner cases. - 1 - + + + 5 + + + Switch statements should have a default label in order to detect corner cases. + 1 + - - - As a general practice, switch statement should not be used. Prefer using inheritance. It is even harder to read when switch statements are nested. - 3 - + + As a general practice, switch statement should not be used. Prefer using inheritance. It is even harder to read when switch statements are nested. + 3 + - - - Switch statements are designed for complex branches, and allow branches to share treatment. Using a switch for only 2 branches is ill advised, as switches are not as easy to understand as if. In this case, it's most likely is a good idea to use a if statement - 5 - - - 3 - - - - - - 1 - - - - 3 - - - - 1 - + + Switch statements are designed for complex branches, and allow branches to share treatment. Using a switch for only 2 branches is ill advised, as switches are not as easy to understand as if. In this case, it's most likely is a good idea to use a if statement + 5 + + + 3 + + + + + + 1 + + + + 3 + + + + 1 + - - - - 3 - + + + 3 + - - - - 1 - - - - 1 - - - - 1 - + + + + 1 + + + + 1 + + + + 1 + + + + 1 + + + + + 1 + + + + + 1 + + + + + 1 + + + + + 5 + + + + + 5 + \ No newline at end of file Index: src/main/resources/org/sonar/plugins/flex/flexpmd/rules.xml =================================================================== --- src/main/resources/org/sonar/plugins/flex/flexpmd/rules.xml (revision 2093) +++ src/main/resources/org/sonar/plugins/flex/flexpmd/rules.xml (working copy) @@ -913,4 +913,87 @@ 2 Maintainability + + + 1 + Reliability + + + + + 1 + Reliability + + + + + 1 + Reliability + + + + + 1 + Reliability + + + + + 4 + Reliability + + + + + 4 + Reliability + + + + 1 + Reliability + + + + + 1 + Reliability + + + + + 1 + Reliability + + + + + 1 + Reliability + + + + + 5 + Reliability + + + + + 5 + Reliability + + \ No newline at end of file Index: src/main/java/org/sonar/plugins/flex/flexmetrics/FlexMetricsMavenPluginHandler.java =================================================================== --- src/main/java/org/sonar/plugins/flex/flexmetrics/FlexMetricsMavenPluginHandler.java (revision 2093) +++ src/main/java/org/sonar/plugins/flex/flexmetrics/FlexMetricsMavenPluginHandler.java (working copy) @@ -34,7 +34,7 @@ } public String getVersion() { - return "1.1"; + return "1.2"; } public boolean isFixedVersion() { Index: src/main/java/org/sonar/plugins/flex/cpd/FlexCpdMavenPluginHandler.java =================================================================== --- src/main/java/org/sonar/plugins/flex/cpd/FlexCpdMavenPluginHandler.java (revision 2093) +++ src/main/java/org/sonar/plugins/flex/cpd/FlexCpdMavenPluginHandler.java (working copy) @@ -42,7 +42,7 @@ } public String getVersion() { - return "1.1"; + return "1.2"; } public boolean isFixedVersion() { Index: src/main/java/org/sonar/plugins/flex/flexpmd/FlexPmdMavenPluginHandler.java =================================================================== --- src/main/java/org/sonar/plugins/flex/flexpmd/FlexPmdMavenPluginHandler.java (revision 2093) +++ src/main/java/org/sonar/plugins/flex/flexpmd/FlexPmdMavenPluginHandler.java (working copy) @@ -47,7 +47,7 @@ } public String getVersion() { - return "1.0"; + return "1.2"; } public boolean isFixedVersion() { Index: src/test/java/org/sonar/plugins/flex/flexpmd/FlexPmdRulesRepositoryTest.java =================================================================== --- src/test/java/org/sonar/plugins/flex/flexpmd/FlexPmdRulesRepositoryTest.java (revision 2093) +++ src/test/java/org/sonar/plugins/flex/flexpmd/FlexPmdRulesRepositoryTest.java (working copy) @@ -45,7 +45,7 @@ @Test public void loadFlexRulesRepositoryAndCheckMandatoryFields() { List rules = repository.getInitialReferential(); - assertThat(rules.size(), is(82)); + assertThat(rules.size(), is(94)); for (Rule rule : rules) { assertNotNull(rule.getKey()); assertNotNull(rule.getDescription()); @@ -65,7 +65,7 @@ @Test public void testBuildProvidedProfile() { List defaultProfile = repository.getProvidedProfiles().get(0).getActiveRules(); - assertThat(defaultProfile.size(), is(66)); + assertThat(defaultProfile.size(), is(87)); } @Test