Tabnine Logo
SqaleXmlLoader.load
Code IndexAdd Tabnine to your IDE (free)

How to use
load
method
in
org.sonar.squidbridge.rules.SqaleXmlLoader

Best Java code snippets using org.sonar.squidbridge.rules.SqaleXmlLoader.load (Showing top 9 results out of 315)

origin: Backelite/sonar-swift

@Override
public void define(Context context) {
  NewRepository repository = context.createRepository(REPOSITORY_KEY, ObjectiveC.KEY).setName(REPOSITORY_NAME);
  try(BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(RULES_FILE), Charset.forName("UTF-8")))){
    List<String> lines = reader.lines().collect(Collectors.toList());
    addRules(repository,lines);
  } catch (IOException e) {
    LOGGER.error("Failed to load OCLint rules", e);
  }
  SqaleXmlLoader.load(repository, "/com/sonar/sqale/oclint-model.xml");
  repository.done();
}
origin: mrprince/sonar-p3c-pmd

 static void extractRulesData(NewRepository repository, String xmlRulesFilePath, String htmlDescriptionFolder) {
  RulesDefinitionXmlLoader ruleLoader = new RulesDefinitionXmlLoader();
  ruleLoader.load(repository, PmdRulesDefinition.class.getResourceAsStream(xmlRulesFilePath), "UTF-8");
  ExternalDescriptionLoader.loadHtmlDescriptions(repository, htmlDescriptionFolder);
  PropertyFileLoader.loadNames(repository, PmdRulesDefinition.class.getResourceAsStream("/org/sonar/l10n/pmd.properties"));
  SqaleXmlLoader.load(repository, "/com/sonar/sqale/pmd-model.xml");
 }
}
origin: checkstyle/sonar-checkstyle

@VisibleForTesting
static void extractRulesData(NewRepository repository, String xmlRulesFilePath,
    String htmlDescriptionFolder) throws IOException {
  final RulesDefinitionXmlLoader ruleLoader = new RulesDefinitionXmlLoader();
  try (InputStream resource = CheckstyleRulesDefinition.class
      .getResourceAsStream(xmlRulesFilePath)) {
    ruleLoader.load(repository, resource, "UTF-8");
  }
  ExternalDescriptionLoader.loadHtmlDescriptions(repository, htmlDescriptionFolder);
  try (InputStream resource = CheckstyleRulesDefinition.class
      .getResourceAsStream("/org/sonar/l10n/checkstyle.properties")) {
    loadNames(repository, resource);
  }
  SqaleXmlLoader.load(repository, "/com/sonar/sqale/checkstyle-model.xml");
}
origin: Backelite/sonar-swift

  @Override
  public void define(Context context) {
    NewRepository repository = context.createRepository(REPOSITORY_KEY, Swift.KEY).setName(REPOSITORY_NAME);

    try(Reader reader = new InputStreamReader(getClass().getResourceAsStream(RULES_FILE), Charset.forName("UTF-8"))){
      JSONArray slRules = (JSONArray)JSONValue.parse(reader);
      if(slRules != null){
        for (Object obj : slRules) {
          JSONObject slRule = (JSONObject) obj;
          repository.createRule((String) slRule.get("key"))
            .setName((String) slRule.get("name"))
            .setSeverity((String) slRule.get("severity"))
            .setHtmlDescription((String) slRule.get("description"));
        }
      }
    } catch (IOException e) {
      LOGGER.error("Failed to load SwiftLint rules", e);
    }
    SqaleXmlLoader.load(repository, "/com/sonar/sqale/swiftlint-model.xml");
    repository.done();
  }
}
origin: Backelite/sonar-swift

  @Override
  public void define(final Context context) {
    NewRepository repository = context.createRepository(REPOSITORY_KEY, Swift.KEY).setName(REPOSITORY_NAME);

    try(Reader reader = new InputStreamReader(getClass().getResourceAsStream(RULES_FILE), Charset.forName("UTF-8"))){
      JSONArray slRules = (JSONArray)JSONValue.parse(reader);
      if(slRules != null){
        for (Object obj : slRules) {
          JSONObject slRule = (JSONObject) obj;
          repository.createRule((String) slRule.get("key"))
            .setName((String) slRule.get("name"))
            .setSeverity((String) slRule.get("severity"))
            .setHtmlDescription(slRule.get("description") +
              " (<a href=" + slRule.get("styleguide") + ">" + slRule.get("styleguide") + "</a>)");
        }
      }
    } catch (IOException e) {
      LOGGER.error("Failed to load tailor rules", e);
    }
    SqaleXmlLoader.load(repository, "/com/sonar/sqale/tailor-model.xml");
    repository.done();
  }
}
origin: Backelite/sonar-swift

  @Override
  public void define(final Context context) {
    NewRepository repository = context.createRepository(REPOSITORY_KEY, ObjectiveC.KEY).setName(REPOSITORY_NAME);

    try(Reader reader = new InputStreamReader(getClass().getResourceAsStream(RULES_FILE), Charset.forName("UTF-8"))){
      JSONArray slRules = (JSONArray)JSONValue.parse(reader);
      if(slRules != null){
        for (Object obj : slRules) {
          JSONObject slRule = (JSONObject) obj;
          repository.createRule((String) slRule.get("key"))
            .setName((String) slRule.get("name"))
            .setSeverity((String) slRule.get("severity"))
            .setHtmlDescription((String) slRule.get("description"));
        }
      }
    } catch (IOException e) {
      LOGGER.error("Failed to load FauxPas rules", e);
    }
    SqaleXmlLoader.load(repository, "/com/sonar/sqale/fauxpas-model.xml");
    repository.done();
  }
}
origin: spotbugs/sonar-findbugs

 @Override
 public void define(Context context) {
  NewRepository repository = context
   .createRepository(REPOSITORY_KEY, Java.KEY)
   .setName(REPOSITORY_NAME);


  RulesDefinitionXmlLoader ruleLoaderJsp = new RulesDefinitionXmlLoader();
  ruleLoaderJsp.load(repository, FindSecurityBugsRulesDefinition.class.getResourceAsStream("/org/sonar/plugins/findbugs/rules-findbugs.xml"), "UTF-8");
  SqaleXmlLoader.load(repository, "/com/sonar/sqale/findbugs-model.xml");
  repository.done();

//    RulesDefinitionXmlLoader ruleLoader = new RulesDefinitionXmlLoader();
//    ruleLoader.load(repository, FindbugsRulesDefinition.class.getResourceAsStream("/org/sonar/plugins/findbugs/rules.xml"), "UTF-8");
//    ExternalDescriptionLoader.loadHtmlDescriptions(repository, "/org/sonar/l10n/findbugs/rules/findbugs");
//    SqaleXmlLoader.load(repository, "/com/sonar/sqale/findbugs-model.xml");
//    repository.done();
 }

