-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
code-quality/src/main/kotlin/cc/unitmesh/quality/comment/CommentAnalyser.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package cc.unitmesh.quality.comment | ||
|
||
import cc.unitmesh.quality.QualityAnalyser | ||
import chapi.domain.core.CodeContainer | ||
import chapi.domain.core.CodeDataStruct | ||
import org.archguard.rule.core.Issue | ||
|
||
class CommentAnalyser(comments: List<CodeComment>, thresholds: Map<String, Int>) : QualityAnalyser { | ||
override fun analysis(nodes: List<CodeDataStruct>): List<Issue> { | ||
class CommentAnalyser(thresholds: Map<String, Int>) : QualityAnalyser { | ||
override fun analysis(nodes: List<CodeDataStruct>): List<Issue> = listOf() | ||
|
||
override fun analysis(container: CodeContainer): List<Issue> { | ||
return listOf() | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
code-quality/src/main/kotlin/cc/unitmesh/quality/comment/CommentRuleVisitor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cc.unitmesh.quality.comment | ||
|
||
import cc.unitmesh.quality.comment.rule.CommentRule | ||
import chapi.domain.core.CodeContainer | ||
import org.archguard.rule.core.Issue | ||
import org.archguard.rule.core.RuleContext | ||
import org.archguard.rule.core.RuleSet | ||
import org.archguard.rule.core.RuleVisitor | ||
|
||
class CommentRuleVisitor(val comments: List<CodeComment>, container: CodeContainer) : RuleVisitor(comments) { | ||
override fun visitor(ruleSets: Iterable<RuleSet>): List<Issue> { | ||
val results: MutableList<Issue> = mutableListOf() | ||
val context = RuleContext() | ||
|
||
ruleSets.forEach { ruleSet -> | ||
ruleSet.rules.forEach { rule -> | ||
val apiRule = rule as CommentRule | ||
// resources.map { | ||
// apiRule.visitResource(it, context, fun(rule: Rule, position: IssuePosition) { | ||
// results += Issue( | ||
// position, | ||
// ruleId = rule.key, | ||
// name = rule.name, | ||
// detail = rule.description, | ||
// ruleType = RuleType.HTTP_API_SMELL, | ||
// fullName = "${it.packageName}:${it.className}:${it.methodName}", | ||
// source = "${it.sourceHttpMethod} ${it.sourceUrl}" | ||
// ) | ||
// }) | ||
// } | ||
} | ||
} | ||
|
||
return results | ||
} | ||
} |