Skip to content

Commit d92f336

Browse files
adding flag for error on warning (super-linter#2397)
* adding flag for error on warning * remove bug
1 parent d36ab65 commit d92f336

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ But if you wish to select or exclude specific linters, we give you full control
399399
| **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the XML language. |
400400
| **VALIDATE_YAML** | `true` | Flag to enable or disable the linting process of the YAML language. |
401401
| **YAML_CONFIG_FILE** | `.yaml-lint.yml` | Filename for [Yamllint configuration](https://yamllint.readthedocs.io/en/stable/configuration.html) (ex: `.yaml-lint.yml`, `.yamllint.yml`) |
402+
| **YAML_ERROR_ON_WARNING** | `false` | Flag to enable or disable the error on warning for Yamllint. |
402403

403404
### Template rules files
404405

lib/linter.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ TYPESCRIPT_STANDARD_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}"
193193
USE_FIND_ALGORITHM="${USE_FIND_ALGORITHM:-false}"
194194
# shellcheck disable=SC2034 # Variable is referenced indirectly
195195
YAML_FILE_NAME="${YAML_CONFIG_FILE:-.yaml-lint.yml}"
196+
# shellcheck disable=SC2034 # Variable is referenced indirectly
197+
YAML_ERROR_ON_WARNING="${YAML_ERROR_ON_WARNING:-false}"
196198

197199
#################################################
198200
# Parse if we are using JS standard or prettier #
@@ -941,7 +943,11 @@ LINTER_COMMANDS_ARRAY['TYPESCRIPT_ES']="eslint --no-eslintrc -c ${TYPESCRIPT_ES_
941943
LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}"
942944
LINTER_COMMANDS_ARRAY['TYPESCRIPT_PRETTIER']="prettier --check"
943945
LINTER_COMMANDS_ARRAY['XML']="xmllint"
944-
LINTER_COMMANDS_ARRAY['YAML']="yamllint --strict -c ${YAML_LINTER_RULES} -f parsable"
946+
if [ "${YAML_ERROR_ON_WARNING}" == 'false' ]; then
947+
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES} -f parsable"
948+
else
949+
LINTER_COMMANDS_ARRAY['YAML']="yamllint --strict -c ${YAML_LINTER_RULES} -f parsable"
950+
fi
945951

946952
debug "--- Linter commands ---"
947953
debug "-----------------------"

0 commit comments

Comments
 (0)