You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProjectScanContainer.java 15KB

пре 5 година
пре 11 година
MMF-1134 Make pull request a 1st class citizen SONAR-10366 Add pull request object to api/project_branches/list and api/ce/activity SONAR-10365 Analyze pull requests as 1st class citizen SONAR-10366 SONAR-10367 Create WS api/projet_pull_requests/list and delete SONAR-10383 Add Pull Request information when listing CE tasks SONAR-10365 Add key type in PROJECT_BRANCHES (#3063) SONAR-10371 Add pullRequest parameter in the Web API (#3076) * ComponentFinder searches by branch or pull request * Add pullRequest parameter to WS api/issues/* WS * Add pullRequest parameter to api/settings/* WS * Add pullRequest parameter to api/badges/* WS * Add pullRequest parameter to api/components/* WS * Add pullRequest parameter to api/sources/* WS SONAR-10368 Copy issue states from pull request after it's merged SONAR-10373 Send notifications for events on issues of a pull request SONAR-10365 Add pull_request_binary column in project_branches (#3073) SONAR-10433 Store pull request in projects table SONAR-10371 Add pullRequest field in the Web API SONAR-10365 Analyze pull requests as 1st class citizen BRANCH-45 Expose issue resolution for PR decoration BRANCH-49 Basic support of pull request analysis on pull request branch BRANCH-47 Fail when user tries to analyze a pull request and the plugin is not available SONAR-10366 update pull request decorated links to project and issues SONAR-10365 Use pull request id as key instead of branch name SONAR-10454 Update embedded Git 1.4 and SVN 1.7 SONAR-10365 rename sonar.pullrequest.id to sonar.pullrequest.key SONAR-10383 api/navigation/component returns the pull request key
пре 6 година
пре 10 година
пре 9 година
пре 5 година
MMF-1134 Make pull request a 1st class citizen SONAR-10366 Add pull request object to api/project_branches/list and api/ce/activity SONAR-10365 Analyze pull requests as 1st class citizen SONAR-10366 SONAR-10367 Create WS api/projet_pull_requests/list and delete SONAR-10383 Add Pull Request information when listing CE tasks SONAR-10365 Add key type in PROJECT_BRANCHES (#3063) SONAR-10371 Add pullRequest parameter in the Web API (#3076) * ComponentFinder searches by branch or pull request * Add pullRequest parameter to WS api/issues/* WS * Add pullRequest parameter to api/settings/* WS * Add pullRequest parameter to api/badges/* WS * Add pullRequest parameter to api/components/* WS * Add pullRequest parameter to api/sources/* WS SONAR-10368 Copy issue states from pull request after it's merged SONAR-10373 Send notifications for events on issues of a pull request SONAR-10365 Add pull_request_binary column in project_branches (#3073) SONAR-10433 Store pull request in projects table SONAR-10371 Add pullRequest field in the Web API SONAR-10365 Analyze pull requests as 1st class citizen BRANCH-45 Expose issue resolution for PR decoration BRANCH-49 Basic support of pull request analysis on pull request branch BRANCH-47 Fail when user tries to analyze a pull request and the plugin is not available SONAR-10366 update pull request decorated links to project and issues SONAR-10365 Use pull request id as key instead of branch name SONAR-10454 Update embedded Git 1.4 and SVN 1.7 SONAR-10365 rename sonar.pullrequest.id to sonar.pullrequest.key SONAR-10383 api/navigation/component returns the pull request key
пре 6 година
пре 6 година
пре 5 година
пре 9 година
MMF-1134 Make pull request a 1st class citizen SONAR-10366 Add pull request object to api/project_branches/list and api/ce/activity SONAR-10365 Analyze pull requests as 1st class citizen SONAR-10366 SONAR-10367 Create WS api/projet_pull_requests/list and delete SONAR-10383 Add Pull Request information when listing CE tasks SONAR-10365 Add key type in PROJECT_BRANCHES (#3063) SONAR-10371 Add pullRequest parameter in the Web API (#3076) * ComponentFinder searches by branch or pull request * Add pullRequest parameter to WS api/issues/* WS * Add pullRequest parameter to api/settings/* WS * Add pullRequest parameter to api/badges/* WS * Add pullRequest parameter to api/components/* WS * Add pullRequest parameter to api/sources/* WS SONAR-10368 Copy issue states from pull request after it's merged SONAR-10373 Send notifications for events on issues of a pull request SONAR-10365 Add pull_request_binary column in project_branches (#3073) SONAR-10433 Store pull request in projects table SONAR-10371 Add pullRequest field in the Web API SONAR-10365 Analyze pull requests as 1st class citizen BRANCH-45 Expose issue resolution for PR decoration BRANCH-49 Basic support of pull request analysis on pull request branch BRANCH-47 Fail when user tries to analyze a pull request and the plugin is not available SONAR-10366 update pull request decorated links to project and issues SONAR-10365 Use pull request id as key instead of branch name SONAR-10454 Update embedded Git 1.4 and SVN 1.7 SONAR-10365 rename sonar.pullrequest.id to sonar.pullrequest.key SONAR-10383 api/navigation/component returns the pull request key
пре 6 година
пре 10 година
пре 10 година
пре 6 година
пре 5 година
пре 5 година
пре 5 година
пре 5 година
пре 8 година
пре 5 година
пре 5 година
пре 8 година
MMF-1134 Make pull request a 1st class citizen SONAR-10366 Add pull request object to api/project_branches/list and api/ce/activity SONAR-10365 Analyze pull requests as 1st class citizen SONAR-10366 SONAR-10367 Create WS api/projet_pull_requests/list and delete SONAR-10383 Add Pull Request information when listing CE tasks SONAR-10365 Add key type in PROJECT_BRANCHES (#3063) SONAR-10371 Add pullRequest parameter in the Web API (#3076) * ComponentFinder searches by branch or pull request * Add pullRequest parameter to WS api/issues/* WS * Add pullRequest parameter to api/settings/* WS * Add pullRequest parameter to api/badges/* WS * Add pullRequest parameter to api/components/* WS * Add pullRequest parameter to api/sources/* WS SONAR-10368 Copy issue states from pull request after it's merged SONAR-10373 Send notifications for events on issues of a pull request SONAR-10365 Add pull_request_binary column in project_branches (#3073) SONAR-10433 Store pull request in projects table SONAR-10371 Add pullRequest field in the Web API SONAR-10365 Analyze pull requests as 1st class citizen BRANCH-45 Expose issue resolution for PR decoration BRANCH-49 Basic support of pull request analysis on pull request branch BRANCH-47 Fail when user tries to analyze a pull request and the plugin is not available SONAR-10366 update pull request decorated links to project and issues SONAR-10365 Use pull request id as key instead of branch name SONAR-10454 Update embedded Git 1.4 and SVN 1.7 SONAR-10365 rename sonar.pullrequest.id to sonar.pullrequest.key SONAR-10383 api/navigation/component returns the pull request key
пре 6 година
пре 7 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.scanner.scan;
  21. import javax.annotation.Nullable;
  22. import org.sonar.api.SonarEdition;
  23. import org.sonar.api.SonarRuntime;
  24. import org.sonar.api.batch.rule.CheckFactory;
  25. import org.sonar.api.batch.fs.internal.DefaultInputModule;
  26. import org.sonar.api.batch.fs.internal.FileMetadata;
  27. import org.sonar.api.batch.fs.internal.SensorStrategy;
  28. import org.sonar.api.batch.sensor.issue.internal.DefaultNoSonarFilter;
  29. import org.sonar.api.resources.Languages;
  30. import org.sonar.api.resources.ResourceTypes;
  31. import org.sonar.api.scan.filesystem.PathResolver;
  32. import org.sonar.api.utils.MessageException;
  33. import org.sonar.api.utils.log.Logger;
  34. import org.sonar.api.utils.log.Loggers;
  35. import org.sonar.core.config.ScannerProperties;
  36. import org.sonar.core.extension.CoreExtensionsInstaller;
  37. import org.sonar.core.metric.ScannerMetrics;
  38. import org.sonar.core.platform.ComponentContainer;
  39. import org.sonar.scanner.DefaultFileLinesContextFactory;
  40. import org.sonar.scanner.ProjectInfo;
  41. import org.sonar.scanner.analysis.AnalysisTempFolderProvider;
  42. import org.sonar.scanner.analysis.DefaultAnalysisMode;
  43. import org.sonar.scanner.bootstrap.ExtensionInstaller;
  44. import org.sonar.scanner.bootstrap.ExtensionMatcher;
  45. import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
  46. import org.sonar.scanner.bootstrap.MetricProvider;
  47. import org.sonar.scanner.bootstrap.PostJobExtensionDictionnary;
  48. import org.sonar.scanner.bootstrap.ProcessedScannerProperties;
  49. import org.sonar.scanner.ci.CiConfigurationProvider;
  50. import org.sonar.scanner.ci.vendors.AppVeyor;
  51. import org.sonar.scanner.ci.vendors.AzureDevops;
  52. import org.sonar.scanner.ci.vendors.BitbucketPipelines;
  53. import org.sonar.scanner.ci.vendors.Buildkite;
  54. import org.sonar.scanner.ci.vendors.CircleCi;
  55. import org.sonar.scanner.ci.vendors.CirrusCi;
  56. import org.sonar.scanner.ci.vendors.DroneCi;
  57. import org.sonar.scanner.ci.vendors.GithubActions;
  58. import org.sonar.scanner.ci.vendors.GitlabCi;
  59. import org.sonar.scanner.ci.vendors.Jenkins;
  60. import org.sonar.scanner.ci.vendors.SemaphoreCi;
  61. import org.sonar.scanner.ci.vendors.TravisCi;
  62. import org.sonar.scanner.cpd.CpdExecutor;
  63. import org.sonar.scanner.cpd.CpdSettings;
  64. import org.sonar.scanner.cpd.index.SonarCpdBlockIndex;
  65. import org.sonar.scanner.deprecated.test.TestPlanBuilder;
  66. import org.sonar.scanner.deprecated.test.TestableBuilder;
  67. import org.sonar.scanner.fs.InputModuleHierarchy;
  68. import org.sonar.scanner.issue.IssueFilters;
  69. import org.sonar.scanner.issue.IssuePublisher;
  70. import org.sonar.scanner.issue.ignore.EnforceIssuesFilter;
  71. import org.sonar.scanner.issue.ignore.IgnoreIssuesFilter;
  72. import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer;
  73. import org.sonar.scanner.issue.ignore.pattern.IssueInclusionPatternInitializer;
  74. import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader;
  75. import org.sonar.scanner.mediumtest.AnalysisObservers;
  76. import org.sonar.scanner.notifications.DefaultAnalysisWarnings;
  77. import org.sonar.scanner.postjob.DefaultPostJobContext;
  78. import org.sonar.scanner.postjob.PostJobOptimizer;
  79. import org.sonar.scanner.postjob.PostJobsExecutor;
  80. import org.sonar.scanner.report.ActiveRulesPublisher;
  81. import org.sonar.scanner.report.AnalysisContextReportPublisher;
  82. import org.sonar.scanner.report.AnalysisWarningsPublisher;
  83. import org.sonar.scanner.report.ChangedLinesPublisher;
  84. import org.sonar.scanner.report.ComponentsPublisher;
  85. import org.sonar.scanner.report.ContextPropertiesPublisher;
  86. import org.sonar.scanner.report.MetadataPublisher;
  87. import org.sonar.scanner.report.ReportPublisher;
  88. import org.sonar.scanner.report.SourcePublisher;
  89. import org.sonar.scanner.report.TestExecutionPublisher;
  90. import org.sonar.scanner.repository.ContextPropertiesCache;
  91. import org.sonar.scanner.repository.DefaultProjectRepositoriesLoader;
  92. import org.sonar.scanner.repository.DefaultQualityProfileLoader;
  93. import org.sonar.scanner.repository.ProjectRepositoriesLoader;
  94. import org.sonar.scanner.repository.ProjectRepositoriesSupplier;
  95. import org.sonar.scanner.repository.QualityProfileLoader;
  96. import org.sonar.scanner.repository.QualityProfilesProvider;
  97. import org.sonar.scanner.repository.language.DefaultLanguagesRepository;
  98. import org.sonar.scanner.repository.settings.DefaultProjectSettingsLoader;
  99. import org.sonar.scanner.repository.settings.ProjectSettingsLoader;
  100. import org.sonar.scanner.rule.ActiveRulesLoader;
  101. import org.sonar.scanner.rule.ActiveRulesProvider;
  102. import org.sonar.scanner.rule.DefaultActiveRulesLoader;
  103. import org.sonar.scanner.rule.DefaultRulesLoader;
  104. import org.sonar.scanner.rule.QProfileVerifier;
  105. import org.sonar.scanner.rule.RulesLoader;
  106. import org.sonar.scanner.rule.RulesProvider;
  107. import org.sonar.scanner.scan.branch.BranchConfiguration;
  108. import org.sonar.scanner.scan.branch.BranchConfigurationProvider;
  109. import org.sonar.scanner.scan.branch.BranchType;
  110. import org.sonar.scanner.scan.branch.ProjectBranchesProvider;
  111. import org.sonar.scanner.scan.branch.ProjectPullRequestsProvider;
  112. import org.sonar.scanner.scan.filesystem.DefaultProjectFileSystem;
  113. import org.sonar.scanner.scan.filesystem.FileIndexer;
  114. import org.sonar.scanner.scan.filesystem.InputComponentStore;
  115. import org.sonar.scanner.scan.filesystem.LanguageDetection;
  116. import org.sonar.scanner.scan.filesystem.MetadataGenerator;
  117. import org.sonar.scanner.scan.filesystem.ProjectCoverageAndDuplicationExclusions;
  118. import org.sonar.scanner.scan.filesystem.ProjectExclusionFilters;
  119. import org.sonar.scanner.scan.filesystem.ProjectFileIndexer;
  120. import org.sonar.scanner.scan.filesystem.ScannerComponentIdGenerator;
  121. import org.sonar.scanner.scan.filesystem.StatusDetection;
  122. import org.sonar.scanner.scan.measure.DefaultMetricFinder;
  123. import org.sonar.scanner.scm.ScmChangedFilesProvider;
  124. import org.sonar.scanner.scm.ScmConfiguration;
  125. import org.sonar.scanner.scm.ScmPublisher;
  126. import org.sonar.scanner.scm.ScmRevisionImpl;
  127. import org.sonar.scanner.sensor.DefaultSensorStorage;
  128. import org.sonar.scanner.sensor.ProjectSensorContext;
  129. import org.sonar.scanner.sensor.ProjectSensorExtensionDictionnary;
  130. import org.sonar.scanner.sensor.ProjectSensorOptimizer;
  131. import org.sonar.scanner.sensor.ProjectSensorsExecutor;
  132. import static org.sonar.api.batch.InstantiationStrategy.PER_BATCH;
  133. import static org.sonar.core.extension.CoreExtensionsInstaller.noExtensionFilter;
  134. import static org.sonar.scanner.bootstrap.ExtensionUtils.isDeprecatedScannerSide;
  135. import static org.sonar.scanner.bootstrap.ExtensionUtils.isInstantiationStrategy;
  136. import static org.sonar.scanner.bootstrap.ExtensionUtils.isScannerSide;
  137. public class ProjectScanContainer extends ComponentContainer {
  138. private static final Logger LOG = Loggers.get(ProjectScanContainer.class);
  139. public ProjectScanContainer(ComponentContainer globalContainer) {
  140. super(globalContainer);
  141. }
  142. @Override
  143. protected void doBeforeStart() {
  144. addScannerExtensions();
  145. addScannerComponents();
  146. ProjectLock lock = getComponentByType(ProjectLock.class);
  147. lock.tryLock();
  148. getComponentByType(WorkDirectoriesInitializer.class).execute();
  149. }
  150. private void addScannerComponents() {
  151. add(
  152. new ExternalProjectKeyAndOrganizationProvider(),
  153. ProcessedScannerProperties.class,
  154. ScanProperties.class,
  155. ProjectReactorBuilder.class,
  156. WorkDirectoriesInitializer.class,
  157. new MutableProjectReactorProvider(),
  158. ProjectBuildersExecutor.class,
  159. ProjectLock.class,
  160. ResourceTypes.class,
  161. ProjectReactorValidator.class,
  162. MetricProvider.class,
  163. ProjectInfo.class,
  164. new RulesProvider(),
  165. new BranchConfigurationProvider(),
  166. new ProjectBranchesProvider(),
  167. new ProjectPullRequestsProvider(),
  168. DefaultAnalysisMode.class,
  169. ProjectRepositoriesSupplier.class,
  170. new ProjectServerSettingsProvider(),
  171. // temp
  172. new AnalysisTempFolderProvider(),
  173. // file system
  174. ModuleIndexer.class,
  175. InputComponentStore.class,
  176. PathResolver.class,
  177. new InputProjectProvider(),
  178. new InputModuleHierarchyProvider(),
  179. ScannerComponentIdGenerator.class,
  180. new ScmChangedFilesProvider(),
  181. StatusDetection.class,
  182. LanguageDetection.class,
  183. MetadataGenerator.class,
  184. FileMetadata.class,
  185. FileIndexer.class,
  186. ProjectFileIndexer.class,
  187. ProjectExclusionFilters.class,
  188. // rules
  189. new ActiveRulesProvider(),
  190. new QualityProfilesProvider(),
  191. CheckFactory.class,
  192. QProfileVerifier.class,
  193. // issues
  194. DefaultNoSonarFilter.class,
  195. IssueFilters.class,
  196. IssuePublisher.class,
  197. // metrics
  198. DefaultMetricFinder.class,
  199. // tests
  200. TestPlanBuilder.class,
  201. TestableBuilder.class,
  202. // lang
  203. Languages.class,
  204. DefaultLanguagesRepository.class,
  205. // issue exclusions
  206. IssueInclusionPatternInitializer.class,
  207. IssueExclusionPatternInitializer.class,
  208. IssueExclusionsLoader.class,
  209. EnforceIssuesFilter.class,
  210. IgnoreIssuesFilter.class,
  211. // context
  212. ContextPropertiesCache.class,
  213. ContextPropertiesPublisher.class,
  214. DefaultAnalysisWarnings.class,
  215. SensorStrategy.class,
  216. MutableProjectSettings.class,
  217. ScannerProperties.class,
  218. new ProjectConfigurationProvider(),
  219. ProjectCoverageAndDuplicationExclusions.class,
  220. // Report
  221. ScannerMetrics.class,
  222. ReportPublisher.class,
  223. AnalysisContextReportPublisher.class,
  224. MetadataPublisher.class,
  225. ActiveRulesPublisher.class,
  226. AnalysisWarningsPublisher.class,
  227. ComponentsPublisher.class,
  228. TestExecutionPublisher.class,
  229. SourcePublisher.class,
  230. ChangedLinesPublisher.class,
  231. // Cpd
  232. CpdExecutor.class,
  233. CpdSettings.class,
  234. SonarCpdBlockIndex.class,
  235. // PostJobs
  236. PostJobsExecutor.class,
  237. PostJobOptimizer.class,
  238. DefaultPostJobContext.class,
  239. PostJobExtensionDictionnary.class,
  240. // SCM
  241. ScmConfiguration.class,
  242. ScmPublisher.class,
  243. ScmRevisionImpl.class,
  244. // Sensors
  245. DefaultSensorStorage.class,
  246. DefaultFileLinesContextFactory.class,
  247. ProjectSensorContext.class,
  248. ProjectSensorOptimizer.class,
  249. ProjectSensorsExecutor.class,
  250. ProjectSensorExtensionDictionnary.class,
  251. // Filesystem
  252. DefaultProjectFileSystem.class,
  253. // CI
  254. new CiConfigurationProvider(),
  255. AppVeyor.class,
  256. AzureDevops.class,
  257. BitbucketPipelines.class,
  258. Buildkite.class,
  259. CircleCi.class,
  260. CirrusCi.class,
  261. DroneCi.class,
  262. GithubActions.class,
  263. GitlabCi.class,
  264. Jenkins.class,
  265. SemaphoreCi.class,
  266. TravisCi.class,
  267. AnalysisObservers.class);
  268. addIfMissing(DefaultProjectSettingsLoader.class, ProjectSettingsLoader.class);
  269. addIfMissing(DefaultRulesLoader.class, RulesLoader.class);
  270. addIfMissing(DefaultActiveRulesLoader.class, ActiveRulesLoader.class);
  271. addIfMissing(DefaultQualityProfileLoader.class, QualityProfileLoader.class);
  272. addIfMissing(DefaultProjectRepositoriesLoader.class, ProjectRepositoriesLoader.class);
  273. }
  274. private void addScannerExtensions() {
  275. getComponentByType(CoreExtensionsInstaller.class)
  276. .install(this, noExtensionFilter(), extension -> getScannerProjectExtensionsFilter().accept(extension));
  277. getComponentByType(ExtensionInstaller.class)
  278. .install(this, getScannerProjectExtensionsFilter());
  279. }
  280. static ExtensionMatcher getScannerProjectExtensionsFilter() {
  281. return extension -> {
  282. if (isDeprecatedScannerSide(extension)) {
  283. return isInstantiationStrategy(extension, PER_BATCH);
  284. }
  285. return isScannerSide(extension);
  286. };
  287. }
  288. @Override
  289. protected void doAfterStart() {
  290. GlobalAnalysisMode analysisMode = getComponentByType(GlobalAnalysisMode.class);
  291. InputModuleHierarchy tree = getComponentByType(InputModuleHierarchy.class);
  292. ScanProperties properties = getComponentByType(ScanProperties.class);
  293. properties.validate();
  294. properties.organizationKey().ifPresent(k -> LOG.info("Organization key: {}", k));
  295. properties.get("sonar.branch").ifPresent(deprecatedBranch -> {
  296. throw MessageException.of("The 'sonar.branch' parameter is no longer supported. You should stop using it. " +
  297. "Branch analysis is available in Developer Edition and above. See https://redirect.sonarsource.com/editions/developer.html for more information.");
  298. });
  299. BranchConfiguration branchConfig = getComponentByType(BranchConfiguration.class);
  300. if (branchConfig.branchType() == BranchType.PULL_REQUEST) {
  301. LOG.info("Pull request {} for merge into {} from {}", branchConfig.pullRequestKey(), pullRequestBaseToDisplayName(branchConfig.targetBranchName()),
  302. branchConfig.branchName());
  303. } else if (branchConfig.branchName() != null) {
  304. LOG.info("Branch name: {}, type: {}", branchConfig.branchName(), branchTypeToDisplayName(branchConfig.branchType()));
  305. }
  306. getComponentByType(ProjectFileIndexer.class).index();
  307. // Log detected languages and their profiles after FS is indexed and languages detected
  308. getComponentByType(QProfileVerifier.class).execute();
  309. scanRecursively(tree, tree.root());
  310. LOG.info("------------- Run sensors on project");
  311. getComponentByType(ProjectSensorsExecutor.class).execute();
  312. getComponentByType(ScmPublisher.class).publish();
  313. getComponentByType(CpdExecutor.class).execute();
  314. getComponentByType(ReportPublisher.class).execute();
  315. getComponentByType(PostJobsExecutor.class).execute();
  316. if (analysisMode.isMediumTest()) {
  317. getComponentByType(AnalysisObservers.class).notifyEndOfScanTask();
  318. }
  319. }
  320. private static String pullRequestBaseToDisplayName(@Nullable String pullRequestBase) {
  321. return pullRequestBase != null ? pullRequestBase : "default branch";
  322. }
  323. private static String branchTypeToDisplayName(BranchType branchType) {
  324. switch (branchType) {
  325. case LONG:
  326. return "long living";
  327. case SHORT:
  328. return "short living";
  329. default:
  330. throw new UnsupportedOperationException("unknown branch type: " + branchType);
  331. }
  332. }
  333. private void scanRecursively(InputModuleHierarchy tree, DefaultInputModule module) {
  334. for (DefaultInputModule child : tree.children(module)) {
  335. scanRecursively(tree, child);
  336. }
  337. LOG.info("------------- Run sensors on module {}", module.definition().getName());
  338. scan(module);
  339. }
  340. void scan(DefaultInputModule module) {
  341. new ModuleScanContainer(this, module).execute();
  342. }
  343. }