@Test public void parse_error() { inputFile("parse-error.yaml"); activeRules = (new ActiveRulesBuilder()) .create(RuleKey.of(CheckList.REPOSITORY_KEY, ParsingErrorCheck.CHECK_KEY)) .activate() .build(); sensor().execute(context); assertThat(context.allIssues()).hasSize(2); assertThat(context.allAnalysisErrors()) .extracting(e -> e.inputFile().filename(), e -> e.location().line(), e -> e.location().lineOffset(), AnalysisError::message) .containsExactlyInAnyOrder( tuple("parse-error.yaml", 3, 2, "Missing required properties: [version]"), tuple("parse-error.yaml", 7, 6, "Missing required properties: [responses]") ); }
@Override public void execute(SensorContext context) { FilePredicates p = context.fileSystem().predicates(); OpenApiProperties openApiProperties = new OpenApiProperties(); scanFiles(context, p, openApiProperties.getV2FilesPattern(context), true); scanFiles(context, p, openApiProperties.getV3FilesPattern(context), false); }
OpenApiScannerSensor implements Sensor { @Override public void execute(SensorContext context) { FilePredicates p = context.fileSystem().predicates(); OpenApiProperties openApiProperties = new OpenApiProperties(); scanFiles(context, p, openApiProperties.getV2FilesPattern(context), true); scanFiles(context, p, openApiProperties.getV3FilesPattern(context), false); } }
OpenApiScannerSensor implements Sensor { @Override public void execute(SensorContext context) { FilePredicates p = context.fileSystem().predicates(); OpenApiProperties openApiProperties = new OpenApiProperties(); scanFiles(context, p, openApiProperties.getV2FilesPattern(context), true); scanFiles(context, p, openApiProperties.getV3FilesPattern(context), false); } OpenApiScannerSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter);  OpenApiScannerSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter, @Nullable OpenApiCustomRuleRepository[] customRuleRepositories); }
OpenApiScannerSensor implements Sensor { @Override public void execute(SensorContext context) { FilePredicates p = context.fileSystem().predicates(); OpenApiProperties openApiProperties = new OpenApiProperties(); scanFiles(context, p, openApiProperties.getV2FilesPattern(context), true); scanFiles(context, p, openApiProperties.getV3FilesPattern(context), false); } OpenApiScannerSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter);  OpenApiScannerSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter, @Nullable OpenApiCustomRuleRepository[] customRuleRepositories); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); void scanFiles(SensorContext context, FilePredicates p, String[] pathPatterns, boolean isV2); }
OpenApiScannerSensor implements Sensor { @Override public void execute(SensorContext context) { FilePredicates p = context.fileSystem().predicates(); OpenApiProperties openApiProperties = new OpenApiProperties(); scanFiles(context, p, openApiProperties.getV2FilesPattern(context), true); scanFiles(context, p, openApiProperties.getV3FilesPattern(context), false); } OpenApiScannerSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter);  OpenApiScannerSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory, NoSonarFilter noSonarFilter, @Nullable OpenApiCustomRuleRepository[] customRuleRepositories); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); void scanFiles(SensorContext context, FilePredicates p, String[] pathPatterns, boolean isV2);  }