/** * Determine if the project has Java source files. This is used to determine if the project has no compiled classes on * purpose or because the compilation was omit from the process. * @return If at least one Java file is present */ private boolean hasSourceFiles() { FilePredicates pred = fileSystem.predicates(); return fileSystem.hasFiles( pred.and( pred.hasType(Type.MAIN), pred.or(FindbugsPlugin.getSupportedLanguagesFilePredicate(pred)), //package-info.java will not generate any class files. //See: https://github.com/SonarQubeCommunity/sonar-findbugs/issues/36 pred.not(pred.matchesPathPattern("**/package-info.java")), pred.not(pred.matchesPathPattern("**/module-info.java")), pred.not(pred.matchesPathPattern("**/*.jsp")) ) ); }
private void setFields(Project project, Settings settings, FileIndexer indexer, ModuleFileSystemInitializer initializer, ComponentIndexer componentIndexer, DefaultAnalysisMode mode) { this.componentIndexer = componentIndexer; this.moduleKey = project.getKey(); this.settings = settings; this.indexer = indexer; setWorkDir(initializer.workingDir()); this.buildDir = initializer.buildDir(); this.sourceDirsOrFiles = initializer.sources(); this.testDirsOrFiles = initializer.tests(); this.binaryDirs = initializer.binaryDirs(); // filter the files sensors have access to if (!mode.scanAllFiles()) { setDefaultPredicate(predicates.not(predicates.hasStatus(Status.SAME))); } }