private static List<Hint> getHints(GraphContext graphContext) { final List<Hint> hints = new ArrayList<>(); InlineHintService hintService = new InlineHintService(graphContext); for (InlineHintModel hintModel : hintService.findAll()) { HintImpl hint = new HintImpl(hintModel.getElement().id()); hint.setFile(hintModel.getFile().asFile()); hint.setTitle(hintModel.getTitle()); hint.setHint(hintModel.getHint()); hint.setIssueCategory(new IssueCategoryImpl(hintModel.getIssueCategory())); hint.setEffort(hintModel.getEffort()); hint.setColumn(hintModel.getColumnNumber()); hint.setLineNumber(hintModel.getLineNumber()); hint.setLength(hintModel.getLength()); hint.setSourceSnippit(hintModel.getSourceSnippit()); hint.setRuleID(hintModel.getRuleID()); hint.setQuickfixes(asQuickfixes(hintModel.getQuickfixes())); hint.setLinks(asLinks(hintModel.getLinks())); hints.add(hint); } return hints; }
public static Set<String> gatherReportFileTags(ReportFileModel reportFileModel) { Set<String> allTags = new HashSet<>(); for (ClassificationModel classificationModel : reportFileModel.getClassificationModels()) { for (String tag : classificationModel.getTags()) allTags.add(tag); } for (InlineHintModel inlineHintModel : reportFileModel.getInlineHints()) { for (String tag : inlineHintModel.getTags()) allTags.add(tag); } return allTags; } }
private Iterable<HintWithOccurence> groupHints(Iterable<InlineHintModel> hints) throws TemplateModelException { Map<String, HintWithOccurence> hintOccurences = new HashMap<>(); for(InlineHintModel hint : hints) { String hintAndId = hint.getHint() + hint.getRuleID(); if(hintOccurences.containsKey(hintAndId)) { HintWithOccurence item = hintOccurences.get(hintAndId); item.addOccurence(); } else { hintOccurences.put(hintAndId,new HintWithOccurence(hint.getHint(),hint.getRuleID(),1)); } } return hintOccurences.values(); }
hintModel.setRuleID(((Rule) context.get(Rule.class)).getId()); hintModel.setLineNumber(locationModel.getLineNumber()); hintModel.setColumnNumber(locationModel.getColumnNumber()); hintModel.setLength(locationModel.getLength()); hintModel.setFileLocationReference(locationModel); hintModel.setFile(locationModel.getFile()); hintModel.setEffort(effort); hintModel.setIssueDisplayMode(this.issueDisplayMode); hintModel.setIssueCategory(issueCategoryModel); if (hintTitlePattern != null) hintModel.setTitle(StringUtils.trim(hintTitlePattern.getBuilder().build(event, context))); hintModel.setTitle(hintTitlePattern.toString().trim()); hintModel.setTitle(locationModel.getDescription()); hintModel.setHint(StringUtils.trim(hintText)); linkModel.setDescription(StringUtils.trim(link.getTitle())); linkModel.setLink(StringUtils.trim(link.getLink())); hintModel.addLink(linkModel); hintModel.addQuickfix(quickfix.createQuickfix(event.getGraphContext())); hintModel.setTagModel(tagSetService.getOrCreate(event, tags)); + ":\n " + this.toString(hintModel.getTitle(), null));
for (InlineHintModel hint : hints) if (hint.getIssueDisplayMode() == IssueDisplayMode.DETAIL_ONLY) continue; Set<String> tags = hint.getTags(); RuleSummaryKey key = new RuleSummaryKey(hint.getEffort(), hint.getRuleID(), hint.getTitle()); summary = new ProblemSummary(UUID.randomUUID().toString(), hint.getIssueCategory(), hint.getRuleID(), hint.getTitle(), 1, hint.getEffort()); for (LinkModel link : hint.getLinks()) summary.addFile(hint.getHint(), hint.getFile());
final ProjectModel parentRootProjectModel = hint.getFile().getProjectModel().getRootProjectModel(); String links = buildLinkString(hint.getLinks()); String ruleId = hint.getRuleID() != null ? hint.getRuleID() : ""; String title = hint.getTitle() != null ? hint.getTitle() : ""; String description = hint.getDescription() != null ? hint.getDescription() : ""; String projectNameString = ""; String fileName = ""; String filePath = ""; if (hint.getFile() != null) if (hint.getFile().getProjectModel() != null) projectNameString = hint.getFile().getProjectModel().getName(); fileName = hint.getFile().getFileName(); filePath = hint.getFile().getFilePath(); ruleId, hint.getIssueCategory().getCategoryID(), title, description, links, projectNameString, fileName, filePath, String.valueOf( hint.getLineNumber()), String.valueOf(hint.getEffort()) }; writeCsvRecordForProject(projectToFile, outputFolderPath, parentRootProjectModel, strings);
if (applicationDetails.getHints().containsKey(hint.getId())) continue; hintReducedDTO.setTitle(strings.getOrAdd(hint.getTitle())); hintReducedDTO.setEffort(hint.getEffort()); FileLocationModel fileLocationModel = hint.getFileLocationReference(); if (fileLocationModel instanceof JavaTypeReferenceModel) hintReducedDTO.setJavaFQCN(strings.getOrAdd(((JavaTypeReferenceModel) fileLocationModel).getResolvedSourceSnippit())); for (String tag : hint.getTags()) hintReducedDTO.getTags().add(new TagReducedDTO(strings.getOrAdd(tag), 0)); applicationDetails.getHints().put(hint.getId(), hintReducedDTO); fileDTO.getHintIDs().add(hint.getId());
if (!TagUtil.checkMatchingTags(javaInlineHint.getTags(), includeTags, excludeTags)) continue; FileLocationModel fileLocationModel = javaInlineHint.getFileLocationReference(); if (fileLocationModel == null || !(fileLocationModel instanceof JavaTypeReferenceModel))
if (checkTags && !hintModel.matchesTags(includeTags, excludeTags)) continue; if (!issueCategoryIDs.isEmpty() && !issueCategoryIDs.contains(hintModel.getIssueCategory().getCategoryID())) continue;
public IssueCategoryModel vertexToKey(Vertex effortReportVertex) { return frame(effortReportVertex).getIssueCategory(); }
/** * This is used by the Javascript in the source rendering template to provide code assist blocks in the rendered * output. */ default String getSourceBlock() { StringBuilder builder = new StringBuilder(); boolean first = true; for (InlineHintModel line : getSourceFileModel().getInlineHints()) { if (!first) { builder.append(","); } builder.append(line.getLineNumber()); if (first) { first = false; } } return builder.toString(); } }
FileLocationModel fileLocationModel = javaInlineHint.getFileLocationReference(); if (fileLocationModel == null || !(fileLocationModel instanceof JavaTypeReferenceModel))
hintModel.setRuleID(((Rule) context.get(Rule.class)).getId()); hintModel.setLineNumber(locationModel.getLineNumber()); hintModel.setColumnNumber(locationModel.getColumnNumber()); hintModel.setLength(locationModel.getLength()); hintModel.setFileLocationReference(locationModel); hintModel.setFile(locationModel.getFile()); hintModel.setEffort(effort); hintModel.setIssueDisplayMode(this.issueDisplayMode); hintModel.setIssueCategory(issueCategoryModel); if (hintTitlePattern != null) hintModel.setTitle(StringUtils.trim(hintTitlePattern.getBuilder().build(event, context))); hintModel.setTitle(hintTitlePattern.toString().trim()); hintModel.setTitle(locationModel.getDescription()); hintModel.setHint(StringUtils.trim(hintText)); linkModel.setDescription(StringUtils.trim(link.getTitle())); linkModel.setLink(StringUtils.trim(link.getLink())); hintModel.addLink(linkModel); hintModel.addQuickfix(quickfix.createQuickfix(event.getGraphContext())); hintModel.setTagModel(tagSetService.getOrCreate(event, tags)); + ":\n " + this.toString(hintModel.getTitle(), null));
for (InlineHintModel hint : hints) if (hint.getIssueDisplayMode() == IssueDisplayMode.DETAIL_ONLY) continue; Set<String> tags = hint.getTags(); RuleSummaryKey key = new RuleSummaryKey(hint.getEffort(), hint.getRuleID(), hint.getTitle()); summary = new ProblemSummary(UUID.randomUUID().toString(), hint.getIssueCategory(), hint.getRuleID(), hint.getTitle(), 1, hint.getEffort()); for (LinkModel link : hint.getLinks()) summary.addFile(hint.getHint(), hint.getFile());
final ProjectModel parentRootProjectModel = hint.getFile().getProjectModel().getRootProjectModel(); String links = buildLinkString(hint.getLinks()); String ruleId = hint.getRuleID() != null ? hint.getRuleID() : ""; String title = hint.getTitle() != null ? hint.getTitle() : ""; String description = hint.getDescription() != null ? hint.getDescription() : ""; String projectNameString = ""; String fileName = ""; String filePath = ""; if (hint.getFile() != null) { if (hint.getFile().getProjectModel() != null) { projectNameString = hint.getFile().getProjectModel().getName(); fileName = hint.getFile().getFileName(); filePath = hint.getFile().getFilePath(); ruleId, hint.getIssueCategory().getCategoryID(), title, description, links, projectNameString, fileName, filePath, String.valueOf( hint.getLineNumber()), String.valueOf(hint.getEffort())}; writeCsvRecordForProject(projectToFile, outputFolderPath, parentRootProjectModel, strings);
private Iterable<HintWithOccurence> groupHints(Iterable<InlineHintModel> hints) throws TemplateModelException { Map<String, HintWithOccurence> hintOccurences = new HashMap<>(); for(InlineHintModel hint : hints) { String hintAndId = hint.getHint() + hint.getRuleID(); if(hintOccurences.containsKey(hintAndId)) { HintWithOccurence item = hintOccurences.get(hintAndId); item.addOccurence(); } else { hintOccurences.put(hintAndId,new HintWithOccurence(hint.getHint(),hint.getRuleID(),1)); } } return hintOccurences.values(); }
if (!TagUtil.checkMatchingTags(javaInlineHint.getTags(), includeTags, excludeTags)) continue; FileLocationModel fileLocationModel = javaInlineHint.getFileLocationReference(); if (fileLocationModel == null || !(fileLocationModel instanceof JavaTypeReferenceModel))
if (checkTags && !hintModel.matchesTags(includeTags, excludeTags)) continue; if (!issueCategoryIDs.isEmpty() && !issueCategoryIDs.contains(hintModel.getIssueCategory().getCategoryID())) continue;
public IssueCategoryModel vertexToKey(Vertex effortReportVertex) { return frame(effortReportVertex).getIssueCategory(); }