mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-29 01:21:05 -05:00
Merge pull request #440 from github/Multi-status
adding abillity to have multi status api checks for visibility
This commit is contained in:
commit
67a7ebd5d7
5 changed files with 279 additions and 131 deletions
|
@ -73,6 +73,8 @@ To use this **GitHub** Action you will need to complete the following:
|
||||||
5. Enjoy your more *stable*, and *cleaner* code base
|
5. Enjoy your more *stable*, and *cleaner* code base
|
||||||
6. Check out the [Wiki](https://github.com/github/super-linter/wiki) for customization options
|
6. Check out the [Wiki](https://github.com/github/super-linter/wiki) for customization options
|
||||||
|
|
||||||
|
**NOTE:** You will need the *Environment* variable `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}` set in your workflow file to be able to use the multiple status API returns. There is no need to set the **GitHub** Secret, it only needs to be passed.
|
||||||
|
|
||||||
### Example connecting GitHub Action Workflow
|
### Example connecting GitHub Action Workflow
|
||||||
In your repository you should have a `.github/workflows` folder with **GitHub** Action similar to below:
|
In your repository you should have a `.github/workflows` folder with **GitHub** Action similar to below:
|
||||||
|
|
||||||
|
@ -132,6 +134,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
VALIDATE_ALL_CODEBASE: false
|
VALIDATE_ALL_CODEBASE: false
|
||||||
DEFAULT_BRANCH: master
|
DEFAULT_BRANCH: master
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
@ -197,7 +200,7 @@ and won't run anything unexpected.
|
||||||
| **OUTPUT_FORMAT** | `none` | The report format to be generated, besides the stdout one. Output format of tap is currently using v13 of the specification. Supported formats: tap |
|
| **OUTPUT_FORMAT** | `none` | The report format to be generated, besides the stdout one. Output format of tap is currently using v13 of the specification. Supported formats: tap |
|
||||||
| **OUTPUT_FOLDER** | `super-linter.report` | The location where the output reporting will be generated to. Output folder must not previously exist. |
|
| **OUTPUT_FOLDER** | `super-linter.report` | The location where the output reporting will be generated to. Output folder must not previously exist. |
|
||||||
| **OUTPUT_DETAILS** | `simpler` | What level of details to be reported. Supported formats: simpler or detailed. |
|
| **OUTPUT_DETAILS** | `simpler` | What level of details to be reported. Supported formats: simpler or detailed. |
|
||||||
|
| **MULTI_STATUS** | `true` | A status API is made for each language that is linted to make visual parsing easier. |
|
||||||
|
|
||||||
### Template rules files
|
### Template rules files
|
||||||
You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level.
|
You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level.
|
||||||
|
|
|
@ -183,7 +183,7 @@ function BuildFileList() {
|
||||||
################################
|
################################
|
||||||
# Append the file to the array #
|
# Append the file to the array #
|
||||||
################################
|
################################
|
||||||
FILE_ARRAY_MD+=("$FILE")
|
FILE_ARRAY_MARKDOWN+=("$FILE")
|
||||||
######################
|
######################
|
||||||
# Get the BASH files #
|
# Get the BASH files #
|
||||||
######################
|
######################
|
||||||
|
|
316
lib/linter.sh
316
lib/linter.sh
|
@ -28,8 +28,8 @@ LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter
|
||||||
YAML_FILE_NAME='.yaml-lint.yml' # Name of the file
|
YAML_FILE_NAME='.yaml-lint.yml' # Name of the file
|
||||||
YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules
|
YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules
|
||||||
# MD Vars
|
# MD Vars
|
||||||
MD_FILE_NAME='.markdown-lint.yml' # Name of the file
|
MARKDOWN_FILE_NAME='.markdown-lint.yml' # Name of the file
|
||||||
MD_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MD_FILE_NAME" # Path to the markdown lint rules
|
MARKDOWN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MARKDOWN_FILE_NAME" # Path to the markdown lint rules
|
||||||
# Python Vars
|
# Python Vars
|
||||||
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
PYTHON_FILE_NAME='.python-lint' # Name of the file
|
||||||
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules
|
||||||
|
@ -99,11 +99,16 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
|
||||||
#############################
|
#############################
|
||||||
# Language array for prints #
|
# Language array for prints #
|
||||||
#############################
|
#############################
|
||||||
LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RAKU' 'PHP' 'RUBY' 'PYTHON'
|
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT'
|
||||||
'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' 'JSX' 'TSX'
|
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML'
|
||||||
'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM'
|
'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'OPENAPI'
|
||||||
'CSS' 'ENV' 'POWERSHELL' 'ARM' 'KOTLIN' 'PROTOBUF' 'CLOJURE' 'OPENAPI'
|
'MARKDOWN' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'RAKU' 'RUBY'
|
||||||
'CFN' 'DART' 'HTML')
|
'TERRAFORM' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YML' )
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Array for all languages that were linted #
|
||||||
|
############################################
|
||||||
|
LINTED_LANGUAGES_ARRAY=() # Will be filled at run time with all languages that were linted
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# GitHub ENV Vars #
|
# GitHub ENV Vars #
|
||||||
|
@ -111,43 +116,47 @@ LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RAKU' 'PHP' 'RUBY'
|
||||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||||
|
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
||||||
|
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
||||||
|
GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs
|
||||||
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
||||||
|
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
|
||||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
||||||
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
|
||||||
VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language
|
|
||||||
VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language
|
|
||||||
VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language
|
|
||||||
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
|
|
||||||
VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language
|
|
||||||
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
|
||||||
VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language
|
|
||||||
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
|
|
||||||
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
|
|
||||||
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
|
||||||
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
|
|
||||||
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
|
||||||
|
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
||||||
|
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
|
||||||
|
VALIDATE_CFN="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
|
||||||
|
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
||||||
|
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
|
||||||
|
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
||||||
|
VALIDATE_DART="${VALIDATE_DART}" # Boolean to validate language
|
||||||
|
VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language
|
||||||
|
VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG}" # Boolean to validate files with editorconfig
|
||||||
|
VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language
|
||||||
|
VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language
|
||||||
|
VALIDATE_HTML="${VALIDATE_HTML}" # Boolean to validate language
|
||||||
VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language
|
VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language
|
||||||
VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language
|
VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language
|
||||||
VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate jsx files
|
VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language
|
||||||
VALIDATE_TSX="${VALIDATE_TSX}" # Boolean to validate tsx files
|
VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language
|
||||||
|
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
||||||
|
VALIDATE_MARKDOWN="${VALIDATE_MD:-}" # Boolean to validate language
|
||||||
|
VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language
|
||||||
|
VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language
|
||||||
|
VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language
|
||||||
|
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language
|
||||||
|
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
|
||||||
|
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
||||||
|
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
||||||
|
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||||
|
VALIDATE_TSX="${VALIDATE_TSX}" # Boolean to validate language
|
||||||
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language
|
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language
|
||||||
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language
|
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language
|
||||||
VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language
|
VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language
|
||||||
VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language
|
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
||||||
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
|
||||||
VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language
|
|
||||||
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
|
||||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
|
||||||
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language
|
|
||||||
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
|
|
||||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
|
||||||
VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language
|
|
||||||
VALIDATE_DART="${VALIDATE_DART}" # Boolean to validate language
|
|
||||||
VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG}" # Boolean to validate files with editorconfig
|
|
||||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||||
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
||||||
VALIDATE_HTML="${VALIDATE_HTML}" # Boolean to validate language
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Debug Vars #
|
# Debug Vars #
|
||||||
|
@ -191,73 +200,73 @@ REPORT_OUTPUT_FOLDER="${DEFAULT_WORKSPACE}/${OUTPUT_FOLDER}"
|
||||||
##########################
|
##########################
|
||||||
# Array of changed files #
|
# Array of changed files #
|
||||||
##########################
|
##########################
|
||||||
FILE_ARRAY_YML=() # Array of files to check
|
FILE_ARRAY_ARM=() # Array of files to check
|
||||||
FILE_ARRAY_JSON=() # Array of files to check
|
|
||||||
FILE_ARRAY_XML=() # Array of files to check
|
|
||||||
FILE_ARRAY_MD=() # Array of files to check
|
|
||||||
FILE_ARRAY_BASH=() # Array of files to check
|
FILE_ARRAY_BASH=() # Array of files to check
|
||||||
FILE_ARRAY_PERL=() # Array of files to check
|
|
||||||
FILE_ARRAY_RAKU=() # Array of files to check
|
|
||||||
FILE_ARRAY_PHP=() # Array of files to check
|
|
||||||
FILE_ARRAY_RUBY=() # Array of files to check
|
|
||||||
FILE_ARRAY_PYTHON=() # Array of files to check
|
|
||||||
FILE_ARRAY_CFN=() # Array of files to check
|
FILE_ARRAY_CFN=() # Array of files to check
|
||||||
|
FILE_ARRAY_CLOJURE=() # Array of files to check
|
||||||
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
|
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
|
||||||
|
FILE_ARRAY_CSS=() # Array of files to check
|
||||||
|
FILE_ARRAY_DART=() # Array of files to check
|
||||||
|
FILE_ARRAY_DOCKER=() # Array of files to check
|
||||||
|
FILE_ARRAY_ENV=() # Array of files to check
|
||||||
|
FILE_ARRAY_GO=() # Array of files to check
|
||||||
|
FILE_ARRAY_HTML=() # Array of files to check
|
||||||
FILE_ARRAY_JAVASCRIPT_ES=() # Array of files to check
|
FILE_ARRAY_JAVASCRIPT_ES=() # Array of files to check
|
||||||
FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check
|
FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check
|
||||||
|
FILE_ARRAY_JSON=() # Array of files to check
|
||||||
FILE_ARRAY_JSX=() # Array of files to check
|
FILE_ARRAY_JSX=() # Array of files to check
|
||||||
|
FILE_ARRAY_KOTLIN=() # Array of files to check
|
||||||
|
FILE_ARRAY_MARKDOWN=() # Array of files to check
|
||||||
|
FILE_ARRAY_OPENAPI=() # Array of files to check
|
||||||
|
FILE_ARRAY_PERL=() # Array of files to check
|
||||||
|
FILE_ARRAY_PHP=() # Array of files to check
|
||||||
|
FILE_ARRAY_POWERSHELL=() # Array of files to check
|
||||||
|
FILE_ARRAY_PROTOBUF=() # Array of files to check
|
||||||
|
FILE_ARRAY_PYTHON=() # Array of files to check
|
||||||
|
FILE_ARRAY_RAKU=() # Array of files to check
|
||||||
|
FILE_ARRAY_RUBY=() # Array of files to check
|
||||||
|
FILE_ARRAY_TERRAFORM=() # Array of files to check
|
||||||
FILE_ARRAY_TSX=() # Array of files to check
|
FILE_ARRAY_TSX=() # Array of files to check
|
||||||
FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check
|
FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check
|
||||||
FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check
|
FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check
|
||||||
FILE_ARRAY_DOCKER=() # Array of files to check
|
FILE_ARRAY_XML=() # Array of files to check
|
||||||
FILE_ARRAY_GO=() # Array of files to check
|
FILE_ARRAY_YML=() # Array of files to check
|
||||||
FILE_ARRAY_TERRAFORM=() # Array of files to check
|
|
||||||
FILE_ARRAY_POWERSHELL=() # Array of files to check
|
|
||||||
FILE_ARRAY_ARM=() # Array of files to check
|
|
||||||
FILE_ARRAY_CSS=() # Array of files to check
|
|
||||||
FILE_ARRAY_ENV=() # Array of files to check
|
|
||||||
FILE_ARRAY_CLOJURE=() # Array of files to check
|
|
||||||
FILE_ARRAY_KOTLIN=() # Array of files to check
|
|
||||||
FILE_ARRAY_PROTOBUF=() # Array of files to check
|
|
||||||
FILE_ARRAY_OPENAPI=() # Array of files to check
|
|
||||||
FILE_ARRAY_DART=() # Array of files to check
|
|
||||||
FILE_ARRAY_HTML=() # Array of files to check
|
|
||||||
|
|
||||||
############
|
############
|
||||||
# Counters #
|
# Counters #
|
||||||
############
|
############
|
||||||
ERRORS_FOUND_YML=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_JSON=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_XML=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_BASH=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_PERL=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_RAKU=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_PHP=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_CFN=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
ERRORS_FOUND_ANSIBLE=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_ARM=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_BASH=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_CFN=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_CSS=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_DART=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_DOCKER=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_ENV=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_GO=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_HTML=0 # Count of errors found
|
||||||
ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found
|
ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found
|
||||||
ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found
|
ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_JSON=0 # Count of errors found
|
||||||
ERRORS_FOUND_JSX=0 # Count of errors found
|
ERRORS_FOUND_JSX=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_PERL=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_PHP=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_RAKU=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||||
|
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
||||||
ERRORS_FOUND_TSX=0 # Count of errors found
|
ERRORS_FOUND_TSX=0 # Count of errors found
|
||||||
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found
|
||||||
ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
|
ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found
|
||||||
ERRORS_FOUND_DOCKER=0 # Count of errors found
|
ERRORS_FOUND_XML=0 # Count of errors found
|
||||||
ERRORS_FOUND_GO=0 # Count of errors found
|
ERRORS_FOUND_YML=0 # Count of errors found
|
||||||
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_ARM=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_CSS=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_ENV=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_DART=0 # Count of errors found
|
|
||||||
ERRORS_FOUND_HTML=0 # Count of errors found
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
########################## FUNCTIONS BELOW #####################################
|
########################## FUNCTIONS BELOW #####################################
|
||||||
|
@ -588,7 +597,7 @@ GetGitHubVars() {
|
||||||
###############################
|
###############################
|
||||||
# Convert string to lowercase #
|
# Convert string to lowercase #
|
||||||
###############################
|
###############################
|
||||||
TEST_CASE_RUN=$(echo "$TEST_CASE_RUN" | awk '{print tolower($0)}')
|
TEST_CASE_RUN="${TEST_CASE_RUN,,}"
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Get the run local flag #
|
# Get the run local flag #
|
||||||
|
@ -603,7 +612,7 @@ GetGitHubVars() {
|
||||||
###############################
|
###############################
|
||||||
# Convert string to lowercase #
|
# Convert string to lowercase #
|
||||||
###############################
|
###############################
|
||||||
RUN_LOCAL=$(echo "$RUN_LOCAL" | awk '{print tolower($0)}')
|
RUN_LOCAL="${RUN_LOCAL,,}"
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Check if were running locally #
|
# Check if were running locally #
|
||||||
|
@ -708,6 +717,54 @@ GetGitHubVars() {
|
||||||
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[$GITHUB_REPO]${NC}"
|
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[$GITHUB_REPO]${NC}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_TOKEN" ]; then
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_TOKEN]!${NC}"
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_TOKEN]${NC}"
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Please set a [GITHUB_TOKEN] from the main workflow environment to take advantage of multiple status reports!${NC}"
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Need to set MULTI_STATUS to false as we cant hit API endpoints without token #
|
||||||
|
################################################################################
|
||||||
|
MULTI_STATUS='false'
|
||||||
|
else
|
||||||
|
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_TOKEN]${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Convert string to lowercase #
|
||||||
|
###############################
|
||||||
|
MULTI_STATUS="${MULTI_STATUS,,}"
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# Check to see if the multi status is set, and we have a token to use #
|
||||||
|
#######################################################################
|
||||||
|
if [ "$MULTI_STATUS" == "true" ] && [ -n "$GITHUB_TOKEN" ]; then
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_REPOSITORY" ]; then
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_REPOSITORY]!${NC}"
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_REPOSITORY]${NC}"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPOSITORY]${F[B]}, value:${F[W]}[$GITHUB_REPOSITORY]${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Validate we have a value #
|
||||||
|
############################
|
||||||
|
if [ -z "$GITHUB_RUN_ID" ]; then
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_RUN_ID]!${NC}"
|
||||||
|
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_RUN_ID]${NC}"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_RUN_ID]${F[B]}, value:${F[W]}[$GITHUB_RUN_ID]${NC}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Function ValidatePowershellModules ########################################
|
#### Function ValidatePowershellModules ########################################
|
||||||
|
@ -751,6 +808,62 @@ function ValidatePowershellModules() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
|
#### Function CallStatusAPI ####################################################
|
||||||
|
CallStatusAPI() {
|
||||||
|
####################
|
||||||
|
# Pull in the vars #
|
||||||
|
####################
|
||||||
|
LANGUAGE="$1" # langauge that was validated
|
||||||
|
STATUS="$2" # success | error
|
||||||
|
SUCCESS_MSG='No errors were found in the linting process'
|
||||||
|
FAIL_MSG='Errors were detected, please view logs'
|
||||||
|
MESSAGE='' # Message to send to status API
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# Check the status to create message #
|
||||||
|
######################################
|
||||||
|
if [ "$STATUS" == "success" ]; then
|
||||||
|
# Success
|
||||||
|
MESSAGE="$SUCCESS_MSG"
|
||||||
|
else
|
||||||
|
# Failure
|
||||||
|
MESSAGE="$FAIL_MSG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
# Check to see if were enabled for multi Status mesaages #
|
||||||
|
##########################################################
|
||||||
|
if [ "$MULTI_STATUS" == "true" ]; then
|
||||||
|
##############################################
|
||||||
|
# Call the status API to create status check #
|
||||||
|
##############################################
|
||||||
|
SEND_STATUS_CMD=$(curl -f -s -X POST \
|
||||||
|
--url "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \
|
||||||
|
-H 'accept: application/vnd.github.v3+json' \
|
||||||
|
-H "authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
-H 'content-type: application/json' \
|
||||||
|
-d "{ \"state\": \"$STATUS\",
|
||||||
|
\"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\",
|
||||||
|
\"description\": \"$MESSAGE\", \"context\": \"--> Linted: $LANGUAGE\"
|
||||||
|
}" 2>&1)
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Load the error code #
|
||||||
|
#######################
|
||||||
|
ERROR_CODE=$?
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Check the shell for errors #
|
||||||
|
##############################
|
||||||
|
if [ "$ERROR_CODE" -ne 0 ]; then
|
||||||
|
# ERROR
|
||||||
|
echo "ERROR! Failed to call GitHub Status API!"
|
||||||
|
echo "ERROR:[$SEND_STATUS_CMD]"
|
||||||
|
# Not going to fail the script on this yet...
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
################################################################################
|
||||||
#### Function Footer ###########################################################
|
#### Function Footer ###########################################################
|
||||||
Footer() {
|
Footer() {
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -768,6 +881,11 @@ Footer() {
|
||||||
echo "Reports generated in folder ${REPORT_OUTPUT_FOLDER}"
|
echo "Reports generated in folder ${REPORT_OUTPUT_FOLDER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# Need to clean up the lanuage array of duplicates #
|
||||||
|
####################################################
|
||||||
|
mapfile -t UNIQUE_LINTED_ARRAY < <(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
# Prints for errors if found #
|
# Prints for errors if found #
|
||||||
##############################
|
##############################
|
||||||
|
@ -781,8 +899,24 @@ Footer() {
|
||||||
# Print if not 0 #
|
# Print if not 0 #
|
||||||
##################
|
##################
|
||||||
if [ "${!ERROR_COUNTER}" -ne 0 ]; then
|
if [ "${!ERROR_COUNTER}" -ne 0 ]; then
|
||||||
# Print the goods
|
# We found errors in the language
|
||||||
|
###################
|
||||||
|
# Print the goods #
|
||||||
|
###################
|
||||||
echo -e "${NC}${B[R]}${F[W]}ERRORS FOUND${NC} in $LANGUAGE:[${!ERROR_COUNTER}]${NC}"
|
echo -e "${NC}${B[R]}${F[W]}ERRORS FOUND${NC} in $LANGUAGE:[${!ERROR_COUNTER}]${NC}"
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
# Create status API for Failed language #
|
||||||
|
#########################################
|
||||||
|
CallStatusAPI "$LANGUAGE" "error"
|
||||||
|
else
|
||||||
|
# No errors found when linting the language
|
||||||
|
######################################
|
||||||
|
# Check if we validated the langauge #
|
||||||
|
######################################
|
||||||
|
if [[ "${UNIQUE_LINTED_ARRAY[*]}" =~ ${LANGUAGE} ]]; then
|
||||||
|
CallStatusAPI "$LANGUAGE" "success"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -888,7 +1022,7 @@ GetValidationInfo
|
||||||
# Get YML rules
|
# Get YML rules
|
||||||
GetLinterRules "YAML"
|
GetLinterRules "YAML"
|
||||||
# Get Markdown rules
|
# Get Markdown rules
|
||||||
GetLinterRules "MD"
|
GetLinterRules "MARKDOWN"
|
||||||
# Get Python rules
|
# Get Python rules
|
||||||
GetLinterRules "PYTHON"
|
GetLinterRules "PYTHON"
|
||||||
# Get Ruby rules
|
# Get Ruby rules
|
||||||
|
@ -934,6 +1068,12 @@ fi
|
||||||
# Check to see if this is a test case run #
|
# Check to see if this is a test case run #
|
||||||
###########################################
|
###########################################
|
||||||
if [[ $TEST_CASE_RUN != "false" ]]; then
|
if [[ $TEST_CASE_RUN != "false" ]]; then
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
# Set the multi status to off for test runs #
|
||||||
|
#############################################
|
||||||
|
MULTI_STATUS='false'
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Run only the test cases #
|
# Run only the test cases #
|
||||||
###########################
|
###########################
|
||||||
|
@ -987,12 +1127,12 @@ fi
|
||||||
####################
|
####################
|
||||||
# MARKDOWN LINTING #
|
# MARKDOWN LINTING #
|
||||||
####################
|
####################
|
||||||
if [ "$VALIDATE_MD" == "true" ]; then
|
if [ "$VALIDATE_MARKDOWN" == "true" ]; then
|
||||||
###########################
|
###########################
|
||||||
# Lint the Markdown Files #
|
# Lint the Markdown Files #
|
||||||
###########################
|
###########################
|
||||||
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
||||||
LintCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MD_LINTER_RULES" ".*\.\(md\)\$" "${FILE_ARRAY_MD[@]}"
|
LintCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MARKDOWN_LINTER_RULES" ".*\.\(md\)\$" "${FILE_ARRAY_MARKDOWN[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################
|
################
|
||||||
|
@ -1020,7 +1160,7 @@ fi
|
||||||
###############
|
###############
|
||||||
# CFN LINTING #
|
# CFN LINTING #
|
||||||
###############
|
###############
|
||||||
if [ "$VALIDATE_CLOUDFORMATION" == "true" ]; then
|
if [ "$VALIDATE_CFN" == "true" ]; then
|
||||||
#################################
|
#################################
|
||||||
# Lint the CloudFormation files #
|
# Lint the CloudFormation files #
|
||||||
#################################
|
#################################
|
||||||
|
|
|
@ -24,7 +24,7 @@ function GetValidationInfo() {
|
||||||
###############################
|
###############################
|
||||||
# Convert string to lowercase #
|
# Convert string to lowercase #
|
||||||
###############################
|
###############################
|
||||||
VALIDATE_ALL_CODEBASE=$(echo "$VALIDATE_ALL_CODEBASE" | awk '{print tolower($0)}')
|
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE,,}"
|
||||||
######################################
|
######################################
|
||||||
# Validate we should check all files #
|
# Validate we should check all files #
|
||||||
######################################
|
######################################
|
||||||
|
@ -46,38 +46,38 @@ function GetValidationInfo() {
|
||||||
################################
|
################################
|
||||||
# Convert strings to lowercase #
|
# Convert strings to lowercase #
|
||||||
################################
|
################################
|
||||||
VALIDATE_YAML=$(echo "$VALIDATE_YAML" | awk '{print tolower($0)}')
|
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE,,}"
|
||||||
VALIDATE_JSON=$(echo "$VALIDATE_JSON" | awk '{print tolower($0)}')
|
VALIDATE_ARM="${VALIDATE_ARM,,}"
|
||||||
VALIDATE_XML=$(echo "$VALIDATE_XML" | awk '{print tolower($0)}')
|
VALIDATE_BASH="${VALIDATE_BASH,,}"
|
||||||
VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}')
|
VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}"
|
||||||
VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}')
|
VALIDATE_COFFEE="${VALIDATE_COFFEE,,}"
|
||||||
VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}')
|
VALIDATE_CSS="${VALIDATE_CSS,,}"
|
||||||
VALIDATE_RAKU=$(echo "$VALIDATE_RAKU" | awk '{print tolower($0)}')
|
VALIDATE_DART="${VALIDATE_DART,,}"
|
||||||
VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}')
|
VALIDATE_DOCKER="${VALIDATE_DOCKER,,}"
|
||||||
VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}')
|
VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG,,}"
|
||||||
VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}')
|
VALIDATE_ENV="${VALIDATE_ENV,,}"
|
||||||
VALIDATE_COFFEE=$(echo "$VALIDATE_COFFEE" | awk '{print tolower($0)}')
|
VALIDATE_GO="${VALIDATE_GO,,}"
|
||||||
VALIDATE_ANSIBLE=$(echo "$VALIDATE_ANSIBLE" | awk '{print tolower($0)}')
|
VALIDATE_HTML="${VALIDATE_HTML,,}"
|
||||||
VALIDATE_JAVASCRIPT_ES=$(echo "$VALIDATE_JAVASCRIPT_ES" | awk '{print tolower($0)}')
|
VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES,,}"
|
||||||
VALIDATE_JAVASCRIPT_STANDARD=$(echo "$VALIDATE_JAVASCRIPT_STANDARD" | awk '{print tolower($0)}')
|
VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD,,}"
|
||||||
VALIDATE_JSX=$(echo "$VALIDATE_JSX" | awk '{print tolower($0)}')
|
VALIDATE_JSON="${VALIDATE_JSON,,}"
|
||||||
VALIDATE_TSX=$(echo "$VALIDATE_TSX" | awk '{print tolower($0)}')
|
VALIDATE_JSX="${VALIDATE_JSX,,}"
|
||||||
VALIDATE_TYPESCRIPT_ES=$(echo "$VALIDATE_TYPESCRIPT_ES" | awk '{print tolower($0)}')
|
VALIDATE_KOTLIN="${VALIDATE_KOTLIN,,}"
|
||||||
VALIDATE_TYPESCRIPT_STANDARD=$(echo "$VALIDATE_TYPESCRIPT_STANDARD" | awk '{print tolower($0)}')
|
VALIDATE_MARKDOWN="${VALIDATE_MARKDOWN,,}"
|
||||||
VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}')
|
VALIDATE_OPENAPI="${VALIDATE_OPENAPI,,}"
|
||||||
VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}')
|
VALIDATE_PERL="${VALIDATE_PERL,,}"
|
||||||
VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}')
|
VALIDATE_PHP="${VALIDATE_PHP,,}"
|
||||||
VALIDATE_POWERSHELL=$(echo "$VALIDATE_POWERSHELL" | awk '{print tolower($0)}')
|
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL,,}"
|
||||||
VALIDATE_ARM=$(echo "$VALIDATE_ARM" | awk '{print tolower($0)}')
|
VALIDATE_PROTOBUF="${VALIDATE_PROTOBUF,,}"
|
||||||
VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}')
|
VALIDATE_PYTHON="${VALIDATE_PYTHON,,}"
|
||||||
VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}')
|
VALIDATE_RAKU="${VALIDATE_RAKU,,}"
|
||||||
VALIDATE_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)}')
|
VALIDATE_RUBY="${VALIDATE_RUBY,,}"
|
||||||
VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}')
|
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM,,}"
|
||||||
VALIDATE_PROTOBUF=$(echo "$VALIDATE_PROTOBUF" | awk '{print tolower($0)}')
|
VALIDATE_TSX="${VALIDATE_TSX,,}"
|
||||||
VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}')
|
VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES,,}"
|
||||||
VALIDATE_EDITORCONFIG=$(echo "$VALIDATE_EDITORCONFIG" | awk '{print tolower($0)}')
|
VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD,,}"
|
||||||
VALIDATE_DART=$(echo "$VALIDATE_DART" | awk '{print tolower($0)}')
|
VALIDATE_YAML="${VALIDATE_YAML,,}"
|
||||||
VALIDATE_HTML=$(echo "$VALIDATE_HTML" | awk '{print tolower($0)}')
|
VALIDATE_XML="${VALIDATE_XML,,}"
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Determine if any linters were explicitly set #
|
# Determine if any linters were explicitly set #
|
||||||
|
@ -86,7 +86,7 @@ function GetValidationInfo() {
|
||||||
if [[ -n $VALIDATE_YAML || -n \
|
if [[ -n $VALIDATE_YAML || -n \
|
||||||
$VALIDATE_JSON || -n \
|
$VALIDATE_JSON || -n \
|
||||||
$VALIDATE_XML || -n \
|
$VALIDATE_XML || -n \
|
||||||
$VALIDATE_MD || -n \
|
$VALIDATE_MARKDOWN || -n \
|
||||||
$VALIDATE_BASH || -n \
|
$VALIDATE_BASH || -n \
|
||||||
$VALIDATE_PERL || -n \
|
$VALIDATE_PERL || -n \
|
||||||
$VALIDATE_RAKU || -n \
|
$VALIDATE_RAKU || -n \
|
||||||
|
@ -163,13 +163,13 @@ function GetValidationInfo() {
|
||||||
########################################
|
########################################
|
||||||
if [[ $ANY_SET == "true" ]]; then
|
if [[ $ANY_SET == "true" ]]; then
|
||||||
# Some linter flags were set - only run those set to true
|
# Some linter flags were set - only run those set to true
|
||||||
if [[ -z $VALIDATE_MD ]]; then
|
if [[ -z $VALIDATE_MARKDOWN ]]; then
|
||||||
# MD flag was not set - default to false
|
# MD flag was not set - default to false
|
||||||
VALIDATE_MD="false"
|
VALIDATE_MARKDOWN="false"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# No linter flags were set - default all to true
|
# No linter flags were set - default all to true
|
||||||
VALIDATE_MD="true"
|
VALIDATE_MARKDOWN="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
|
@ -585,7 +585,7 @@ function GetValidationInfo() {
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [XML] files in code base...")
|
PRINT_ARRAY+=("- Excluding [XML] files in code base...")
|
||||||
fi
|
fi
|
||||||
if [[ $VALIDATE_MD == "true" ]]; then
|
if [[ $VALIDATE_MARKDOWN == "true" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
|
PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...")
|
||||||
else
|
else
|
||||||
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
|
PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...")
|
||||||
|
@ -752,7 +752,7 @@ function GetValidationInfo() {
|
||||||
###############################
|
###############################
|
||||||
# Convert string to lowercase #
|
# Convert string to lowercase #
|
||||||
###############################
|
###############################
|
||||||
DISABLE_ERRORS=$(echo "$DISABLE_ERRORS" | awk '{print tolower($0)}')
|
DISABLE_ERRORS="${DISABLE_ERRORS,,}"
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Set to false if not true #
|
# Set to false if not true #
|
||||||
|
@ -774,7 +774,7 @@ function GetValidationInfo() {
|
||||||
###############################
|
###############################
|
||||||
# Convert string to lowercase #
|
# Convert string to lowercase #
|
||||||
###############################
|
###############################
|
||||||
ACTIONS_RUNNER_DEBUG=$(echo "$ACTIONS_RUNNER_DEBUG" | awk '{print tolower($0)}')
|
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG,,}"
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Set to true if not false #
|
# Set to true if not false #
|
||||||
|
|
|
@ -168,6 +168,11 @@ function LintCodebase() {
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
echo "File:[$FILE]"
|
echo "File:[$FILE]"
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# Add the language to the array #
|
||||||
|
#################################
|
||||||
|
LINTED_LANGUAGES_ARRAY+=("$FILE_TYPE")
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Set the base Var #
|
# Set the base Var #
|
||||||
####################
|
####################
|
||||||
|
@ -564,7 +569,7 @@ function RunTestCases() {
|
||||||
TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard $JAVASCRIPT_STANDARD_LINTER_RULES" ".*\.\(js\)\$" "javascript"
|
TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard $JAVASCRIPT_STANDARD_LINTER_RULES" ".*\.\(js\)\$" "javascript"
|
||||||
TestCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "json"
|
TestCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "json"
|
||||||
TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin"
|
TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin"
|
||||||
TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MD_LINTER_RULES" ".*\.\(md\)\$" "markdown"
|
TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MARKDOWN_LINTER_RULES" ".*\.\(md\)\$" "markdown"
|
||||||
TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl"
|
TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl"
|
||||||
TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "php"
|
TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "php"
|
||||||
TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi"
|
TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi"
|
||||||
|
|
Loading…
Reference in a new issue