test_class.file: dart-lang/src/test/java/fr/insideapp/sonarqube/dart/lang/issues/dartanalyzer/DartAnalyzerRulesDefinitionTest.java
test_class.identifier: DartAnalyzerRulesDefinitionTest
test_case.body: @Test
      public void define() {
  
          SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(7, 3), SonarQubeSide.SERVER);
          DartAnalyzerRulesDefinition rulesDefinition = new DartAnalyzerRulesDefinition(sonarRuntime);
          RulesDefinition.Context context = new RulesDefinition.Context();
          rulesDefinition.define(context);
  
          RulesDefinition.Repository dartAnalyzerRepository = context.repository("dartanalyzer");
          assertThat(dartAnalyzerRepository).isNotNull();
          assertThat(dartAnalyzerRepository.name()).isEqualTo("dartanalyzer");
          assertThat(dartAnalyzerRepository.language()).isEqualTo("dart");
          assertThat(dartAnalyzerRepository.rules()).isNotEmpty();
  
  
      }
test_case.class_method_signature: DartAnalyzerRulesDefinitionTest.define()
test_case.full_signature: @Test public void define()
test_case.identifier: define
test_case.invocations: forSonarQube create define repository isNotNull assertThat isEqualTo assertThat name isEqualTo assertThat language isNotEmpty assertThat rules
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void define()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(DartAnalyzerRulesDefinition.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(DartAnalyzerRulesDefinition.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: REPOSITORY_KEY = "dartanalyzer"
focal_class.modifier: public static final
focal_class.original_string: public static final String REPOSITORY_KEY = "dartanalyzer";
focal_class.type: String
focal_class.var_name: REPOSITORY_KEY
focal_class.declarator: REPOSITORY_NAME = REPOSITORY_KEY
focal_class.modifier: public static final
focal_class.original_string: public static final String REPOSITORY_NAME = REPOSITORY_KEY;
focal_class.type: String
focal_class.var_name: REPOSITORY_NAME
focal_class.declarator: RULES_FILE = "/fr/insideapp/sonarqube/dart/dartanalyzer/rules.json"
focal_class.modifier: public static final
focal_class.original_string: public static final String RULES_FILE = "/fr/insideapp/sonarqube/dart/dartanalyzer/rules.json";
focal_class.type: String
focal_class.var_name: RULES_FILE
focal_class.declarator: sonarRuntime
focal_class.modifier: private final
focal_class.original_string: private final SonarRuntime sonarRuntime;
focal_class.type: SonarRuntime
focal_class.var_name: sonarRuntime
focal_class.file: dart-lang/src/main/java/fr/insideapp/sonarqube/dart/lang/issues/dartanalyzer/DartAnalyzerRulesDefinition.java
focal_class.identifier: DartAnalyzerRulesDefinition
focal_class.interfaces: implements RulesDefinition
focal_class.class_method_signature: DartAnalyzerRulesDefinition.DartAnalyzerRulesDefinition(SonarRuntime sonarRuntime)
focal_class.full_signature: public  DartAnalyzerRulesDefinition(SonarRuntime sonarRuntime)
focal_class.identifier: DartAnalyzerRulesDefinition
focal_class.modifiers: public
focal_class.parameters: (SonarRuntime sonarRuntime)
focal_class.signature:  DartAnalyzerRulesDefinition(SonarRuntime sonarRuntime)
focal_class.class_method_signature: DartAnalyzerRulesDefinition.define(Context context)
focal_class.full_signature: @Override public void define(Context context)
focal_class.identifier: define
focal_class.modifiers: @Override public
focal_class.parameters: (Context context)
focal_class.return: void
focal_class.signature: void define(Context context)
focal_method.body: @Override
      public void define(Context context) {
          NewRepository repository = context.createRepository(REPOSITORY_KEY, Dart.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"))
                              .setType(RuleType.valueOf((String) slRule.get("type")))
                              .setHtmlDescription((String) slRule.get("description"));
                  }
              }
          } catch (IOException e) {
              LOGGER.error("Failed to load dartanalyzer rules", e);
          }
  
          SqaleXmlLoader.load(repository, "/fr/insideapp/sonarqube/dart/dartanalyzer/sqale-model.xml");
          repository.done();
      }
focal_method.class_method_signature: DartAnalyzerRulesDefinition.define(Context context)
focal_method.full_signature: @Override public void define(Context context)
focal_method.identifier: define
focal_method.invocations: setName createRepository getResourceAsStream getClass forName parse setHtmlDescription setType setSeverity setName createRule get get get valueOf get get error load done
focal_method.modifiers: @Override public
focal_method.parameters: (Context context)
focal_method.return: void
focal_method.signature: void define(Context context)