This repository has been archived by the owner on May 25, 2022. It is now read-only.
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
11 changed files
with
66 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
plugins { | ||
kotlin("jvm") version "1.6.10" | ||
id("com.github.johnrengelman.shadow") version "7.0.0" | ||
kotlin("plugin.serialization") version "1.6.10" | ||
} | ||
|
||
dependencies { | ||
implementation("com.phodal.chapi:chapi-domain:1.5.6") | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2") | ||
} |
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
5 changes: 5 additions & 0 deletions
5
rule_core/src/main/kotlin/org/archguard/rule/core/RuleVisitor.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,5 @@ | ||
package org.archguard.rule.core | ||
|
||
interface RuleVisitor { | ||
|
||
} |
13 changes: 12 additions & 1 deletion
13
rule_core/src/main/kotlin/org/archguard/rule/impl/tbs/TbsRule.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,7 +1,18 @@ | ||
package org.archguard.rule.impl.tbs | ||
|
||
import chapi.domain.core.CodeDataStruct | ||
import org.archguard.rule.core.Rule | ||
|
||
open class TbsRule: Rule() { | ||
// tbs context? | ||
override fun visit(rootNode: CodeDataStruct, callback: () -> Unit) { | ||
if(this.given.isNotEmpty()) { | ||
processGivenCondition() | ||
} else { | ||
// todo: call by interface | ||
} | ||
} | ||
|
||
private fun processGivenCondition() { | ||
|
||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
rule_core/src/main/kotlin/org/archguard/rule/impl/tbs/TestSmellVisitor.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,17 @@ | ||
package org.archguard.rule.impl.tbs | ||
|
||
import chapi.domain.core.CodeDataStruct | ||
import org.archguard.rule.core.RuleSet | ||
import org.archguard.rule.core.RuleVisitor | ||
|
||
class TestSmellVisitor: RuleVisitor { | ||
internal fun visitor(ruleSets: Iterable<RuleSet>, rootNode: CodeDataStruct) { | ||
ruleSets.forEach { ruleSet -> | ||
ruleSet.rules.forEach { | ||
it.visit(rootNode) { | ||
return@visit | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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
17 changes: 0 additions & 17 deletions
17
rule_core/src/main/kotlin/org/archguard/rule/impl/tbs/rules/UnknownTestRule.kt
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
rule_core/src/main/kotlin/org/archguard/rule/ruleset/CustomRuleSetsLoader.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
17 changes: 17 additions & 0 deletions
17
rule_core/src/test/kotlin/org/archguard/rule/impl/tbs/TestSmellVisitorProviderTest.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,17 @@ | ||
package org.archguard.rule.impl.tbs | ||
|
||
import chapi.domain.core.CodeDataStruct | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class TestSmellVisitorProviderTest { | ||
@Test | ||
internal fun name() { | ||
val provider = TestSmellProvider() | ||
val visitor = TestSmellVisitor() | ||
|
||
val ds = CodeDataStruct() | ||
|
||
visitor | ||
.visitor(listOf(provider.get()), ds) | ||
} | ||
} |