Skip to content

Commit e71a37d

Browse files
authored
feat: add depndency (#5456)
feat: configure ruff feat: update the orchestration scripts feat: update the test suite docs: update README feat: add test cases for ruff fix: CI error chore: del .github/linters/.ruff.toml fix: CI error fix: README update: LINTER_NAMES_ARRAY fix: Dockerfile fix: .github/linters/.jscpd.json fix: test files fix: del version_command
1 parent 613d661 commit e71a37d

File tree

12 files changed

+29
-2
lines changed

12 files changed

+29
-2
lines changed

.github/linters/.jscpd.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"**/test/linters/python_isort",
2828
"**/test/linters/python_mypy",
2929
"**/test/linters/python_pylint",
30+
"**/test/linters/python_ruff",
3031
"**/test/linters/r",
3132
"**/test/linters/ruby",
3233
"**/test/linters/rust_2015",

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ ENV PATH="${PATH}:/venvs/flake8/bin"
383383
ENV PATH="${PATH}:/venvs/isort/bin"
384384
ENV PATH="${PATH}:/venvs/mypy/bin"
385385
ENV PATH="${PATH}:/venvs/pylint/bin"
386+
ENV PATH="${PATH}:/venvs/ruff/bin"
386387
ENV PATH="${PATH}:/venvs/snakefmt/bin"
387388
ENV PATH="${PATH}:/venvs/snakemake/bin"
388389
ENV PATH="${PATH}:/venvs/sqlfluff/bin"

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Super-linter supports the following tools:
8585
| **PHP** | [PHP built-in linter](https://www.php.net/manual/en/features.commandline.options.php) / [PHP CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) / [PHPStan](https://phpstan.org/) / [Psalm](https://psalm.dev/) |
8686
| **PowerShell** | [PSScriptAnalyzer](https://github.com/PowerShell/Psscriptanalyzer) |
8787
| **Protocol Buffers** | [protolint](https://github.com/yoheimuta/protolint) |
88-
| **Python3** | [pylint](https://pylint.pycqa.org/) / [flake8](https://flake8.pycqa.org/en/latest/) / [black](https://github.com/psf/black) / [isort](https://pypi.org/project/isort/) |
88+
| **Python3** | [pylint](https://pylint.pycqa.org/) / [flake8](https://flake8.pycqa.org/en/latest/) / [black](https://github.com/psf/black) / [isort](https://pypi.org/project/isort/) / [ruff](https://github.com/astral-sh/ruff) |
8989
| **R** | [lintr](https://github.com/jimhester/lintr) |
9090
| **Raku** | [Raku](https://raku.org) |
9191
| **Renovate** | [renovate-config-validator](https://docs.renovatebot.com/config-validation/) |
@@ -232,6 +232,7 @@ You can configure super-linter using the following environment variables:
232232
| **PYTHON_ISORT_CONFIG_FILE** | `.isort.cfg` | Filename for [isort configuration](https://pycqa.github.io/isort/docs/configuration/config_files.html) (ex: `.isort.cfg`, `pyproject.toml`) |
233233
| **PYTHON_MYPY_CONFIG_FILE** | `.mypy.ini` | Filename for [mypy configuration](https://mypy.readthedocs.io/en/stable/config_file.html) (ex: `.mypy.ini`, `setup.config`) |
234234
| **PYTHON_PYLINT_CONFIG_FILE** | `.python-lint` | Filename for [pylint configuration](https://pylint.pycqa.org/en/latest/user_guide/run.html?highlight=rcfile#command-line-options) (ex: `.python-lint`, `.pylintrc`) |
235+
| **PYTHON_RUFF_CONFIG_FILE** | `.ruff.toml` | Filename for [ruff configuration](https://docs.astral.sh/ruff/configuration/) |
235236
| **RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES** | not set | Comma-separated filenames for [renovate shareable config preset](https://docs.renovatebot.com/config-presets/) (ex: `default.json`) |
236237
| **RUBY_CONFIG_FILE** | `.ruby-lint.yml` | Filename for [rubocop configuration](https://docs.rubocop.org/rubocop/configuration.html) (ex: `.ruby-lint.yml`, `.rubocop.yml`) |
237238
| **SCALAFMT_CONFIG_FILE** | `.scalafmt.conf` | Filename for [scalafmt configuration](https://scalameta.org/scalafmt/docs/configuration.html) (ex: `.scalafmt.conf`) |
@@ -302,6 +303,7 @@ You can configure super-linter using the following environment variables:
302303
| **VALIDATE_PYTHON_ISORT** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: isort) |
303304
| **VALIDATE_PYTHON_MYPY** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: mypy) |
304305
| **VALIDATE_PYTHON_PYLINT** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: pylint) |
306+
| **VALIDATE_PYTHON_RUFF** | `true` | Flag to enable or disable the linting process of the Python language. (Utilizing: ruff) |
305307
| **VALIDATE_R** | `true` | Flag to enable or disable the linting process of the R language. |
306308
| **VALIDATE_RAKU** | `true` | Flag to enable or disable the linting process of the Raku language. |
307309
| **VALIDATE_RENOVATE** | `true` | Flag to enable or disable the linting process of the Renovate configuration files. |

TEMPLATES/.ruff.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Same as .flake8
2+
line-length = 120
3+
4+
[lint]
5+
ignore = ["E203"]

dependencies/python/ruff.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruff==0.3.4

lib/functions/buildFileList.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ BuildFileArrays() {
437437
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-PYTHON_ISORT"
438438
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-PYTHON_PYLINT"
439439
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-PYTHON_MYPY"
440+
echo "${FILE}" >>"${FILE_ARRAYS_DIRECTORY_PATH}/file-array-PYTHON_RUFF"
440441
elif [ "${FILE_TYPE}" == "raku" ] || [ "${FILE_TYPE}" == "rakumod" ] ||
441442
[ "${FILE_TYPE}" == "rakutest" ] || [ "${FILE_TYPE}" == "pm6" ] ||
442443
[ "${FILE_TYPE}" == "pl6" ] || [ "${FILE_TYPE}" == "p6" ]; then

lib/functions/linterCommands.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ LINTER_COMMANDS_ARRAY_PYTHON_PYLINT=(pylint --rcfile "${PYTHON_PYLINT_LINTER_RUL
9797
LINTER_COMMANDS_ARRAY_PYTHON_FLAKE8=(flake8 --config="${PYTHON_FLAKE8_LINTER_RULES}")
9898
LINTER_COMMANDS_ARRAY_PYTHON_ISORT=(isort --check --diff --sp "${PYTHON_ISORT_LINTER_RULES}")
9999
LINTER_COMMANDS_ARRAY_PYTHON_MYPY=(mypy --config-file "${PYTHON_MYPY_LINTER_RULES}" --install-types --non-interactive)
100+
LINTER_COMMANDS_ARRAY_PYTHON_RUFF=(ruff check --config "${PYTHON_RUFF_LINTER_RULES}")
100101
LINTER_COMMANDS_ARRAY_R=(R --slave -e "\"lints <- lintr::lint('{}');print(lints);errors <- purrr::keep(lints, ~ .\\\$type == 'error');quit(save = 'no', status = if (length(errors) > 0) 1 else 0)\"")
101102
LINTER_COMMANDS_ARRAY_RAKU=(raku)
102103
LINTER_COMMANDS_ARRAY_RENOVATE=(renovate-config-validator --strict)

lib/linter.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ PYTHON_MYPY_FILE_NAME="${PYTHON_MYPY_CONFIG_FILE:-.mypy.ini}"
223223
# shellcheck disable=SC2034 # Variable is referenced indirectly
224224
PYTHON_PYLINT_FILE_NAME="${PYTHON_PYLINT_CONFIG_FILE:-.python-lint}"
225225
# shellcheck disable=SC2034 # Variable is referenced indirectly
226+
PYTHON_RUFF_FILE_NAME="${PYTHON_RUFF_CONFIG_FILE:-.ruff.toml}"
227+
# shellcheck disable=SC2034 # Variable is referenced indirectly
226228
R_FILE_NAME=".lintr"
227229
# shellcheck disable=SC2034 # Variable is referenced indirectly
228230
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}"
@@ -293,7 +295,8 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CHECKOV' 'CLANG_FORMAT'
293295
'KUBERNETES_KUBECONFORM' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
294296
'NATURAL_LANGUAGE' 'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN'
295297
'PHP_PSALM' 'POWERSHELL' 'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT'
296-
'PYTHON_FLAKE8' 'PYTHON_ISORT' 'PYTHON_MYPY' 'R' 'RAKU' 'RENOVATE' 'RUBY' 'RUST_2015'
298+
'PYTHON_FLAKE8' 'PYTHON_ISORT' 'PYTHON_MYPY' 'PYTHON_RUFF'
299+
'R' 'RAKU' 'RENOVATE' 'RUBY' 'RUST_2015'
297300
'RUST_2018' 'RUST_2021' 'RUST_CLIPPY' 'SCALAFMT' 'SHELL_SHFMT'
298301
'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQL' 'SQLFLUFF' 'TEKTON'
299302
'TERRAFORM_FMT' 'TERRAFORM_TFLINT' 'TERRAFORM_TERRASCAN' 'TERRAGRUNT' 'TSX'

scripts/linterVersions.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ LINTER_NAMES_ARRAY['PYTHON_PYLINT']="pylint"
5454
LINTER_NAMES_ARRAY['PYTHON_FLAKE8']="flake8"
5555
LINTER_NAMES_ARRAY['PYTHON_ISORT']="isort"
5656
LINTER_NAMES_ARRAY['PYTHON_MYPY']="mypy"
57+
LINTER_NAMES_ARRAY['PYTHON_RUFF']="ruff"
5758
LINTER_NAMES_ARRAY['R']="R"
5859
LINTER_NAMES_ARRAY['RAKU']="raku"
5960
LINTER_NAMES_ARRAY['RENOVATE']="renovate-config-validator"

test/inspec/super-linter/controls/super_linter.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
{ linter_name: "raku", version_command: "raku --version | strings -n 8"},
184184
{ linter_name: "renovate-config-validator", version_command: "renovate --version"},
185185
{ linter_name: "rubocop"},
186+
{ linter_name: "ruff"},
186187
{ linter_name: "rustfmt"},
187188
{ linter_name: "scalafmt"},
188189
{ linter_name: "shellcheck"},
@@ -395,6 +396,7 @@
395396
"isort",
396397
"mypy",
397398
"pylint",
399+
"ruff",
398400
"snakefmt",
399401
"snakemake",
400402
"sqlfluff",
@@ -495,6 +497,7 @@
495497
"/action/lib/.automation/.python-black",
496498
"/action/lib/.automation/.python-lint",
497499
"/action/lib/.automation/.ruby-lint.yml",
500+
"/action/lib/.automation/.ruff.toml",
498501
"/action/lib/.automation/.scalafmt.conf",
499502
"/action/lib/.automation/.snakefmt.toml",
500503
"/action/lib/.automation/.sql-config.json",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
a=1;b=2
2+
c=a+b
3+
BROKEN_VAR=BROKEN_VAR
4+
print(c)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
a = 1
2+
b = 2
3+
c = a + b
4+
print(c)

0 commit comments

Comments
 (0)