@Override public Date creationDate() { return project.getAnalysisDate(); }
@Override public Date creationDate() { return project.getAnalysisDate(); }
public IssueTrackingDecorator(IssueCache issueCache, InitialOpenIssuesStack initialOpenIssues, IssueTracking tracking, ServerLineHashesLoader lastLineHashes, IssueHandlers handlers, IssueWorkflow workflow, IssueUpdater updater, Project project, ResourcePerspectives perspectives, RulesProfile rulesProfile, RuleFinder ruleFinder, InputPathCache inputPathCache) { this.issueCache = issueCache; this.initialOpenIssues = initialOpenIssues; this.tracking = tracking; this.lastLineHashes = lastLineHashes; this.handlers = handlers; this.workflow = workflow; this.updater = updater; this.project = project; this.inputPathCache = inputPathCache; this.changeContext = IssueChangeContext.createScan(project.getAnalysisDate()); this.perspectives = perspectives; this.rulesProfile = rulesProfile; this.ruleFinder = ruleFinder; }
public IssueTransition(BatchComponentCache componentCache, IssueCache issueCache, ReportPublisher reportPublisher, @Nullable LocalIssueTracking localIssueTracking) { this.componentCache = componentCache; this.issueCache = issueCache; this.reportPublisher = reportPublisher; this.localIssueTracking = localIssueTracking; this.analysisDate = ((Project) componentCache.getRoot().resource()).getAnalysisDate(); }
public LocalIssueTracking(ResourceCache resourceCache, IssueCache issueCache, IssueTracking tracking, ServerLineHashesLoader lastLineHashes, IssueWorkflow workflow, IssueUpdater updater, ActiveRules activeRules, InputPathCache inputPathCache, ServerIssueRepository serverIssueRepository, ProjectRepositories projectRepositories, AnalysisMode analysisMode) { this.resourceCache = resourceCache; this.issueCache = issueCache; this.tracking = tracking; this.lastLineHashes = lastLineHashes; this.workflow = workflow; this.updater = updater; this.inputPathCache = inputPathCache; this.serverIssueRepository = serverIssueRepository; this.projectRepositories = projectRepositories; this.analysisMode = analysisMode; this.changeContext = IssueChangeContext.createScan(((Project) resourceCache.getRoot().resource()).getAnalysisDate()); this.activeRules = activeRules; }
params.put("from", index.getProject().getAnalysisDate()); params.put("to", dateToLong(index.getProject().getAnalysisDate()));
private void persistLibrary(BatchResource lib) { Snapshot s = persistLibrary(projectTree.getRootProject().getAnalysisDate(), (Library) lib.resource()); lib.setSnapshot(s); }
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; }
protected TimeMachineQuery initQuery(Project project) { int days = PeriodsDefinition.CORE_TENDENCY_DEPTH_DEFAULT_VALUE; // resource is set after query = new TimeMachineQuery(null) .setFrom(DateUtils.addDays(project.getAnalysisDate(), -days)) .setToCurrentAnalysis(true) .setMetrics(metrics); return query; }
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; }
private Snapshot buildProjectSnapshot() { Query query = session .createNativeQuery("select p.id from projects p where p.kee=:resourceKey and p.qualifier<>:lib and p.enabled=:enabled"); query.setParameter("resourceKey", projectTree.getRootProject().getKey()); query.setParameter("lib", Qualifiers.LIBRARY); query.setParameter("enabled", Boolean.TRUE); Snapshot snapshot = null; Number projectId = session.getSingleResult(query, null); if (projectId != null) { snapshot = new Snapshot(); snapshot.setResourceId(projectId.intValue()); snapshot.setCreatedAtMs(dateToLong(projectTree.getRootProject().getAnalysisDate())); snapshot.setBuildDateMs(System.currentTimeMillis()); snapshot.setVersion(projectTree.getRootProject().getAnalysisVersion()); } return snapshot; }
private void updateIssue(DefaultIssue issue, @Nullable Rule rule, ActiveRule activeRule) { if (Strings.isNullOrEmpty(issue.message())) { issue.setMessage(((DefaultActiveRule) activeRule).name()); } if (project != null) { issue.setCreationDate(project.getAnalysisDate()); issue.setUpdateDate(project.getAnalysisDate()); } if (issue.severity() == null) { issue.setSeverity(activeRule.severity()); } if (rule != null) { DebtRemediationFunction function = rule.debtRemediationFunction(); if (rule.debtSubCharacteristic() != null && function != null) { issue.setDebt(calculateDebt(function, issue.effortToFix(), rule.key())); } } }
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 publish(BatchReportWriter writer) { ProjectDefinition root = reactor.getRoot(); BatchComponent rootProject = componentCache.getRoot(); BatchReport.Metadata.Builder builder = BatchReport.Metadata.newBuilder() .setAnalysisDate(((Project) rootProject.resource()).getAnalysisDate().getTime()) // Here we want key without branch .setProjectKey(root.getKey()) .setCrossProjectDuplicationActivated(SonarDuplicationsIndex.isCrossProjectDuplicationEnabled(settings)) .setRootComponentRef(rootProject.batchId()); String branch = root.properties().get(CoreProperties.PROJECT_BRANCH_PROPERTY); if (branch != null) { builder.setBranch(branch); } writer.writeMetadata(builder.build()); } }
private void exportMetadata(BatchReportWriter writer, int count) { BatchResource rootProject = resourceCache.get(reactor.getRoot().getKeyWithBranch()); BatchReport.Metadata.Builder builder = BatchReport.Metadata.newBuilder() .setAnalysisDate(((Project) rootProject.resource()).getAnalysisDate().getTime()) .setProjectKey(((Project) rootProject.resource()).key()) .setRootComponentRef(rootProject.batchId()) .setDeletedComponentsCount(count); Integer sid = rootProject.snapshotId(); if (sid != null) { builder.setSnapshotId(sid); } writer.writeMetadata(builder.build()); }
snapshot.setCreatedAtMs(dateToLong(project.getAnalysisDate())); snapshot.setBuildDateMs(System.currentTimeMillis()); snapshot = session.save(snapshot);