add pipepline for checking lint issues

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2024-07-01 14:53:53 +05:45
parent e2ac902f2d
commit a9be2ce30b
3 changed files with 49 additions and 0 deletions

View File

@@ -272,6 +272,7 @@ def main(ctx):
test_pipelines = \
codestyle(ctx) + \
checkGherkinLint(ctx) + \
checkTestSuitesInExpectedFailures(ctx) + \
buildWebCache(ctx) + \
getGoBinForTesting(ctx) + \
@@ -732,6 +733,28 @@ def checkTestSuitesInExpectedFailures(ctx):
},
}]
def checkGherkinLint(ctx):
return [{
"kind": "pipeline",
"type": "docker",
"name": "check-gherkin-standard",
"steps": [
{
"name": "lint-feature-files",
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
"commands": [
"npm install -g @gherlint/gherlint@1.1.0",
"make test-gherkin-lint",
],
},
],
"trigger": {
"ref": [
"refs/pull/**",
],
},
}]
def codestyle(ctx):
pipelines = []

View File

@@ -112,6 +112,10 @@ help:
@echo -e "\tmake test-php-style\t\t${BLUE}run PHP code style checks${RESET}"
@echo -e "\tmake test-php-style-fix\t\t${BLUE}run PHP code style checks and fix any issues found${RESET}"
@echo
@echo -e "${GREEN}Tools for linting gherkin feature files:\n${RESET}"
@echo -e "\tmake test-gherkin-lint\t\t${BLUE}run lint checks on Gherkin feature files${RESET}"
@echo -e "\tmake test-gherkin-lint-fix\t${BLUE}apply lint fixes to gherkin feature files${RESET}"
@echo
.PHONY: clean-tests
clean-tests:
@@ -235,6 +239,14 @@ golangci-lint-fix:
$(MAKE) --no-print-directory -C $$mod golangci-lint-fix; \
done
.PHONY: test-gherkin-lint
test-gherkin-lint:
gherlint tests/acceptance/features -c tests/acceptance/config/.gherlintrc.json
.PHONY: test-gherkin-lint-fix
test-gherkin-lint-fix:
gherlint --fix tests/acceptance/features -c tests/acceptance/config/.gherlintrc.json
.PHONY: bingo-update
bingo-update: $(BINGO)
$(BINGO) get -l -v

View File

@@ -0,0 +1,14 @@
{
"rules": {
"indentation": "error",
"no_repetitive_step_keyword": "error",
"require_step": "error",
"no_trailing_whitespace": "error",
"require_scenario": "error",
"no_then_as_first_step": "error",
"only_given_step_in_background": "error",
"newline_before_scenario": ["error", 2, true],
"lowercase_title": "off",
"no_but_in_given_when": "error"
}
}