diff --git a/cli_README.md b/cli_README.md new file mode 100644 index 0000000000..443f1a269a --- /dev/null +++ b/cli_README.md @@ -0,0 +1,12 @@ +Example + +```sh + +jo numberCVEOpened=0 | ./run.sh yard-impl1/src/test/resources/flightscore/cve.yml + +``` + +``` + +jo sonarCloudScore=99 | ./run.sh yard-impl1/src/test/resources/flightscore/sonarcloud.yml +``` \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000000..020f9b8641 --- /dev/null +++ b/run.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +model_file=$1 + + +# printf "Running model $1 with json: $2\n" + +java -jar yard-impl1-cli/target/yard-impl1-cli-1.0-SNAPSHOT.jar "$model_file" <<< "$(cat -)" \ No newline at end of file diff --git a/yard-impl1/src/test/resources/flightscore/cve.yml b/yard-impl1/src/test/resources/flightscore/cve.yml new file mode 100644 index 0000000000..4a0a5819ef --- /dev/null +++ b/yard-impl1/src/test/resources/flightscore/cve.yml @@ -0,0 +1,21 @@ +specVersion: alpha +kind: YaRD +name: 'CVEs' +inputs: +- name: 'numberCVEOpened' + type: integer +elements: +- name: 'CVEScore' + type: Decision + requirements: ['numberOfCVEOpened'] + logic: + type: DecisionTable + inputs: ['numberCVEOpened'] + rules: + - when: ['>=5'] + then: 0 # Bronze + - when: ['>=2'] + then: 50 # silver + - when: ['=0'] + then: 100 +--- diff --git a/yard-impl1/src/test/resources/flightscore/sonarcloud.yml b/yard-impl1/src/test/resources/flightscore/sonarcloud.yml new file mode 100644 index 0000000000..e40414f935 --- /dev/null +++ b/yard-impl1/src/test/resources/flightscore/sonarcloud.yml @@ -0,0 +1,21 @@ +specVersion: alpha +kind: YaRD +name: 'SonarCloud' +inputs: + - name: 'sonarCloudScore' + type: integer +elements: + - name: 'sonarCloudScoreScoreCard' + type: Decision + requirements: [ 'sonarCloudScore' ] + logic: + type: DecisionTable + inputs: [ 'sonarCloudScore' ] + rules: + - when: [ '>=100' ] + then: { score: 100, "explanation" : "Code is perfect" } + - when: [ '<80' ] + then: { score: 0, "explanation" : "Code is total waste" } + - when: [ '>=80' ] + then: { score: 50, "explanation" : "Code needs some work to do" } +---