Tuesday, November 24, 2020

Create Sonar Plugin - Constant string values used in development

 There are few String constants used in Sonar Plugin creation. It's always better to have all these in a one single place.

------------------------------------------------------------------------------------------------------------------

package com.plugin.sonar.util;

public final class FooConstants {

private FooConstants() {
}

public static final String LANGUAGE_KEY = "foo";
public static final String LANGUAGE_NAME = "Foo";

public static final String FILE_SUFFIXES_KEY = "sonar.lang.patterns.foo";
public static final String FILE_SUFFIXES_DEFAULT_VALUE = ".foo,.txt,.sql";

public static final String FooSQL_QUALITY_PROFILE_NAME = "Foo Quality Profile";
public static final String JSON_PROFILE_PATH = "foo_quality_profile.json";

public static final String PATH_TO_RULES_XML = "/foo-sonar-rules.xml";

public static final String RULES_KEY = "foo";
public static final String REPO_KEY = LANGUAGE_KEY + "-" + RULES_KEY;
public static final String RULES_NAME = "Foo";
public static final String REPO_NAME = LANGUAGE_KEY + "-" + RULES_NAME;
/**
* {@code Extractor} related constant values
*/
public static final String FooSQL_JAR = "/foo-rule-engine.jar";
public static final String LOGIN_CONFIGURATION = "/log4j.conf";
public static final String INIT_PROPERTIES = "/init.properties";
public static final String FooSQL_SONAR_RULES = "/foo-sonar-rules.xml";
public static final String RULE_ENGINE_PROPERTIES = "/fooruleengine.properties";
public static final String RULES = "/Rules.xml";

/**
* {@code PlsqlScanner} related constant values
*/
public static final String VIOLATION_REPORT_NAME = "violationReport.xml";
public static final String EXECUTABLE = "foo-rule-engine.jar";
public static final String FooSQL_INIT_PROPERTY_FILE = "init.properties";
public static final String AST_FOLDER = "ast\\";

/**
* Sonar Scanner parameters.
*/
public static final String SONAR_SOURCES = "sonar.sources";
public static final String SONAR_CONFIG = "configDir";
}

No comments:

Post a Comment