public Context(LintClient client, Project project, File file, EnumSet<Scope> scope) { this.client = client; this.project = project; this.file = file; this.scope = scope; this.configuration = project.getConfiguration(); }
private void computeDetectors(Project project) { // Ensure that the current visitor is recomputed mCurrentFolderType = null; mCurrentVisitor = null; Configuration configuration = project.getConfiguration(); mScopeDetectors = new HashMap<Scope, List<Detector>>(); mApplicableDetectors = mRegistry.createDetectors(mClient, configuration, mScope, mScopeDetectors); validateScopeList(); }
private void computeDetectors(@NonNull Project project) { // Ensure that the current visitor is recomputed currentFolderType = null; currentVisitor = null; Configuration configuration = project.getConfiguration(this); scopeDetectors = new EnumMap<>(Scope.class); applicableDetectors = registry.createDetectors(client, configuration, scope, scopeDetectors); validateScopeList(); }
Configuration configuration = project.getConfiguration(this); for (Detector detector : detectors) { Class<? extends Detector> detectorClass = detector.getClass();
if (!project.getConfiguration(null).isEnabled(issue)) { map.put(issue, "Project lint.xml file"); break;
if (!project.getConfiguration(null).isEnabled(issue)) { map.put(issue, "Project lint.xml file"); break;
private void formatError(String message, Object... args) { if (args != null && args.length > 0) { message = String.format(message, args); } message = "Failed to parse `lint.xml` configuration file: " + message; LintDriver driver = new LintDriver(new IssueRegistry() { @Override @NonNull public List<Issue> getIssues() { return Collections.emptyList(); } }, client); client.report(new Context(driver, project, project, configFile), IssueRegistry.LINT_ERROR, project.getConfiguration(driver).getSeverity(IssueRegistry.LINT_ERROR), Location.create(configFile), message, TextFormat.RAW); }
/** * Construct a new {@link Context} * * @param driver the driver running through the checks * @param project the project containing the file being checked * @param main the main project if this project is a library project, or * null if this is not a library project. The main project is * the root project of all library projects, not necessarily the * directly including project. * @param file the file being checked */ public Context( @NonNull LintDriver driver, @NonNull Project project, @Nullable Project main, @NonNull File file) { this.file = file; this.driver = driver; this.project = project; mainProject = main; configuration = project.getConfiguration(driver); }
protected void reportNonExistingIssueId(@Nullable Project project, @NonNull String id) { String message = String.format("Unknown issue id \"%1$s\"", id); if (driver != null && project != null) { Location location = Location.create(project.getDir()); if (!isSuppressed(IssueRegistry.LINT_ERROR)) { report(new Context(driver, project, project, project.getDir()), IssueRegistry.LINT_ERROR, project.getConfiguration(driver).getSeverity(IssueRegistry.LINT_ERROR), location, message, TextFormat.RAW); } } else { log(Severity.ERROR, null, "Lint: %1$s", message); } }
client.report(new Context(this, project, main, project.getDir()), IssueRegistry.LINT_ERROR, project.getConfiguration(this).getSeverity(IssueRegistry.LINT_ERROR), location, message, TextFormat.RAW); classEntries = Collections.emptyList();
@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; }
configuration = project.getConfiguration(driver);