class DartAnalyzerRulesDefinition implements RulesDefinition {

    @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();
    }

    public  DartAnalyzerRulesDefinition(SonarRuntime sonarRuntime);

}