public String moduleName() { if (module != null) { return module.getName(); } return null; }
public String moduleName() { if (module != null) { return module.getName(); } return null; }
@Override public String name() { return getName(); }
/** * Returns the Visual Studio Project corresponding to the given Sonar Project. * * @param project * the Sonar Project * @return the VS Project */ protected VisualStudioProject getVSProject(Project project) { return microsoftWindowsEnvironment.getCurrentProject(project.getName()); }
private boolean atLeastOneBinaryDirectoryExists(Project project) { java.io.File binariesDir = new File(fileSystem.baseDir() + "/target/classes"); if (binariesDir.exists()) { return true; } else { JaCoCoScalaExtensions.LOG.warn("No binary directories defined for project " + project.getName() + "."); } return false; }
@Override protected void doBeforeStart() { LOG.info("------------- Scan {}", module.getName()); addCoreComponents(); addExtensions(); }
/** * Analyse the project source dirs. * * @param project * the project to be analyzed * @param context * the context the execution context * @see org.sonar.api.batch.AbstractSourceImporter#analyse(org.sonar.api.resources.Project, org.sonar.api.batch.SensorContext) */ @Override public void analyse(Project project, SensorContext context) { try { LOG.info("Importing files from project " + project.getName()); doAnalyse(project, context); } catch (IOException e) { throw new SonarException("Parsing source files ended abnormaly", e); } }
public VisualStudioProject getProjectFromSonarProject(Project sonarProject) { String currentProjectName = sonarProject.getName(); String branch = sonarProject.getBranch(); for (VisualStudioProject project : projects) { final String vsProjectName; if (StringUtils.isEmpty(branch)) { vsProjectName = project.getName(); } else { vsProjectName = project.getName() + " " + branch; } if (currentProjectName.equals(vsProjectName)) { return project; } } return null; }
public VisualStudioProject getProjectFromSonarProject(Project sonarProject) { String currentProjectName = sonarProject.getName(); String branch = sonarProject.getBranch(); for (VisualStudioProject project : projects) { final String vsProjectName; if (StringUtils.isEmpty(branch)) { vsProjectName = project.getName(); } else { vsProjectName = project.getName() + " " + branch; } if (currentProjectName.equals(vsProjectName)) { return project; } } return null; }
private String getErrorMessage(Semaphores.Semaphore semaphore) { long duration = semaphore.getDurationSinceLocked(); String durationDisplay = i18n.age(Locale.ENGLISH, duration); return "It looks like an analysis of '" + getProject().getName() + "' is already running (started " + durationDisplay + " ago)."; }
@Override protected void doBeforeStart() { LOG.info("------------- Scan {}", module.getName()); addCoreComponents(); if (analysisMode.isDb()) { addDataBaseComponents(); } addExtensions(); }
public final void analyse(Project project, SensorContext context) { if (!atLeastOneBinaryDirectoryExists(project)) { JaCoCoScalaExtensions.LOG.warn("Project coverage is set to 0% since there is no directories with classes."); return; } String path = getReportPath(project); if (path == null) { JaCoCoScalaExtensions.LOG.warn("No jacoco coverage execution file found for project " + project.getName() + "."); return; } File jacocoExecutionData = pathResolver.relativeFile(fileSystem.baseDir(), path); try { readExecutionData(jacocoExecutionData, context); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * @see org.sonar.plugins.php.core.PhpPluginAbstractExecutor#getCommandLine() */ @Override protected List<String> getCommandLine() { List<String> result = new ArrayList<String>(); result.add(configuration.getOsDependentToolScriptName()); Configuration c = configuration.getProject().getConfiguration(); addBasicOptions(result); boolean useMaintTestClass = true; if (configuration.isStringPropertySet(PHPUNIT_CONFIGURATION_PROPERTY_KEY)) { result.add(PHPUNIT_CONFIGURATION_OPTION + configuration.getConfiguration()); useMaintTestClass = false; } addExtendedOptions(result, c); if (useMaintTestClass && configuration.isStringPropertySet(PHPUNIT_MAIN_TEST_FILE_PROPERTY_KEY)) { result.add(project.getName()); result.add(configuration.getMainTestClass()); } // source directory is appended phpunit. if ( !useMaintTestClass || !c.containsKey(PHPUNIT_ANALYZE_TEST_DIRECTORY_KEY) || c.getBoolean(PHPUNIT_ANALYZE_TEST_DIRECTORY_KEY)) { result.add(getTestDirectoryOrFiles()); } return result; }
public IssuesReport buildReport() { Project project = projectTree.getRootProject(); IssuesReport issuesReport = new IssuesReport(); issuesReport.setNoFile(!inputPathCache.allFiles().iterator().hasNext()); issuesReport.setTitle(project.getName()); issuesReport.setDate(project.getAnalysisDate()); processIssues(issuesReport, issueCache.all()); return issuesReport; }
public IssuesReport buildReport() { Project project = projectTree.getRootProject(); IssuesReport issuesReport = new IssuesReport(); issuesReport.setNoFile(!inputPathCache.allFiles().iterator().hasNext()); issuesReport.setTitle(project.getName()); issuesReport.setDate(project.getAnalysisDate()); processIssues(issuesReport, issueCache.all()); return issuesReport; }
public IssuesReport buildReport(Project project) { IssuesReport issuesReport = new IssuesReport(); issuesReport.setTitle(project.getName()); issuesReport.setDate(project.getAnalysisDate()); processIssues(issuesReport, moduleIssues.issues(), false); processIssues(issuesReport, moduleIssues.resolvedIssues(), true); return issuesReport; }
@Override public void onProjectAnalysis(ProjectAnalysisEvent event) { Project module = event.getProject(); if (event.isStart()) { decoratorsProfiler = new DecoratorsProfiler(); currentModuleProfiling = new ModuleProfiling(module, system); } else { currentModuleProfiling.stop(); modulesProfilings.put(module, currentModuleProfiling); long moduleTotalTime = currentModuleProfiling.totalTime(); println(""); println(" -------- Profiling of module " + module.getName() + ": " + TimeUtils.formatDuration(moduleTotalTime) + " --------"); println(""); Properties props = new Properties(); currentModuleProfiling.dump(props); println(""); println(" -------- End of profiling of module " + module.getName() + " --------"); println(""); String fileName = module.getKey() + "-profiler.properties"; dumpToFile(props, BatchUtils.cleanKeyForFilename(fileName)); totalProfiling.merge(currentModuleProfiling); if (module.isRoot() && !module.getModules().isEmpty()) { dumpTotalExecutionSummary(); } } }
@Override public void onProjectAnalysis(ProjectAnalysisEvent event) { Project module = event.getProject(); if (event.isStart()) { decoratorsProfiler = new DecoratorsProfiler(); currentModuleProfiling = new ModuleProfiling(module, system); } else { currentModuleProfiling.stop(); modulesProfilings.put(module, currentModuleProfiling); long moduleTotalTime = currentModuleProfiling.totalTime(); println(""); println(" -------- Profiling of module " + module.getName() + ": " + TimeUtils.formatDuration(moduleTotalTime) + " --------"); println(""); Properties props = new Properties(); currentModuleProfiling.dump(props); println(""); println(" -------- End of profiling of module " + module.getName() + " --------"); println(""); String fileName = module.getKey() + "-profiler.properties"; dumpToFile(props, BatchUtils.cleanKeyForFilename(fileName)); totalProfiling.merge(currentModuleProfiling); if (module.isRoot() && !module.getModules().isEmpty()) { dumpTotalExecutionSummary(); } } }