]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2714 Reorganize core properties into categories
authorSimon Brandhof <simon.brandhof@gmail.com>
Thu, 18 Aug 2011 10:03:21 +0000 (12:03 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Thu, 18 Aug 2011 10:27:23 +0000 (12:27 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-design-plugin/src/main/java/org/sonar/plugins/design/DesignPlugin.java
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb

index b78f3822cb4fc6835699497887c556b003342e2d..ebc5c48a4c14548a32d18c30d6f8efd117fc4183 100644 (file)
@@ -48,7 +48,8 @@ import java.util.List;
         key = CoreProperties.ORGANIZATION,
         name = "Organization",
         description = "Identify your installation. Required to generate the server key and to benefit from licensed plugins. Server must be restarted for the change to take effect.",
-        global = true
+        global = true,
+        category = CoreProperties.CATEGORY_GENERAL
     ),
     @Property(
         key = CoreProperties.SERVER_BASE_URL,
@@ -56,14 +57,16 @@ import java.util.List;
         name = "Server base URL",
         description = "HTTP address of the Sonar server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails and to generate server key.",
         project = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_GENERAL),
     @Property(
         key = CoreProperties.CORE_COVERAGE_PLUGIN_PROPERTY,
         defaultValue = "cobertura",
         name = "Code coverage plugin",
         description = "Key of the code coverage plugin to use.",
         project = true,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_CODE_COVERAGE),
     @Property(
         key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY,
         defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE,
@@ -71,14 +74,16 @@ import java.util.List;
         description = "Set to false if sources should not be displayed, e.g. for security reasons.",
         project = true,
         module = true,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY),
     @Property(
         key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY,
         defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE,
         name = "Tendency period",
         description = TendencyDecorator.PROP_DAYS_DESCRIPTION,
         project = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
     @Property(
         key = CoreProperties.SKIP_TENDENCIES_PROPERTY,
         defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE,
@@ -86,48 +91,55 @@ import java.util.List;
         description = "Skip calculation of measure tendencies",
         project = true,
         module = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
     @Property(
         key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY,
         name = "Exclude modules",
         description = "Maven artifact ids of modules to exclude (comma-separated).",
         project = true,
-        global = false),
+        global = false,
+        category = CoreProperties.CATEGORY_GENERAL),
     @Property(
         key = CoreProperties.CORE_RULE_WEIGHTS_PROPERTY,
         defaultValue = CoreProperties.CORE_RULE_WEIGHTS_DEFAULT_VALUE,
         name = "Rules weight",
         description = "A weight is associated to each priority to calculate the Rules Compliance Index.",
         project = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_GENERAL),
     @Property(
         key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY,
         defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE,
         name = "Force user authentication",
         description = "Forcing user authentication stops un-logged users to access Sonar.",
         project = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY),
     @Property(
         key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY,
         defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE,
         name = "Allow users to sign up online",
         description = "Users can sign up online.",
         project = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY),
     @Property(
         key = CoreProperties.CORE_DEFAULT_GROUP,
         defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE,
         name = "Default user group",
         description = "Any new users will automatically join this group.",
         project = false,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY),
     @Property(
         key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY,
         defaultValue = "en",
         name = "Locale used for violation messages",
         description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property",
         project = true,
-        global = true),
+        global = true,
+        category = CoreProperties.CATEGORY_L10N),
     @Property(
         key = "sonar.timemachine.period1",
         name = "Period 1",
@@ -136,21 +148,24 @@ import java.util.List;
             "compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
         project = false,
         global = true,
-        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1),
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
     @Property(
         key = "sonar.timemachine.period2",
         name = "Period 2",
         description = "See the property 'Period 1'",
         project = false,
         global = true,
-        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2),
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
     @Property(
         key = "sonar.timemachine.period3",
         name = "Period 3",
         description = "See the property 'Period 1'",
         project = false,
         global = true,
-        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3),
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
     @Property(
         key = "sonar.timemachine.period4",
         name = "Period 4",
@@ -159,14 +174,16 @@ import java.util.List;
             "for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li><li>A version, for example 1.2</li></ul>",
         project = true,
         global = false,
-        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4),
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
     @Property(
         key = "sonar.timemachine.period5",
         name = "Period 5",
         description = "See the property 'Period 4'",
         project = true,
         global = false,
-        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5)
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS)
 })
 public class CorePlugin extends SonarPlugin {
 
index a53bdf72f703e6a04df78bf7802785ee5b6fbfea..ac392718a4f1725087e6db1284458dac0c732ad9 100644 (file)
@@ -19,7 +19,8 @@
  */
 package org.sonar.plugins.design;
 
-import org.sonar.api.*;
+import com.google.common.collect.Lists;
+import org.sonar.api.SonarPlugin;
 import org.sonar.plugins.design.batch.*;
 import org.sonar.plugins.design.ui.dependencies.GwtDependenciesTab;
 import org.sonar.plugins.design.ui.lcom4.GwtLcom4Tab;
@@ -29,21 +30,12 @@ import org.sonar.plugins.design.ui.widgets.ChidamberKemererWidget;
 import org.sonar.plugins.design.ui.widgets.FileDesignWidget;
 import org.sonar.plugins.design.ui.widgets.PackageDesignWidget;
 
-import java.util.ArrayList;
 import java.util.List;
 
-@Properties({
-    @Property(
-        key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY,
-        defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE,
-        name = "Skip design analysis",
-        project = true,
-        global = true)
-})
 public class DesignPlugin extends SonarPlugin {
 
-  public List<Class<? extends Extension>> getExtensions() {
-    List<Class<? extends Extension>> extensions = new ArrayList<Class<? extends Extension>>();
+  public List getExtensions() {
+    List extensions = Lists.newArrayList();
 
     // Batch
     extensions.add(MavenDependenciesSensor.class);
index e4880af457bc7c7d81558de427266628c0a58603..9f98474b8e27c1f85af7d42f3419e29f99878734 100644 (file)
@@ -420,8 +420,12 @@ dashboard.update_dashboard=Update dashboard
 #
 #------------------------------------------------------------------------------
 settings.save_category=Save {0} settings
-property.category.General=General
-
+property.category.general=General
+property.category.security=Security
+property.category.java=Java
+property.category.differentialViews=Differential Views
+property.category.codeCoverage=Code Coverage
+property.category.localization=Localization
 
 
 #------------------------------------------------------------------------------
index cd7fb31c5a301b0f37340b1f7d9a8818c8f3489d..ab79465888c6197aad5cc17aaf1ad0ad2687e3ea 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.plugins.squid;
 
+import org.sonar.api.CoreProperties;
 import org.sonar.api.Properties;
 import org.sonar.api.Property;
 import org.sonar.api.SonarPlugin;
@@ -34,7 +35,9 @@ import java.util.List;
         name = "Separate accessors",
         description = "Flag whether Squid should separate accessors (getters/setters) from methods. " +
             "In that case, accessors are not counted in metrics such as complexity or API documentation.",
-        project = true, global = true),
+        project = true,
+        global = true,
+        category = CoreProperties.CATEGORY_JAVA),
     @Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION,
         defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE,
         name = "List of fields to exclude from LCOM4 computation",
@@ -42,8 +45,18 @@ import java.util.List;
             "unexpectedly and artificially decrease the LCOM4 measure. "
             + "The best example is a logger used by all methods of a class. " +
             "All field names to exclude from LCOM4 computation must be separated by a comma.",
-        project = true, global = true)})
-public class SquidPlugin extends SonarPlugin {
+        project = true,
+        global = true,
+        category = CoreProperties.CATEGORY_JAVA),
+    @Property(
+        key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY,
+        defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE,
+        name = "Skip design analysis",
+        project = true,
+        global = true,
+        category = CoreProperties.CATEGORY_JAVA)
+})
+public final class SquidPlugin extends SonarPlugin {
 
   public List getExtensions() {
     return Arrays.asList(SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class,
index 0fc4a6c2d751b24e4b69cfcd55aa98b0df09847d..4cc9213044b4255233259dbe9bf4999c86767504 100644 (file)
@@ -29,6 +29,37 @@ import org.sonar.api.resources.ProjectFileSystem;
  */
 public interface CoreProperties {
 
+  /**
+   * @since 2.11
+   */
+  String CATEGORY_GENERAL = "general";
+
+  /**
+   * @since 2.11
+   */
+  String CATEGORY_CODE_COVERAGE = "codeCoverage";
+
+  /**
+   * @since 2.11
+   */
+  String CATEGORY_SECURITY = "security";
+
+  /**
+   * @since 2.11
+   */
+  String CATEGORY_L10N = "localization";
+
+  /**
+   * @since 2.11
+   */
+  String CATEGORY_JAVA = "java";
+
+  /**
+   * @since 2.11
+   */
+  String CATEGORY_DIFFERENTIAL_VIEWS = "differentialViews";
+
+
   /* Global settings */
   String SONAR_HOME = "sonar.home";
   String PROJECT_BRANCH_PROPERTY = "sonar.branch";
index d5c5bceae455338916af0895549859b4bf6d7792..1ad83db45184ba417d7e272e3c57924c27c486f2 100644 (file)
@@ -72,7 +72,7 @@ class ProjectController < ApplicationController
       redirect_to :action => 'index', :id => params[:id]
     end
 
-    @category=params[:category] ||= 'General'
+    @category=params[:category] ||= 'general'
     @properties_per_category={}
     java_facade.getPluginsMetadata().each do |plugin|
       properties=java_facade.getPluginProperties(plugin).select { |property|
index 487456bd8e9586ffd43ab950526909e73597b905..50085bb62897f5b5ea7a3a3124ae4c4750d9f0b0 100644 (file)
@@ -26,7 +26,7 @@ class SettingsController < ApplicationController
   def index
     return access_denied unless is_admin?
     load_properties(false)
-    @category ||= 'General'
+    @category ||= 'general'
   end
 
   def update