private InputPath inputPathFromIOFile(File file) { if (file.isDirectory()) { return fs.inputDir(file); } else { return inputFromIOFile(file); } }
private Charset getCharset(File file) { return inputFromIOFile(file).charset(); }
private InputPath inputPathFromIOFile(File file) { if (file.isDirectory()) { return fs.inputDir(file); } else { return inputFromIOFile(file); } }
public FileLinesContext fileLinesContextFor(File file) { return fileLinesContextFactory.createFor(inputFromIOFile(file)); }
private InputStream getInputStream(File file) throws IOException { return inputFromIOFile(file).inputStream(); }
public FileLinesContext fileLinesContextFor(File file) { return fileLinesContextFactory.createFor(inputFromIOFile(file)); }
public Symbolizable symbolizableFor(File file) { return resourcePerspectives.as(Symbolizable.class, inputFromIOFile(file)); }
public FileLinesContext fileLinesContextFor(File file) { return fileLinesContextFactory.createFor(inputFromIOFile(file)); }
private InputPath inputPathFromIOFile(File file) { if (file.isDirectory()) { return fs.inputDir(file); } else { return inputFromIOFile(file); } }
private InputStream getInputStream(File file) throws IOException { return inputFromIOFile(file).inputStream(); }
public int fileLength(File file) { return inputFromIOFile(file).lines(); }
public NewHighlighting highlightableFor(File file) { Preconditions.checkNotNull(context); return context.newHighlighting().onFile(inputFromIOFile(file)); }
public NewHighlighting highlightableFor(File file) { Preconditions.checkNotNull(context); return context.newHighlighting().onFile(inputFromIOFile(file)); }
public String fileContent(File file) { try { return inputFromIOFile(file).contents(); } catch (IOException e) { throw new AnalysisException("Unable to read file "+file, e); } }
public String fileContent(File file) { try { return inputFromIOFile(file).contents(); } catch (IOException e) { throw new AnalysisException("Unable to read file "+file, e); } }
public NewSymbolTable symbolizableFor(File file) { return context.newSymbolTable().onFile(inputFromIOFile(file)); }
public NewSymbolTable symbolizableFor(File file) { return context.newSymbolTable().onFile(inputFromIOFile(file)); }
public void reportAnalysisError(File file, String message) { context.newAnalysisError() .onFile(inputFromIOFile(file)) .message(message) .save(); }
public void reportAnalysisError(File file, String message) { context.newAnalysisError() .onFile(inputFromIOFile(file)) .message(message) .save(); }
@VisibleForTesting void reportIssue(AnalyzerMessage analyzerMessage, RuleKey key, InputPath inputPath, Double cost) { Preconditions.checkNotNull(context); JavaIssue issue = JavaIssue.create(context, key, cost); AnalyzerMessage.TextSpan textSpan = analyzerMessage.primaryLocation(); if (textSpan == null) { // either an issue at file or folder level issue.setPrimaryLocationOnFile(inputPath, analyzerMessage.getMessage()); } else { if (!textSpan.onLine()) { Preconditions.checkState(!textSpan.isEmpty(), "Issue location should not be empty"); } issue.setPrimaryLocation((InputFile) inputPath, analyzerMessage.getMessage(), textSpan.startLine, textSpan.startCharacter, textSpan.endLine, textSpan.endCharacter); } issue.addFlow(inputFromIOFile(analyzerMessage.getFile()), analyzerMessage.flows).save(); }