org.sonar.api.resources.Project.getName()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.sonar.api.resources.Project.getName()方法的一些代码示例,展示了Project.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getName()方法的具体详情如下:
包路径:org.sonar.api.resources.Project
类名称:Project
方法名:getName

Project.getName介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.sonar/sonar-batch

public String moduleName() {
 if (module != null) {
  return module.getName();
 }
 return null;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

public String moduleName() {
 if (module != null) {
  return module.getName();
 }
 return null;
}

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

@Override
public String name() {
 return getName();
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet/sonar-dotnet-plugin

/**
 * 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());
}

代码示例来源:origin: Stratio/sonar-scala-plugin

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;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

@Override
protected void doBeforeStart() {
 LOG.info("-------------  Scan {}", module.getName());
 addCoreComponents();
 addExtensions();
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * 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);
 }
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet.tools/dotnet-tools-commons

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;
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet/sonar-dotnet-plugin

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;
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

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).";
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

@Override
protected void doBeforeStart() {
 LOG.info("-------------  Scan {}", module.getName());
 addCoreComponents();
 if (analysisMode.isDb()) {
  addDataBaseComponents();
 }
 addExtensions();
}

代码示例来源:origin: Stratio/sonar-scala-plugin

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();
  }
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-php-plugin

/**
 * @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;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

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;
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

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;
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-issues-report-plugin

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;
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

@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();
  }
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

@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();
  }
 }
}

相关文章