mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 12:42:09 -05:00
commit
ed82ac5896
12 changed files with 1056 additions and 955 deletions
|
@ -3,9 +3,9 @@ from os import getenv, path
|
|||
from pprint import pprint
|
||||
import sys
|
||||
|
||||
import click # pylint: disable=import-error
|
||||
from dotenv import load_dotenv # pylint: disable=import-error
|
||||
import requests # pylint: disable=import-error
|
||||
import click # pylint: disable=import-error
|
||||
from dotenv import load_dotenv # pylint: disable=import-error
|
||||
import requests # pylint: disable=import-error
|
||||
|
||||
env = load_dotenv()
|
||||
api_url = getenv('API_URL', default='https://api.github.com/graphql')
|
||||
|
@ -13,8 +13,8 @@ github_token = getenv("GITHUB_TOKEN", default=None)
|
|||
|
||||
if github_token is None:
|
||||
sys.exit("GitHub Token is not set." +
|
||||
"Please set the GITHUB_TOKEN env variable in your system or " +
|
||||
"the .env file of your project.")
|
||||
"Please set the GITHUB_TOKEN env variable in your system or " +
|
||||
"the .env file of your project.")
|
||||
|
||||
client_id = getenv('CLIENT_ID', default='copy_labels.py')
|
||||
headers = {
|
||||
|
@ -23,6 +23,7 @@ headers = {
|
|||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
|
||||
def create_label(repo_id, label):
|
||||
"""
|
||||
Create label in the supplied repo.
|
||||
|
@ -52,6 +53,7 @@ def create_label(repo_id, label):
|
|||
|
||||
return response
|
||||
|
||||
|
||||
def get_labels(owner, repo):
|
||||
"""
|
||||
Gets a list of labels from the supplied repo.
|
||||
|
@ -62,7 +64,7 @@ def get_labels(owner, repo):
|
|||
:return: A tuple with the GitHub id for the repository and a list of labels defined in the repository
|
||||
"""
|
||||
|
||||
query_variables = { "owner": owner, "name": repo, }
|
||||
query_variables = {"owner": owner, "name": repo, }
|
||||
|
||||
with open(path.join(path.dirname(__file__), 'queries/get_repo_data.gql'), 'r') as query_file:
|
||||
query = "".join(query_file.readlines())
|
||||
|
@ -83,6 +85,7 @@ def get_labels(owner, repo):
|
|||
'[ERROR] getting issue labels. Status Code: {status_code} - Message: {result}'.format(
|
||||
status_code=status_code, result=result["message"]))
|
||||
|
||||
|
||||
def delete_label(label_id):
|
||||
"""
|
||||
Delete the specified label
|
||||
|
@ -106,6 +109,7 @@ def delete_label(label_id):
|
|||
|
||||
return result
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--dry', is_flag=True)
|
||||
@click.argument('source_repo')
|
||||
|
@ -149,7 +153,8 @@ def copy_labels(source_repo, target_repo, dry):
|
|||
|
||||
print('Done')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Pylint doesn't know that @click.command takes care of injecting the
|
||||
# function parameters. Disabling Pylint error.
|
||||
copy_labels() # pylint: disable=no-value-for-parameter
|
||||
copy_labels() # pylint: disable=no-value-for-parameter
|
||||
|
|
2
.github/linters/.flake8
vendored
Normal file
2
.github/linters/.flake8
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
[flake8]
|
||||
max-line-length = 120
|
|
@ -247,6 +247,8 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
|
|||
VALIDATE_POWERSHELL=${VALIDATE_POWERSHELL} \
|
||||
VALIDATE_PROTOBUF=${VALIDATE_PROTOBUF} \
|
||||
VALIDATE_PYTHON=${VALIDATE_PYTHON} \
|
||||
VALIDATE_PYTHON_PYLINT=${VALIDATE_PYTHON_PYLINT} \
|
||||
VALIDATE_PYTHON_FLAKE8=${VALIDATE_PYTHON_FLAKE8} \
|
||||
VALIDATE_RAKU=${VALIDATE_RAKU} \
|
||||
VALIDATE_RUBY=${VALIDATE_RUBY} \
|
||||
VALIDATE_STATES=${VALIDATE_STATES} \
|
||||
|
|
|
@ -66,7 +66,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
|||
| **PHP** | [PHP](https://www.php.net/) |
|
||||
| **PowerShell** | [PSScriptAnalyzer](https://github.com/PowerShell/Psscriptanalyzer) |
|
||||
| **Protocol Buffers** | [protolint](https://github.com/yoheimuta/protolint) |
|
||||
| **Python3** | [pylint](https://www.pylint.org/) |
|
||||
| **Python3** | [pylint](https://www.pylint.org/) [flake8](https://flake8.pycqa.org/en/latest/) |
|
||||
| **Raku** | [raku](https://raku.org) |
|
||||
| **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) |
|
||||
| **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) |
|
||||
|
@ -180,6 +180,8 @@ 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_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. |
|
||||
| **PYTHON_PYLINT_CONFIG_FILE** | `.python-lint` | Filename for [pylint configuration](http://pylint.pycqa.org/en/latest/user_guide/run.html?highlight=rcfile#command-line-options) (ex: `.python-lint`, `.pylintrc`) |
|
||||
| **PYTHON_FLAKE8_CONFIG_FILE** | `.flake8` | Filename for [flake8 configuration](https://flake8.pycqa.org/en/latest/user/configuration.html) (ex: `.flake8`, `tox.ini`) |
|
||||
| **RUBY_CONFIG_FILE** | `.ruby-lint.yml` | Filename for [rubocop configuration](https://docs.rubocop.org/rubocop/configuration.html) (ex: `.ruby-lint.yml`, `.rubocop.yml`) |
|
||||
| **TYPESCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) |
|
||||
| **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. |
|
||||
|
@ -208,7 +210,9 @@ and won't run anything unexpected.
|
|||
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the Perl language. |
|
||||
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the PHP language. |
|
||||
| **VALIDATE_PROTOBUF** | `true` | Flag to enable or disable the linting process of the Protobuf language. |
|
||||
| **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the Python language. |
|
||||
| **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: pylint) (keep for backward compatibility) |
|
||||
| **VALIDATE_PYTHON_PYLINT** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: pylint) |
|
||||
| **VALIDATE_PYTHON_FLAKE8** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: flake8) |
|
||||
| **VALIDATE_POWERSHELL** | `true` | Flag to enable or disable the linting process of the Powershell language. |
|
||||
| **VALIDATE_RAKU** | `true` | Flag to enable or disable the linting process of the Raku language. |
|
||||
| **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the Ruby language. |
|
||||
|
|
2
TEMPLATES/.flake8
Normal file
2
TEMPLATES/.flake8
Normal file
|
@ -0,0 +1,2 @@
|
|||
[flake8]
|
||||
max-line-length = 120
|
1
dependencies/Pipfile
vendored
1
dependencies/Pipfile
vendored
|
@ -11,6 +11,7 @@ pylint = "*"
|
|||
yq = "*"
|
||||
cfn-lint = "*"
|
||||
terrascan = "*"
|
||||
flake8 = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.8"
|
||||
|
|
35
dependencies/Pipfile.lock
generated
vendored
35
dependencies/Pipfile.lock
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "c62b95247cb67b10711da0012966cc031d5a9ec08885a45736c0ee77bba3a844"
|
||||
"sha256": "f8ea3853c4bb4533103043533d08982436551678c827f59809c94bf0ee54a187"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -28,6 +28,7 @@
|
|||
"sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703",
|
||||
"sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"
|
||||
],
|
||||
"markers": "python_version >= '3.5'",
|
||||
"version": "==2.4.2"
|
||||
},
|
||||
"attrs": {
|
||||
|
@ -35,6 +36,7 @@
|
|||
"sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
|
||||
"sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==19.3.0"
|
||||
},
|
||||
"aws-sam-translator": {
|
||||
|
@ -80,13 +82,23 @@
|
|||
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827",
|
||||
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
|
||||
],
|
||||
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"version": "==0.15.2"
|
||||
},
|
||||
"flake8": {
|
||||
"hashes": [
|
||||
"sha256:15e351d19611c887e482fb960eae4d44845013cc142d42896e9862f775d8cf5c",
|
||||
"sha256:f04b9fcbac03b0a3e58c0ab3a0ecc462e023a9faf046d57794184028123aa208"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.8.3"
|
||||
},
|
||||
"isort": {
|
||||
"hashes": [
|
||||
"sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1",
|
||||
"sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==4.3.21"
|
||||
},
|
||||
"jmespath": {
|
||||
|
@ -94,6 +106,7 @@
|
|||
"sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9",
|
||||
"sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f"
|
||||
],
|
||||
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"version": "==0.10.0"
|
||||
},
|
||||
"jsonpatch": {
|
||||
|
@ -109,6 +122,7 @@
|
|||
"sha256:c192ba86648e05fdae4f08a17ec25180a9aef5008d973407b581798a83975362",
|
||||
"sha256:ff379fa021d1b81ab539f5ec467c7745beb1a5671463f9dcc2b2d458bd361c1e"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==2.0"
|
||||
},
|
||||
"jsonschema": {
|
||||
|
@ -148,6 +162,7 @@
|
|||
"sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4",
|
||||
"sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==1.4.3"
|
||||
},
|
||||
"mccabe": {
|
||||
|
@ -172,6 +187,22 @@
|
|||
],
|
||||
"version": "==0.8.0"
|
||||
},
|
||||
"pycodestyle": {
|
||||
"hashes": [
|
||||
"sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367",
|
||||
"sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==2.6.0"
|
||||
},
|
||||
"pyflakes": {
|
||||
"hashes": [
|
||||
"sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92",
|
||||
"sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==2.2.0"
|
||||
},
|
||||
"pyhcl": {
|
||||
"hashes": [
|
||||
"sha256:2d9b9dcdf1023d812bfed561ba72c99104c5b3f52e558d595130a44ce081b003"
|
||||
|
@ -197,6 +228,7 @@
|
|||
"sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
|
||||
"sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"version": "==2.8.1"
|
||||
},
|
||||
"pyyaml": {
|
||||
|
@ -228,6 +260,7 @@
|
|||
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
|
||||
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"version": "==1.15.0"
|
||||
},
|
||||
"terrascan": {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -263,7 +263,8 @@ function BuildFileList() {
|
|||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_PYTHON+=("${FILE}")
|
||||
FILE_ARRAY_PYTHON_PYLINT+=("${FILE}")
|
||||
FILE_ARRAY_PYTHON_FLAKE8+=("${FILE}")
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
|
|
155
lib/linter.sh
155
lib/linter.sh
|
@ -78,8 +78,10 @@ POWERSHELL_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${POWERSHELL_FILE_NAME}"
|
|||
PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file
|
||||
PROTOBUF_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PROTOBUF_FILE_NAME}" # Path to the Protocol Buffers lint rules
|
||||
# Python Vars
|
||||
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_PYLINT_FILE_NAME="${PYTHON_PYLINT_CONFIG_FILE:-.python-lint}" # Name of the file
|
||||
PYTHON_PYLINT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PYTHON_PYLINT_FILE_NAME}" # Path to the python lint rules
|
||||
PYTHON_FLAKE8_FILE_NAME="${PYTHON_FLAKE8_CONFIG_FILE:-.flake8}" # Name of the file
|
||||
PYTHON_FLAKE8_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PYTHON_FLAKE8_FILE_NAME}" # Path to the python lint rules
|
||||
# Ruby Vars
|
||||
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file
|
||||
RUBY_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${RUBY_FILE_NAME}" # Path to the ruby lint rules
|
||||
|
@ -97,22 +99,20 @@ YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}"
|
|||
#######################################
|
||||
# Linter array for information prints #
|
||||
#######################################
|
||||
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'clj-kondo'
|
||||
'coffeelint' 'dart' 'dockerfilelint' 'dotenv-linter' 'eslint' 'golangci-lint'
|
||||
'htmlhint' 'jsonlint' 'ktlint' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl'
|
||||
'protolint' 'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'spectral'
|
||||
'standard' 'stylelint' 'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'clj-kondo' 'coffeelint'
|
||||
'dart' 'dockerfilelint' 'dotenv-linter' 'eslint' 'flake8' 'golangci-lint' 'htmlhint'
|
||||
'jsonlint' 'ktlint' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint' 'pwsh'
|
||||
'pylint' 'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'terrascan'
|
||||
'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
#############################
|
||||
# Language array for prints #
|
||||
#############################
|
||||
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT'
|
||||
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'GROOVY' 'HTML' 'JAVASCRIPT_ES'
|
||||
'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'LUA' 'MARKDOWN' 'OPENAPI'
|
||||
'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON'
|
||||
'RAKU' 'RUBY' 'STATES' 'TERRAFORM' 'TERRAFORM_TERRASCAN' 'TSX' 'TYPESCRIPT_ES'
|
||||
'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
||||
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT' 'CSS'
|
||||
'DART' 'DOCKER' 'ENV' 'GO' 'GROOVY' 'HTML' 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD'
|
||||
'JSON' 'JSX' 'KOTLIN' 'LUA' 'MARKDOWN' 'OPENAPI' 'PERL' 'PHP' 'POWERSHELL'
|
||||
'PROTOBUF' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'RAKU' 'RUBY' 'STATES' 'TERRAFORM'
|
||||
'TERRAFORM_TERRASCAN' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YML')
|
||||
|
||||
############################################
|
||||
# Array for all languages that were linted #
|
||||
|
@ -123,54 +123,55 @@ LINTED_LANGUAGES_ARRAY=() # Will be filled at run time with all languages that w
|
|||
###################
|
||||
# GitHub ENV Vars #
|
||||
###################
|
||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
||||
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
||||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
||||
GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs
|
||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
|
||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
||||
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_CLOUDFORMATION="${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_GROOVY="${VALIDATE_GROOVY}" # Boolean to validate language
|
||||
VALIDATE_HTML="${VALIDATE_HTML}" # 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_JSON="${VALIDATE_JSON}" # Boolean to validate language
|
||||
VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language
|
||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
||||
VALIDATE_LUA="${VALIDATE_LUA}" # 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_STATES="${VALIDATE_STATES}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM_TERRASCAN="${VALIDATE_TERRAFORM_TERRASCAN}" # Boolean to validate language
|
||||
VALIDATE_TSX="${VALIDATE_TSX}" # 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_XML="${VALIDATE_XML}" # Boolean to validate language
|
||||
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
||||
ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory
|
||||
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default)
|
||||
DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors
|
||||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path
|
||||
GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system
|
||||
GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs
|
||||
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
|
||||
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
|
||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
|
||||
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
|
||||
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
|
||||
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
|
||||
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_CLOUDFORMATION="${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_GROOVY="${VALIDATE_GROOVY}" # Boolean to validate language
|
||||
VALIDATE_HTML="${VALIDATE_HTML}" # 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_JSON="${VALIDATE_JSON}" # Boolean to validate language
|
||||
VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language
|
||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
||||
VALIDATE_LUA="${VALIDATE_LUA}" # 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_PYLINT="${VALIDATE_PYTHON:-$VALIDATE_PYTHON_PYLINT}" # Boolean to validate language
|
||||
VALIDATE_PYTHON_FLAKE8="${VALIDATE_PYTHON_FLAKE8}" # Boolean to validate language
|
||||
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
||||
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
||||
VALIDATE_STATES="${VALIDATE_STATES}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM_TERRASCAN="${VALIDATE_TERRAFORM_TERRASCAN}" # Boolean to validate language
|
||||
VALIDATE_TSX="${VALIDATE_TSX}" # 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_XML="${VALIDATE_XML}" # Boolean to validate language
|
||||
VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language
|
||||
|
||||
##############
|
||||
# Debug Vars #
|
||||
|
@ -238,7 +239,8 @@ 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_PYTHON_PYLINT=() # Array of files to check
|
||||
FILE_ARRAY_PYTHON_FLAKE8=() # Array of files to check
|
||||
FILE_ARRAY_RAKU=() # Array of files to check
|
||||
FILE_ARRAY_RUBY=() # Array of files to check
|
||||
FILE_ARRAY_STATES=() # Array of files to check
|
||||
|
@ -302,8 +304,10 @@ ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
|||
export ERRORS_FOUND_POWERSHELL # Workaround SC2034
|
||||
ERRORS_FOUND_PROTOBUF=0 # Count of errors found
|
||||
export ERRORS_FOUND_PROTOBUF # Workaround SC2034
|
||||
ERRORS_FOUND_PYTHON=0 # Count of errors found
|
||||
export ERRORS_FOUND_PYTHON # Workaround SC2034
|
||||
ERRORS_FOUND_PYTHON_PYLINT=0 # Count of errors found
|
||||
export ERRORS_FOUND_PYTHON_PYLINT # Workaround SC2034
|
||||
ERRORS_FOUND_PYTHON_FLAKE8=0 # Count of errors found
|
||||
export ERRORS_FOUND_PYTHON_FLAKE8 # Workaround SC2034
|
||||
ERRORS_FOUND_RAKU=0 # Count of errors found
|
||||
export ERRORS_FOUND_RAKU # Workaround SC2034
|
||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||
|
@ -1093,8 +1097,10 @@ GetLinterRules "LUA"
|
|||
GetLinterRules "MARKDOWN"
|
||||
# Get PowerShell rules
|
||||
GetLinterRules "POWERSHELL"
|
||||
# Get Python rules
|
||||
GetLinterRules "PYTHON"
|
||||
# Get Python pylint rules
|
||||
GetLinterRules "PYTHON_PYLINT"
|
||||
# Get Python flake8 rules
|
||||
GetLinterRules "PYTHON_FLAKE8"
|
||||
# Get Ruby rules
|
||||
GetLinterRules "RUBY"
|
||||
# Get Terraform rules
|
||||
|
@ -1511,12 +1517,23 @@ fi
|
|||
##################
|
||||
# PYTHON LINTING #
|
||||
##################
|
||||
if [ "${VALIDATE_PYTHON}" == "true" ]; then
|
||||
if [ "${VALIDATE_PYTHON_PYLINT}" == "true" ]; then
|
||||
#########################
|
||||
# Lint the python files #
|
||||
#########################
|
||||
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
||||
LintCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}"
|
||||
LintCodebase "PYTHON_PYLINT" "pylint" "pylint --rcfile ${PYTHON_PYLINT_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON_PYLINT[@]}"
|
||||
fi
|
||||
|
||||
##################
|
||||
# PYTHON LINTING #
|
||||
##################
|
||||
if [ "${VALIDATE_PYTHON_FLAKE8}" == "true" ]; then
|
||||
#########################
|
||||
# Lint the python files #
|
||||
#########################
|
||||
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
||||
LintCodebase "PYTHON_FLAKE8" "flake8" "flake8 --config=${PYTHON_FLAKE8_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON_FLAKE8[@]}"
|
||||
fi
|
||||
|
||||
################
|
||||
|
|
|
@ -46,7 +46,6 @@ function GetValidationInfo() {
|
|||
################################
|
||||
# Convert strings to lowercase #
|
||||
################################
|
||||
|
||||
# Loop through all languages
|
||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||
# build the variable
|
||||
|
@ -55,7 +54,6 @@ function GetValidationInfo() {
|
|||
eval "${VALIDATE_LANGUAGE}=${!VALIDATE_LANGUAGE,,}"
|
||||
done
|
||||
|
||||
|
||||
################################################
|
||||
# Determine if any linters were explicitly set #
|
||||
################################################
|
||||
|
@ -71,7 +69,6 @@ function GetValidationInfo() {
|
|||
fi
|
||||
done
|
||||
|
||||
|
||||
###################################################
|
||||
# Validate if we should check individual lanuages #
|
||||
###################################################
|
||||
|
|
|
@ -602,7 +602,8 @@ function RunTestCases() {
|
|||
TestCodebase "OPENAPI" "spectral" "spectral lint -r ${OPENAPI_LINTER_RULES}" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi"
|
||||
TestCodebase "POWERSHELL" "pwsh" "Invoke-ScriptAnalyzer -EnableExit -Settings ${POWERSHELL_LINTER_RULES} -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "powershell"
|
||||
TestCodebase "PROTOBUF" "protolint" "protolint lint --config_path ${PROTOBUF_LINTER_RULES}" ".*\.\(proto\)\$" "protobuf"
|
||||
TestCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "python"
|
||||
TestCodebase "PYTHON_PYLINT" "pylint" "pylint --rcfile ${PYTHON_PYLINT_LINTER_RULES}" ".*\.\(py\)\$" "python"
|
||||
TestCodebase "PYTHON_FLAKE8" "flake8" "flake8 --config ${PYTHON_FLAKE8_LINTER_RULES}" ".*\.\(py\)\$" "python"
|
||||
TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku"
|
||||
TestCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES}" ".*\.\(rb\)\$" "ruby"
|
||||
TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states"
|
||||
|
|
Loading…
Reference in a new issue