private void checkPropertyFile(Project project, Project main, List<Detector> detectors, String relativePath) { File file = new File(project.getDir(), relativePath); if (file.exists()) { Context context = new Context(this, project, main, file); fireEvent(EventType.SCANNING_FILE, context); for (Detector detector : detectors) { detector.beforeCheckFile(context); detector.run(context); detector.afterCheckFile(context); } } }
allDetectors.add(v); List<String> applicableSuperClasses = detector.applicableSuperClasses(); if (applicableSuperClasses != null) { for (String fqn : applicableSuperClasses) { List<Class<? extends PsiElement>> nodePsiTypes = detector.getApplicablePsiTypes(); if (nodePsiTypes != null) { for (Class<? extends PsiElement> type : nodePsiTypes) { List<String> names = detector.getApplicableMethodNames(); if (names != null) { List<String> types = detector.getApplicableConstructorTypes(); if (types != null) { List<String> referenceNames = detector.getApplicableReferenceNames(); if (referenceNames != null) { if (detector.appliesToResourceRefs()) { resourceFieldDetectors.add(v); } else if ((applicableSuperClasses == null || applicableSuperClasses.isEmpty())
public void visitBinaryResource(@NonNull ResourceContext context) { if (binaryDetectors == null) { return; } for (Detector check : binaryDetectors) { check.beforeCheckFile(context); check.checkBinaryResource(context); check.afterCheckFile(context); } } }
private void checkBuildScripts(Project project, Project main) { List<Detector> detectors = scopeDetectors.get(Scope.GRADLE_FILE); if (detectors != null) { List<File> files = project.getSubset(); if (files == null) { files = project.getGradleBuildScripts(); } for (File file : files) { Context context = new Context(this, project, main, file); fireEvent(EventType.SCANNING_FILE, context); for (Detector detector : detectors) { detector.beforeCheckFile(context); detector.visitBuildScript(context, Maps.newHashMap()); detector.afterCheckFile(context); } } } }
check.beforeCheckFile(context); check.afterCheckFile(context);
context.location = new Location(file, null, null); for (Detector detector : detectors) { if (detector.appliesTo(context, file)) { detector.beforeCheckFile(context); detector.run(context); detector.afterCheckFile(context);
fireEvent(EventType.SCANNING_FILE, context); for (Detector check : dirChecks) { if (check.appliesTo(type)) { check.beforeCheckFile(context); check.checkFolder(context, folderName); check.afterCheckFile(context);
check.beforeCheckProject(projectContext); if (canceled) { return; check.beforeCheckLibraryProject(libraryContext); if (canceled) { return; check.afterCheckLibraryProject(libraryContext); if (canceled) { return; check.afterCheckProject(projectContext); if (canceled) { return;
mAllDetectors.add(v); List<String> applicableSuperClasses = detector.applicableSuperClasses(); if (applicableSuperClasses != null) { for (String fqn : applicableSuperClasses) { List<Class<? extends Node>> nodeTypes = detector.getApplicableNodeTypes(); if (nodeTypes != null) { for (Class<? extends Node> type : nodeTypes) { List<String> names = detector.getApplicableMethodNames(); if (names != null) { List<String> types = detector.getApplicableConstructorTypes(); if (types != null) { if (detector.appliesToResourceRefs()) { mResourceFieldDetectors.add(v); } else if ((names == null || names.isEmpty())
private void checkProject(Project project) { File projectDir = project.getDir(); Context projectContext = new Context(mClient, project, projectDir, mScope); fireEvent(EventType.SCANNING_PROJECT, projectContext); for (Detector check : mApplicableDetectors) { check.beforeCheckProject(projectContext); if (mCanceled) { return; } } runFileDetectors(project, projectDir); for (Detector check : mApplicableDetectors) { check.afterCheckProject(projectContext); if (mCanceled) { return; } } if (mCanceled) { mClient.report( projectContext, // Must provide an issue since API guarantees that the issue parameter // is valid Issue.create("Lint", "", "", Category.PERFORMANCE, 0, Severity.INFORMATIONAL, //$NON-NLS-1$ null, EnumSet.noneOf(Scope.class)), null /*range*/, "Lint canceled by user", null); } }
super.checkInstruction(context, classNode, method, instruction);
applicableBinaryChecks = new ArrayList<>(binaryChecks.size()); for (Detector check : binaryChecks) { if (check.appliesTo(type)) { applicableBinaryChecks.add(check);
check.beforeCheckFile(context); check.afterCheckFile(context);
super.checkInstruction(context, classNode, method, instruction);
private void checkProGuard(Project project, Project main) { List<Detector> detectors = scopeDetectors.get(Scope.PROGUARD_FILE); if (detectors != null) { List<File> files = project.getProguardFiles(); for (File file : files) { Context context = new Context(this, project, main, file); fireEvent(EventType.SCANNING_FILE, context); for (Detector detector : detectors) { detector.beforeCheckFile(context); detector.run(context); detector.afterCheckFile(context); } } } }
detector.beforeCheckFile(context); Detector.ClassScanner scanner = (Detector.ClassScanner) detector; scanner.checkClass(context, classNode); detector.afterCheckFile(context); detector.afterCheckFile(context);
Context context = new Context(driver, project, main, file); for (Detector detector : applicable) { detector.beforeCheckFile(context); detector.run(context); detector.afterCheckFile(context);
v.getDetector().beforeCheckFile(context); v.getDetector().afterCheckFile(context);
for (VisitingDetector v : allDetectors) { v.setContext(context); v.getDetector().beforeCheckFile(context); v.getDetector().afterCheckFile(context);