private static Set<String> propertyKeys(List extensions) {
   ImmutableSet.Builder<String> builder = ImmutableSet.builder();
   for (Object extension : extensions) {
     if (extension instanceof PropertyDefinition) {
       PropertyDefinition property = (PropertyDefinition) extension;
       builder.add(property.key());
     }
   }
   return builder.build();
 }
Ejemplo n.º 2
0
 public static List<PropertyDefinition> getPropertyDefinitions() {
   return ImmutableList.of(
       PropertyDefinition.builder(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + 1)
           .name("Period 1")
           .description(
               "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before "
                   + "analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to "
                   + "compare to previous analysis</li><li>'previous_version' to compare to the previous version in the project history</li></ul>"
                   + "<p>When specifying a number of days or a date, the snapshot selected for comparison is "
                   + " the first one available inside the corresponding time range. </p>"
                   + "<p>Changing this property only takes effect after subsequent project inspections.<p/>")
           .defaultValue(CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1)
           .category(CoreProperties.CATEGORY_GENERAL)
           .subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
           .build(),
       PropertyDefinition.builder(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + 2)
           .name("Period 2")
           .description("See the property 'Period 1'")
           .defaultValue(CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2)
           .category(CoreProperties.CATEGORY_GENERAL)
           .subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
           .build(),
       PropertyDefinition.builder(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + 3)
           .name("Period 3")
           .description("See the property 'Period 1'")
           .defaultValue(CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3)
           .category(CoreProperties.CATEGORY_GENERAL)
           .subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
           .build(),
       PropertyDefinition.builder(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + 4)
           .name("Period 4")
           .description(
               "Period used to compare measures and track new violations. This property is specific to the project. Values are : "
                   + "<ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, "
                   + "for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li>"
                   + "<li>'previous_version' to compare to the previous version in the project history</li><li>A version, for example 1.2</li></ul>"
                   + "<p>When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range. </p>"
                   + "<p>Changing this property only takes effect after subsequent project inspections.<p/>")
           .defaultValue(CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4)
           .onlyOnQualifiers(Qualifiers.PROJECT)
           .category(CoreProperties.CATEGORY_GENERAL)
           .subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
           .build(),
       PropertyDefinition.builder(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + 5)
           .name("Period 5")
           .description("See the property 'Period 4'")
           .defaultValue(CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5)
           .onlyOnQualifiers(Qualifiers.PROJECT)
           .category(CoreProperties.CATEGORY_GENERAL)
           .subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
           .build());
 }
Ejemplo n.º 3
0
 @Override
 public void define(Context context) {
   ImmutableList.Builder<Object> builder = ImmutableList.builder();
   Version sonarQubeVersion = context.getSonarQubeVersion();
   if (!sonarQubeVersion.isGreaterThanOrEqual(SQ_6_0)
       || context.getRuntime().getProduct() != SonarProduct.SONARLINT) {
     builder.addAll(SurefireExtensions.getExtensions());
     builder.addAll(JaCoCoExtensions.getExtensions(sonarQubeVersion));
   }
   builder.addAll(JavaClasspathProperties.getProperties());
   builder.add(
       JavaClasspath.class,
       JavaTestClasspath.class,
       Java.class,
       PropertyDefinition.builder(Java.FILE_SUFFIXES_KEY)
           .defaultValue(Java.DEFAULT_FILE_SUFFIXES)
           .name("File suffixes")
           .description(
               "Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.")
           .subCategory("General")
           .onQualifiers(Qualifiers.PROJECT)
           .build(),
       JavaRulesDefinition.class,
       JavaSonarWayProfile.class,
       SonarComponents.class,
       DefaultJavaResourceLocator.class,
       JavaSquidSensor.class,
       PostAnalysisIssueFilter.class,
       XmlFileSensor.class);
   context.addExtensions(builder.build());
 }
 private static PropertyDefinition deprecatedPropertyDefinition(String oldKey) {
   return PropertyDefinition.builder(oldKey)
       .name(deprecatedName(oldKey))
       .description(DEPRECATED_DESCRIPTION)
       .category(CATEGORY)
       .subCategory(DEPRECATED_SUBCATEGORY)
       .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
       .build();
 }
