public ModuleInputComponentStore(InputModule module, InputComponentStore inputComponentStore, SensorStrategy strategy) { this.moduleKey = module.key(); this.inputComponentStore = inputComponentStore; this.strategy = strategy; }
@Override public boolean apply(InputFile f) { for (FilePredicate predicate : predicates) { if (predicate.apply(f)) { return true; } } return false; }
@Override public void execute(SensorContext context) { FileSystem fs = context.fileSystem(); FilePredicates p = fs.predicates(); for (InputFile file : fs.inputFiles(p.and(p.hasLanguages(Xoo.KEY), p.hasType(Type.MAIN)))) { createIssues(file, context); } }
@Override public void execute(SensorContext context) { context.fileSystem().inputFiles(context.fileSystem().predicates().all()).forEach(inputFile -> LOG.info("Deprecated Global Sensor: {}", inputFile.relativePath())); } }
private static ScannerReport.TextRange toProtobufTextRange(ScannerReport.TextRange.Builder textRangeBuilder, TextRange primaryTextRange) { textRangeBuilder.clear(); textRangeBuilder.setStartLine(primaryTextRange.start().line()); textRangeBuilder.setStartOffset(primaryTextRange.start().lineOffset()); textRangeBuilder.setEndLine(primaryTextRange.end().line()); textRangeBuilder.setEndOffset(primaryTextRange.end().lineOffset()); return textRangeBuilder.build(); }
@Override public DefaultSignificantCode addRange(TextRange range) { Preconditions.checkState(this.inputFile != null, "addRange() should be called after on()"); int line = range.start().line(); Preconditions.checkArgument(line == range.end().line(), "Ranges of significant code must be located in a single line"); Preconditions.checkState(!significantCodePerLine.containsKey(line), "Significant code was already reported for line '%s'. Can only report once per line.", line); significantCodePerLine.put(line, range); return this; }
@Override public boolean apply(InputFile f) { return type == f.type(); }
@Override public boolean apply(InputFile f) { return status == null || status == f.status(); }
@Override public String componentKey() { return component.key(); }
@Override public Iterable<InputFile> get(Index index) { return index.inputFiles(); }
@Override public Iterable<InputFile> get(FileSystem.Index index) { return index.getFilesByName(filename); }
@Override public Iterable<InputFile> get(FileSystem.Index index) { return index.getFilesByExtension(extension); }
@Override public void execute(SensorContext context) { FileSystem fs = context.fileSystem(); FilePredicates p = fs.predicates(); for (InputFile file : fs.inputFiles(p.and(p.hasLanguages(Xoo.KEY), p.hasType(Type.MAIN)))) { createIssues(file, context); } }
@Override public void execute(SensorContext context) { context.fileSystem().inputFiles(context.fileSystem().predicates().all()).forEach(inputFile -> LOG.info("Global Sensor: {}", inputFile.relativePath())); } }
@Override public boolean apply(InputFile f) { return !predicate.apply(f); }
private void analyse(SensorContext context, String language, String repo) { FileSystem fs = context.fileSystem(); FilePredicates p = fs.predicates(); for (InputFile file : fs.inputFiles(p.and(p.hasLanguages(language), p.hasType(Type.MAIN)))) { createIssues(file, context, repo); } }
@Override public boolean apply(InputFile inputFile) { return unoptimizedPredicate.apply(inputFile); }