Directory toPackage = (Directory) feedbackEdge.getTo();
DirectoryEdge edge = packagesGraph.getEdge(fromPackage, toPackage);
for (FileEdge subEdge : edge.getRootEdges()) {
Resource fromFile = subEdge.getFrom();
Resource toFile = subEdge.getTo();
Issuable issuable = perspectives.as(Issuable.class, fromFile);
// If resource cannot be obtained, then silently ignore, because anyway warning will be printed by method addFile
if ((issuable != null) && (fromFile != null) && (toFile != null)) {
Issue issue = issuable.newIssueBuilder()
.ruleKey(cycleBetweenPackagesRule.getRule().ruleKey())
.line(subEdge.getLine())
.message("Remove the dependency from file \"" + fromFile.getLongName()
+ "\" to file \"" + toFile.getLongName() + "\" to break a package cycle.")
.effortToFix((double) subEdge.getWeight())
.build();
if (issuable.addIssue(issue))
violationsCount++;
}
}
}
}