Skip to content

Commit 07e3cf2

Browse files
authored
#41 Implement Modelcheck Queries to be executed from a checks-config.… (#42)
* #41 Implement Modelcheck Queries to be executed from a checks-config.json * #41 added runChecksLocal.ps1 to enable localtesting * #41 Specify custom rules * #41 Remove optional fields and add Journal check to checks-config.json
1 parent 663ca7b commit 07e3cf2

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

.github/workflows/ReviewModelCheck.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ jobs:
4747
run: |
4848
Write-Output "starting validation"
4949
if ('${{runner.os}}' -eq 'Linux') {
50-
&./LemonTree.Pipeline.Tools.ModelCheck --model "${{env.ModelName}}" --out "./output.md"
50+
&./LemonTree.Pipeline.Tools.ModelCheck --model "${{env.ModelName}}" --out "./output.md" --ChecksConfig "./checks-config.json" --NoCompact
5151
}
5252
elseif ('${{runner.os}}' -eq 'Windows') {
53-
&./LemonTree.Pipeline.Tools.ModelCheck.exe --model "${{env.ModelName}}" --out "./output.md"
53+
&./LemonTree.Pipeline.Tools.ModelCheck.exe --model "${{env.ModelName}}" --out "./output.md" --ChecksConfig "./checks-config.json" --NoCompact
5454
}
5555
else {
5656
Write-Output "${{runner.os}} is not supported"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/LieberLieber.Pipeline.Tools.PCS.Toggle.exe
2+
/output.md
3+
/LemonTree.Pipeline.Tools.ModelCheck.exe

checks-config.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"checks": [
3+
{
4+
"id": "Unsatisfied Requirements",
5+
"query": "select count (*) from t_object where object_id not in ( select o.object_id from t_object o inner join t_connector c on o.object_id = c.end_object_id where o.object_type = 'requirement' and c.stereotype = 'satisfy' ) and object_type = 'requirement'",
6+
"passedTitle": "There are no unsatisfied requirements",
7+
"failedTitle": "Model has {count} unsatisfied requirements",
8+
"failedDetail": "Each requirement should be linked to at least one design element using a 'satisfy' relationship."
9+
},
10+
{
11+
"id": "Ports without Interface Defintion",
12+
"query": "select count(*) from t_object where object_type = 'Port' and t_object.PDATA1 is NULL",
13+
"passedTitle": "There are no ports without interface definition",
14+
"failedTitle": "Model has {count} ports without interface definition",
15+
"failedDetail": "All ports should have an interface definition assigned.",
16+
"failedLevel": "Warning"
17+
},
18+
{
19+
"id": "Orphaned InterfaceBlocks",
20+
"query": "select count(*) from t_object where stereotype = 'InterfaceBlock' and ea_guid not in (select pdata1 from t_object where object_type = 'Port')",
21+
"passedTitle": "There are no orphaned InterfaceBlocks",
22+
"failedTitle": "Model has {count} orphaned InterfaceBlocks",
23+
"failedDetail": "There shouldn't be orphaned InterfaceBlocks."
24+
},
25+
{
26+
"id": "Journal",
27+
"query": "Select Count(*) from t_document where t_document.DocType = \"JEntry\"",
28+
"passedTitle": "No Journal entries in the model",
29+
"failedTitle": "Model has {count} Journal Entries",
30+
"failedDetail": "Journal entries are not merged by LemonTree."
31+
}
32+
]
33+
}

runChecksLocal.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#rough script for testing - no checks no nothing
2+
if (-not (Test-Path .\LemonTree.Pipeline.Tools.ModelCheck.exe)) {
3+
Invoke-WebRequest -URI "https://nexus.lieberlieber.com/repository/lemontree-pipeline-tools/LemonTree.Pipeline.Tools.ModelCheck.exe" -OutFile ./LemonTree.Pipeline.Tools.ModelCheck.exe
4+
}
5+
& .\LemonTree.Pipeline.Tools.ModelCheck.exe --model "./LemonTree.DevOps.Demo.qeax" --out ".\output.md" --ChecksConfig ".\checks-config.json" --NoCompact

0 commit comments

Comments
 (0)