@Override public boolean isIgnored(Context context, Issue issue, Location location, String message, Object data) { ensureInitialized(); String id = issue.getId(); List<String> paths = mSuppressed.get(id); if (paths != null && location != null) { File file = location.getFile(); String relativePath = context.project.getRelativePath(file); for (String suppressedPath : paths) { if (suppressedPath.equals(relativePath)) { return true; } } } if (mParent != null) { return mParent.isIgnored(context, issue, location, message, data); } return false; }
return parent != null && parent.isIgnored(context, issue, location, message);
@Override public void report(Context context, Issue issue, Location location, String message, Object data) { Configuration configuration = context.configuration; if (!configuration.isEnabled(issue)) { if (issue != IssueRegistry.PARSER_ERROR) { mDelegate.log(null, "Incorrect detector reported disabled issue %1$s", issue.toString()); } return; } if (configuration.isIgnored(context, issue, location, message, data)) { return; } Severity severity = configuration.getSeverity(issue); if (severity == Severity.IGNORE) { return; } mDelegate.report(context, issue, location, message, data); }
@NonNull @Override protected Project createProject(@NonNull File dir, @NonNull File referenceDir) { Project project = super.createProject(dir, referenceDir); if (project.isGradleProject()) { @SuppressWarnings("SpellCheckingInspection") String message = String.format("\"`%1$s`\" is a Gradle project. To correctly " + "analyze Gradle projects, you should run \"`gradlew :lint`\" instead.", project.getName()); Location location = Location.create(project.getDir()); Context context = new Context(driver, project, project, project.getDir()); if (context.isEnabled(IssueRegistry.LINT_ERROR) && !getConfiguration(project, null).isIgnored(context, IssueRegistry.LINT_ERROR, location, message)) { report(context, IssueRegistry.LINT_ERROR, project.getConfiguration(null).getSeverity( IssueRegistry.LINT_ERROR), location, message, TextFormat.RAW); } } return project; }
if (configuration.isIgnored(context, issue, location, message)) { return;