@Test public void should_not_raise_any_issue_because_the_parsing_error_rule_is_not_activated() { String relativePath = "parsing-error.feature"; inputFile(relativePath, Charsets.UTF_8); ActiveRules activeRules = new ActiveRulesBuilder().build(); checkFactory = new CheckFactory(activeRules); context.setActiveRules(activeRules); createGherkinSquidSensor().execute(context); Collection<Issue> issues = context.allIssues(); assertThat(issues).hasSize(0); }
@Override public void execute(SensorContext sensorContext) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); treeVisitors.addAll(checks.visitorChecks()); treeVisitors.add(new SyntaxHighlighterVisitor(sensorContext)); treeVisitors.add(new MetricsVisitor(sensorContext)); setParsingErrorCheckIfActivated(treeVisitors); ProgressReport progressReport = new ProgressReport("Report about progress of Cucumber Gherkin analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); issueSaver = new IssueSaver(sensorContext, checks); List<Issue> issues = new ArrayList<>(); boolean success = false; try { for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { issues.addAll(analyzeFile(sensorContext, inputFile, treeVisitors)); progressReport.nextFile(); } saveSingleFileIssues(issues); saveCrossFileIssues(); success = true; } finally { stopProgressReport(progressReport, success); } }
GherkinSquidSensor implements Sensor { @Override public void execute(SensorContext sensorContext) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); treeVisitors.addAll(checks.visitorChecks()); treeVisitors.add(new SyntaxHighlighterVisitor(sensorContext)); treeVisitors.add(new MetricsVisitor(sensorContext)); setParsingErrorCheckIfActivated(treeVisitors); ProgressReport progressReport = new ProgressReport("Report about progress of Cucumber Gherkin analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); issueSaver = new IssueSaver(sensorContext, checks); List<Issue> issues = new ArrayList<>(); boolean success = false; try { for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { issues.addAll(analyzeFile(sensorContext, inputFile, treeVisitors)); progressReport.nextFile(); } saveSingleFileIssues(issues); saveCrossFileIssues(); success = true; } finally { stopProgressReport(progressReport, success); } } }
GherkinSquidSensor implements Sensor { @Override public void execute(SensorContext sensorContext) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); treeVisitors.addAll(checks.visitorChecks()); treeVisitors.add(new SyntaxHighlighterVisitor(sensorContext)); treeVisitors.add(new MetricsVisitor(sensorContext)); setParsingErrorCheckIfActivated(treeVisitors); ProgressReport progressReport = new ProgressReport("Report about progress of Cucumber Gherkin analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); issueSaver = new IssueSaver(sensorContext, checks); List<Issue> issues = new ArrayList<>(); boolean success = false; try { for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { issues.addAll(analyzeFile(sensorContext, inputFile, treeVisitors)); progressReport.nextFile(); } saveSingleFileIssues(issues); saveCrossFileIssues(); success = true; } finally { stopProgressReport(progressReport, success); } } GherkinSquidSensor(FileSystem fileSystem, CheckFactory checkFactory);  GherkinSquidSensor(FileSystem fileSystem, CheckFactory checkFactory, @Nullable CustomGherkinRulesDefinition[] customRulesDefinition); }
GherkinSquidSensor implements Sensor { @Override public void execute(SensorContext sensorContext) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); treeVisitors.addAll(checks.visitorChecks()); treeVisitors.add(new SyntaxHighlighterVisitor(sensorContext)); treeVisitors.add(new MetricsVisitor(sensorContext)); setParsingErrorCheckIfActivated(treeVisitors); ProgressReport progressReport = new ProgressReport("Report about progress of Cucumber Gherkin analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); issueSaver = new IssueSaver(sensorContext, checks); List<Issue> issues = new ArrayList<>(); boolean success = false; try { for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { issues.addAll(analyzeFile(sensorContext, inputFile, treeVisitors)); progressReport.nextFile(); } saveSingleFileIssues(issues); saveCrossFileIssues(); success = true; } finally { stopProgressReport(progressReport, success); } } GherkinSquidSensor(FileSystem fileSystem, CheckFactory checkFactory);  GherkinSquidSensor(FileSystem fileSystem, CheckFactory checkFactory, @Nullable CustomGherkinRulesDefinition[] customRulesDefinition); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext sensorContext); }
GherkinSquidSensor implements Sensor { @Override public void execute(SensorContext sensorContext) { List<TreeVisitor> treeVisitors = Lists.newArrayList(); treeVisitors.addAll(checks.visitorChecks()); treeVisitors.add(new SyntaxHighlighterVisitor(sensorContext)); treeVisitors.add(new MetricsVisitor(sensorContext)); setParsingErrorCheckIfActivated(treeVisitors); ProgressReport progressReport = new ProgressReport("Report about progress of Cucumber Gherkin analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(Lists.newArrayList(fileSystem.files(mainFilePredicate))); issueSaver = new IssueSaver(sensorContext, checks); List<Issue> issues = new ArrayList<>(); boolean success = false; try { for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { issues.addAll(analyzeFile(sensorContext, inputFile, treeVisitors)); progressReport.nextFile(); } saveSingleFileIssues(issues); saveCrossFileIssues(); success = true; } finally { stopProgressReport(progressReport, success); } } GherkinSquidSensor(FileSystem fileSystem, CheckFactory checkFactory);  GherkinSquidSensor(FileSystem fileSystem, CheckFactory checkFactory, @Nullable CustomGherkinRulesDefinition[] customRulesDefinition); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext sensorContext);  }