origin: jensgerdes/sonar-pmd

static void extractRulesData(NewRepository repository, String xmlRulesFilePath, String htmlDescriptionFolder) {
  try (InputStream inputStream = PmdRulesDefinition.class.getResourceAsStream(xmlRulesFilePath)) {
    new RulesDefinitionXmlLoader()
        .load(
            repository,
            inputStream,
            StandardCharsets.UTF_8
        );
  } catch (IOException e) {
    LOGGER.error("Failed to load PMD RuleSet.", e);
  }
  ExternalDescriptionLoader.loadHtmlDescriptions(repository, htmlDescriptionFolder);
  loadNames(repository);
  SqaleXmlLoader.load(repository, "/com/sonar/sqale/pmd-model.xml");
}
origin: fabriciocolombo/sonar-delphi

@Override
public void define(Context context) {
 NewRepository repository = context
  .createRepository(DelphiPmdConstants.REPOSITORY_KEY, DelphiLanguage.KEY)
  .setName(DelphiPmdConstants.REPOSITORY_NAME);
 List<org.sonar.api.rules.Rule> rules = DelphiRulesUtils.getInitialReferential();
 // TODO Review
 // https://github.com/SonarCommunity/sonar-pmd/blob/master/src/main/java/org/sonar/plugins/pmd/PmdRulesDefinition.java
 for (org.sonar.api.rules.Rule rule : rules) {
  NewRule newRule = repository.createRule(rule.getKey())
   .setName(rule.getName())
   .setHtmlDescription(rule.getDescription())
   .setInternalKey(rule.getConfigKey())
   .setSeverity(rule.getSeverity().name());
  for (RuleParam param : rule.getParams()) {
   newRule.createParam(param.getKey())
    .setDefaultValue(param.getDefaultValue())
    .setType(RuleParamType.parse(param.getType()))
    .setDescription(param.getDescription());
  }
 }
 SqaleXmlLoader.load(repository, "/org/sonar/plugins/delphi/sqale/delphi-model.xml");
 repository.done();
}
org.sonar.squidbridge.rulesSqaleXmlLoaderload

Popular methods of SqaleXmlLoader

  • <init>
  • childrenMap
  • loadXmlResource
  • processRoot
  • processRule
  • processSubChar
  • reader
  • remediationFunction
  • timeValue

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JLabel (javax.swing)
  • JTextField (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now