Ejemplo n.º 5
0
 public static List<PropertyDefinition> definitions() {
   return ImmutableList.of(
       PropertyDefinition.builder(TechnicalDebtConverter.PROPERTY_HOURS_IN_DAY)
           .name("Number of working hours in a day")
           .type(PropertyType.INTEGER)
           .defaultValue("8")
           .category(CoreProperties.CATEGORY_TECHNICAL_DEBT)
           .deprecatedKey("sqale.hoursInDay")
           .build());
 }
Ejemplo n.º 6
0
 public List<?> getExtensions() {
   return ImmutableList.of(
       PropertyDefinition.builder(PmdConfiguration.PROPERTY_GENERATE_XML)
           .defaultValue("false")
           .name("Generate XML Report")
           .hidden()
           .build(),
       PmdSensor.class,
       PmdConfiguration.class,
       PmdExecutor.class,
       PmdRuleRepository.class,
       PmdUnitTestsRuleRepository.class,
       PmdProfileExporter.class,
       PmdProfileImporter.class,
       SonarWayProfile.class,
       SonarWayWithFindbugsProfile.class,
       PmdViolationToRuleViolation.class);
 }
 private static ImmutableList<PropertyDefinition> pluginProperties() {
   return ImmutableList.of(
       PropertyDefinition.builder(CS_REPORT_PATH_KEY)
           .name("ReSharper report path for C#")
           .description("Path to the ReSharper report for C#, i.e. reports/cs-report.xml")
           .category(CATEGORY)
           .onlyOnQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
           .build(),
       PropertyDefinition.builder(VBNET_REPORT_PATH_KEY)
           .name("ReSharper report path for VB.NET")
           .description("Path to the ReSharper report for VB.NET, i.e. reports/vbnet-report.xml")
           .category(CATEGORY)
           .onlyOnQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
           .build(),
       PropertyDefinition.builder(SOLUTION_FILE_PROPERTY_KEY)
           .name("Solution file")
           .description(
               "The absolute path to the solution or project file given as input to inspectcode.exe. Example: C:/Projects/MyProject/MySolution.sln.")
           .category(CATEGORY)
           .onlyOnQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
           .build(),
       PropertyDefinition.builder(PROJECT_NAME_PROPERTY_KEY)
           .name(deprecatedName("Visual Studio project name"))
           .description(deprecatedDescription("Example: MyLibrary."))
           .category(CATEGORY)
           .subCategory(DEPRECATED_SUBCATEGORY)
           .onlyOnQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
           .build(),
       PropertyDefinition.builder(INSPECTCODE_PATH_PROPERTY_KEY)
           .name(deprecatedName("Path to inspectcode.exe"))
           .description(
               deprecatedDescription("Example: C:/jetbrains-commandline-tools/inspectcode.exe."))
           .defaultValue("C:/jetbrains-commandline-tools/inspectcode.exe")
           .category(CATEGORY)
           .subCategory(DEPRECATED_SUBCATEGORY)
           .onQualifiers(Qualifiers.PROJECT)
           .deprecatedKey(OLD_INSTALL_DIRECTORY_KEY)
           .build(),
       PropertyDefinition.builder(TIMEOUT_MINUTES_PROPERTY_KEY)
           .name(deprecatedName("ReSharper execution timeout"))
           .description(
               deprecatedDescription(
                   "Time in minutes after which ReSharper's execution should be interrupted if not finished."))
           .defaultValue("60")
           .category(CATEGORY)
           .subCategory(DEPRECATED_SUBCATEGORY)
           .onQualifiers(Qualifiers.PROJECT)
           .type(PropertyType.INTEGER)
           .build(),
       deprecatedPropertyDefinition(OLD_INSTALL_DIRECTORY_KEY));
 }