2021-04-30 12:29:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
# PUll in env vars passed
|
|
|
|
image = ENV["IMAGE"]
|
|
|
|
|
2024-02-05 07:31:36 -05:00
|
|
|
version_file_path = "/action/linterVersions.txt"
|
|
|
|
|
|
|
|
control "super-linter-environment-variables" do
|
2024-02-10 03:51:09 -05:00
|
|
|
impact 1
|
|
|
|
title "Super-Linter environment variables check"
|
|
|
|
desc "Check that environment variables that Super-Linter needs are defined."
|
2024-02-05 07:31:36 -05:00
|
|
|
|
|
|
|
describe os_env("VERSION_FILE") do
|
|
|
|
its("content") { should eq version_file_path }
|
|
|
|
end
|
2024-02-09 13:43:58 -05:00
|
|
|
|
|
|
|
describe os_env("IMAGE") do
|
|
|
|
its("content") { should match(/^(standard|slim)$/) }
|
|
|
|
end
|
2024-02-10 03:51:09 -05:00
|
|
|
|
|
|
|
if (image == "standard")
|
|
|
|
describe os_env("POWERSHELL_TELEMETRY_OPTOUT") do
|
|
|
|
its("content") { should eq "1" }
|
|
|
|
end
|
|
|
|
end
|
2024-02-05 07:31:36 -05:00
|
|
|
end
|
|
|
|
|
2021-04-30 12:29:15 -04:00
|
|
|
##################################################
|
|
|
|
# Check to see all system packages are installed #
|
|
|
|
##################################################
|
|
|
|
control "super-linter-installed-packages" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter installed packages check"
|
|
|
|
desc "Check that packages that Super-Linter needs are installed."
|
|
|
|
|
|
|
|
packages = [
|
|
|
|
"bash",
|
2022-09-28 09:45:01 -04:00
|
|
|
"ca-certificates",
|
2021-04-30 12:29:15 -04:00
|
|
|
"coreutils",
|
|
|
|
"curl",
|
2023-12-15 05:59:36 -05:00
|
|
|
"file",
|
2024-02-29 12:12:01 -05:00
|
|
|
"gcompat",
|
2021-04-30 12:29:15 -04:00
|
|
|
"git-lfs",
|
|
|
|
"git",
|
|
|
|
"go",
|
|
|
|
"jq",
|
|
|
|
"libxml2-utils",
|
|
|
|
"nodejs-current",
|
2023-12-15 05:59:36 -05:00
|
|
|
"npm",
|
2023-11-11 01:46:25 -05:00
|
|
|
"openjdk17-jre",
|
2023-12-15 05:59:36 -05:00
|
|
|
"openssh-client",
|
|
|
|
"parallel",
|
2021-04-30 12:29:15 -04:00
|
|
|
"perl",
|
2024-07-15 05:52:42 -04:00
|
|
|
"php83",
|
|
|
|
"php83-ctype",
|
|
|
|
"php83-curl",
|
|
|
|
"php83-dom",
|
|
|
|
"php83-iconv",
|
|
|
|
"php83-mbstring",
|
|
|
|
"php83-openssl",
|
|
|
|
"php83-phar",
|
|
|
|
"php83-simplexml",
|
|
|
|
"php83-tokenizer",
|
|
|
|
"php83-xmlwriter",
|
2021-04-30 12:29:15 -04:00
|
|
|
"R",
|
2023-12-15 05:59:36 -05:00
|
|
|
"rakudo",
|
2021-04-30 12:29:15 -04:00
|
|
|
"ruby",
|
2023-12-29 13:30:58 -05:00
|
|
|
"rust-clippy",
|
|
|
|
"rustfmt",
|
2023-12-15 05:59:36 -05:00
|
|
|
"tar",
|
2023-12-29 13:30:58 -05:00
|
|
|
"zef"
|
2021-04-30 12:29:15 -04:00
|
|
|
]
|
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
# Removed linters from slim image
|
|
|
|
SLIM_IMAGE_REMOVED_PACKAGES=%w(
|
2023-12-29 13:30:58 -05:00
|
|
|
rust-clippy
|
|
|
|
rustfmt
|
2021-05-25 11:14:43 -04:00
|
|
|
)
|
|
|
|
|
2021-04-30 12:29:15 -04:00
|
|
|
packages.each do |item|
|
2023-01-08 23:35:37 -05:00
|
|
|
if (image == "slim" && SLIM_IMAGE_REMOVED_PACKAGES.include?(item))
|
2021-05-25 11:14:43 -04:00
|
|
|
next
|
|
|
|
else
|
|
|
|
describe package(item) do
|
|
|
|
it { should be_installed }
|
|
|
|
end
|
2021-04-30 12:29:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-29 13:30:58 -05:00
|
|
|
control "super-linter-uninstalled-packages" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter uninstalled packages check"
|
|
|
|
desc "Check that packages that Super-Linter doesn't need are not installed."
|
|
|
|
|
|
|
|
packages = [
|
|
|
|
"cmake",
|
2024-01-01 05:39:59 -05:00
|
|
|
"clang17-extra-tools",
|
2023-12-29 13:30:58 -05:00
|
|
|
"g++",
|
|
|
|
"gnupg",
|
|
|
|
"libc-dev",
|
|
|
|
"libxml2-dev",
|
|
|
|
"linux-headers",
|
|
|
|
"make",
|
|
|
|
"perl-dev",
|
|
|
|
"python3-dev",
|
|
|
|
"R-dev",
|
|
|
|
"R-doc",
|
|
|
|
"readline-dev",
|
|
|
|
"ruby-bundler",
|
|
|
|
"ruby-dev",
|
|
|
|
"ruby-rdoc"
|
|
|
|
]
|
|
|
|
|
|
|
|
packages.each do |item|
|
|
|
|
describe package(item) do
|
|
|
|
it { should_not be_installed }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-04-30 12:29:15 -04:00
|
|
|
###########################################
|
|
|
|
# Check to see all binaries are installed #
|
|
|
|
###########################################
|
|
|
|
control "super-linter-installed-commands" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter installed commands check"
|
|
|
|
desc "Check that commands that Super-Linter needs are installed."
|
|
|
|
|
|
|
|
default_version_option = "--version"
|
|
|
|
default_version_expected_exit_status = 0
|
|
|
|
default_expected_stdout_regex = /(.*?)/s
|
|
|
|
|
|
|
|
linters = [
|
2021-07-19 10:28:49 -04:00
|
|
|
{ linter_name: "actionlint"},
|
2023-04-16 23:32:42 -04:00
|
|
|
{ linter_name: "ansible-lint", expected_stdout_regex: /(.*)/},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "arm-ttk", version_command: "grep -iE 'version' '/usr/bin/arm-ttk' | xargs"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "asl-validator"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "bash-exec", expected_exit_status: 1}, # expect a return code = 1 because this linter doesn't support a "get linter version" command
|
|
|
|
{ linter_name: "black"},
|
|
|
|
{ linter_name: "cfn-lint"},
|
2023-12-22 07:22:15 -05:00
|
|
|
{ linter_name: "checkov"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "checkstyle", version_command: "java -jar /usr/bin/checkstyle --version"},
|
|
|
|
{ linter_name: "chktex"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "clang-format"},
|
2024-08-02 07:24:43 -04:00
|
|
|
{ linter_name: "clippy", linter_command: "cargo-clippy"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "clj-kondo"},
|
|
|
|
{ linter_name: "coffeelint"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "composer"},
|
2021-05-04 14:24:41 -04:00
|
|
|
{ linter_name: "cpplint"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "dart"},
|
|
|
|
{ linter_name: "dotenv-linter"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "dotnet"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "editorconfig-checker", version_option: "-version"},
|
|
|
|
{ linter_name: "eslint"},
|
|
|
|
{ linter_name: "flake8"},
|
|
|
|
{ linter_name: "gherkin-lint", expected_exit_status: 1}, # expect a return code = 1 because this linter doesn't support a "get linter version" command
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "gitleaks", version_option: "version"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "golangci-lint"},
|
2024-04-15 08:38:25 -04:00
|
|
|
{ linter_name: "goreleaser"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "google-java-format", version_command: "java -jar /usr/bin/google-java-format --version"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "hadolint"},
|
2024-06-07 11:06:55 -04:00
|
|
|
{ linter_name: "helm", version_option: "version"}, # not used as linter, needed for checkov's helm framework
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "htmlhint"},
|
|
|
|
{ linter_name: "isort"},
|
|
|
|
{ linter_name: "jscpd"},
|
|
|
|
{ linter_name: "ktlint"},
|
2024-06-27 13:03:16 -04:00
|
|
|
{ linter_name: "kustomize", version_option: "version"}, # not used as linter, needed for checkov's kustomize checks
|
2023-01-11 20:13:42 -05:00
|
|
|
{ linter_name: "kubeconform", version_option: "-v"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "lua", version_option: "-v"},
|
|
|
|
{ linter_name: "markdownlint"},
|
|
|
|
{ linter_name: "mypy"},
|
|
|
|
{ linter_name: "npm-groovy-lint"},
|
|
|
|
{ linter_name: "perl"},
|
|
|
|
{ linter_name: "php"},
|
|
|
|
{ linter_name: "phpcs"},
|
|
|
|
{ linter_name: "phpstan"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "prettier"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "protolint", version_option: "version"},
|
|
|
|
{ linter_name: "psalm"},
|
|
|
|
{ linter_name: "pwsh"},
|
|
|
|
{ linter_name: "pylint"},
|
|
|
|
{ linter_name: "R", version_command: "R --slave -e \"r_ver <- R.Version()\\$version.string; \
|
|
|
|
lintr_ver <- packageVersion('lintr'); \
|
|
|
|
glue::glue('lintr { lintr_ver } on { r_ver }')\""},
|
2021-06-28 08:59:11 -04:00
|
|
|
{ linter_name: "raku", version_command: "raku --version | strings -n 8"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "renovate-config-validator", version_command: "renovate --version"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "rubocop"},
|
2024-04-10 08:02:28 -04:00
|
|
|
{ linter_name: "ruff"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "rustfmt"},
|
2021-11-10 13:28:50 -05:00
|
|
|
{ linter_name: "scalafmt"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "shellcheck"},
|
|
|
|
{ linter_name: "shfmt"},
|
|
|
|
{ linter_name: "snakefmt"},
|
|
|
|
{ linter_name: "snakemake"},
|
|
|
|
{ linter_name: "spectral"},
|
|
|
|
{ linter_name: "sql-lint"},
|
2021-08-05 16:32:27 -04:00
|
|
|
{ linter_name: "sqlfluff"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "standard"},
|
|
|
|
{ linter_name: "stylelint"},
|
|
|
|
{ linter_name: "tekton-lint"},
|
2023-01-11 11:45:12 -05:00
|
|
|
{ linter_name: "terraform"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "terragrunt"},
|
|
|
|
{ linter_name: "terrascan", version_option: "version"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "textlint"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "tflint"},
|
2023-12-15 05:59:36 -05:00
|
|
|
{ linter_name: "ts-standard"},
|
2021-04-30 12:29:15 -04:00
|
|
|
{ linter_name: "xmllint"},
|
|
|
|
{ linter_name: "yamllint"},
|
|
|
|
]
|
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
# Removed linters from slim image
|
|
|
|
SLIM_IMAGE_REMOVED_LINTERS=%w(
|
|
|
|
arm-ttk
|
|
|
|
clippy
|
2023-10-16 14:31:03 -04:00
|
|
|
dotnet
|
2021-05-25 11:14:43 -04:00
|
|
|
pwsh
|
|
|
|
rustfmt
|
|
|
|
)
|
|
|
|
|
2021-04-30 12:29:15 -04:00
|
|
|
linters.each do |linter|
|
|
|
|
# If we didn't specify a linter command, use the linter name as a linter
|
|
|
|
# command because the vast majority of linters have name == command
|
2021-05-25 11:14:43 -04:00
|
|
|
linter_command = ""
|
2021-04-30 12:29:15 -04:00
|
|
|
|
2023-01-08 23:35:37 -05:00
|
|
|
if (image == "slim" && SLIM_IMAGE_REMOVED_LINTERS.include?(linter[:linter_name]))
|
2021-05-25 11:14:43 -04:00
|
|
|
next
|
2021-04-30 12:29:15 -04:00
|
|
|
else
|
2023-01-08 23:35:37 -05:00
|
|
|
if (linter.key?(:linter_command))
|
2021-05-25 11:14:43 -04:00
|
|
|
linter_command = linter[:linter_command]
|
2021-04-30 12:29:15 -04:00
|
|
|
else
|
2021-05-25 11:14:43 -04:00
|
|
|
linter_command = linter[:linter_name]
|
2021-04-30 12:29:15 -04:00
|
|
|
end
|
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
describe command("command -v #{linter_command}") do
|
|
|
|
its("exit_status") { should eq 0 }
|
2021-04-30 12:29:15 -04:00
|
|
|
end
|
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
# A few linters have a command that it's different than linter_command
|
2023-01-08 23:35:37 -05:00
|
|
|
if (linter.key?(:version_command))
|
2021-05-25 11:14:43 -04:00
|
|
|
version_command = linter[:version_command]
|
2021-04-30 12:29:15 -04:00
|
|
|
else
|
2021-05-25 11:14:43 -04:00
|
|
|
# Check if the linter needs an option that is different from the one that
|
|
|
|
# the vast majority of linters use to get the version
|
2023-01-08 23:35:37 -05:00
|
|
|
if (linter.key?(:version_option))
|
2021-05-25 11:14:43 -04:00
|
|
|
version_option = linter[:version_option]
|
|
|
|
else
|
|
|
|
version_option = default_version_option
|
|
|
|
end
|
|
|
|
|
|
|
|
version_command = "#{linter_command} #{version_option}"
|
|
|
|
|
2023-01-08 23:35:37 -05:00
|
|
|
if (linter.key?(:expected_exit_status))
|
2021-05-25 11:14:43 -04:00
|
|
|
expected_exit_status = linter[:expected_exit_status]
|
|
|
|
else
|
|
|
|
expected_exit_status = default_version_expected_exit_status
|
|
|
|
end
|
|
|
|
|
2023-01-08 23:35:37 -05:00
|
|
|
if (linter.key?(:expected_stdout_regex))
|
2021-05-25 11:14:43 -04:00
|
|
|
expected_stdout_regex = linter[:expected_stdout_regex]
|
|
|
|
else
|
|
|
|
expected_stdout_regex = default_expected_stdout_regex
|
|
|
|
end
|
|
|
|
|
|
|
|
##########################################################
|
|
|
|
# Being able to run the command `linter --version` helps #
|
|
|
|
# achieve that the linter is installed, ini PATH, and #
|
|
|
|
# has the libraries needed to be able to basically run #
|
|
|
|
##########################################################
|
|
|
|
describe command(version_command) do
|
|
|
|
its("exit_status") { should eq expected_exit_status }
|
|
|
|
its("stdout") { should match (expected_stdout_regex) }
|
|
|
|
end
|
2021-04-30 12:29:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
###################################
|
|
|
|
# Linters with no version command #
|
|
|
|
# protolint editorconfig-checker #
|
|
|
|
# bash-exec gherkin-lint #
|
|
|
|
###################################
|
2021-05-03 17:30:02 -04:00
|
|
|
|
|
|
|
############################################
|
|
|
|
# Check to see all Ruby Gems are installed #
|
|
|
|
############################################
|
|
|
|
control "super-linter-installed-ruby-gems" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter installed Ruby gems check"
|
|
|
|
desc "Check that Ruby gems that Super-Linter needs are installed."
|
|
|
|
|
|
|
|
gems = [
|
2024-08-06 16:29:45 -04:00
|
|
|
"rubocop-capybara",
|
|
|
|
"rubocop-factory_bot",
|
2021-05-03 17:30:02 -04:00
|
|
|
"rubocop-github",
|
2023-12-15 05:59:36 -05:00
|
|
|
"rubocop-minitest",
|
2021-05-03 17:30:02 -04:00
|
|
|
"rubocop-performance",
|
|
|
|
"rubocop-rails",
|
2023-12-15 05:59:36 -05:00
|
|
|
"rubocop-rake",
|
2024-08-06 16:29:45 -04:00
|
|
|
"rubocop-rspec_rails",
|
2023-12-15 05:59:36 -05:00
|
|
|
"rubocop-rspec",
|
2024-08-06 16:29:45 -04:00
|
|
|
"rubocop",
|
2023-12-15 05:59:36 -05:00
|
|
|
"standard"
|
2021-05-03 17:30:02 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
gems.each do |item|
|
|
|
|
describe gem(item) do
|
|
|
|
it { should be_installed }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
###############################################
|
|
|
|
# Check to see all NPM packages are installed #
|
|
|
|
###############################################
|
|
|
|
control "super-linter-installed-npm-packages" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter installed NPM packages check"
|
|
|
|
desc "Check that NPM packages that Super-Linter needs are installed."
|
|
|
|
|
|
|
|
packages = [
|
2023-09-19 15:13:50 -04:00
|
|
|
"@babel/eslint-parser",
|
|
|
|
"@babel/preset-react",
|
2023-10-17 12:16:52 -04:00
|
|
|
"@babel/preset-typescript",
|
2021-05-03 17:30:02 -04:00
|
|
|
"@coffeelint/cli",
|
2024-01-24 02:14:55 -05:00
|
|
|
"@ibm/tekton-lint",
|
2024-01-18 12:39:35 -05:00
|
|
|
"@react-native/eslint-config",
|
|
|
|
"@react-native/eslint-plugin",
|
2023-11-30 03:20:04 -05:00
|
|
|
"@stoplight/spectral-cli",
|
2021-05-03 17:30:02 -04:00
|
|
|
"@typescript-eslint/eslint-plugin",
|
|
|
|
"@typescript-eslint/parser",
|
|
|
|
"asl-validator",
|
2023-12-15 05:59:36 -05:00
|
|
|
"eslint",
|
2021-05-03 17:30:02 -04:00
|
|
|
"eslint-config-airbnb",
|
|
|
|
"eslint-config-prettier",
|
|
|
|
"eslint-plugin-jest",
|
2021-07-13 10:10:37 -04:00
|
|
|
"eslint-plugin-json",
|
2021-05-11 11:54:58 -04:00
|
|
|
"eslint-plugin-jsonc",
|
2021-05-03 17:30:02 -04:00
|
|
|
"eslint-plugin-jsx-a11y",
|
|
|
|
"eslint-plugin-prettier",
|
2023-12-15 05:59:36 -05:00
|
|
|
"eslint-plugin-react",
|
|
|
|
"eslint-plugin-react-hooks",
|
|
|
|
"eslint-plugin-vue",
|
2021-05-03 17:30:02 -04:00
|
|
|
"gherkin-lint",
|
|
|
|
"htmlhint",
|
|
|
|
"jscpd",
|
|
|
|
"markdownlint-cli",
|
2023-12-15 05:59:36 -05:00
|
|
|
"next",
|
|
|
|
"next-pwa",
|
2021-05-03 17:30:02 -04:00
|
|
|
"npm-groovy-lint",
|
2023-12-15 05:59:36 -05:00
|
|
|
"postcss-less",
|
2021-05-03 17:30:02 -04:00
|
|
|
"prettier",
|
|
|
|
"prettyjson",
|
2023-12-15 05:59:36 -05:00
|
|
|
"pug",
|
|
|
|
"react",
|
|
|
|
"react-dom",
|
|
|
|
"react-intl",
|
|
|
|
"react-redux",
|
|
|
|
"react-router-dom",
|
|
|
|
"renovate",
|
2021-05-03 17:30:02 -04:00
|
|
|
"sql-lint",
|
|
|
|
"standard",
|
|
|
|
"stylelint",
|
2023-12-15 05:59:36 -05:00
|
|
|
"stylelint-config-recommended-scss",
|
2021-05-03 17:30:02 -04:00
|
|
|
"stylelint-config-sass-guidelines",
|
|
|
|
"stylelint-config-standard",
|
2023-12-15 05:59:36 -05:00
|
|
|
"stylelint-config-standard-scss",
|
|
|
|
"stylelint-prettier",
|
|
|
|
"stylelint-scss",
|
|
|
|
"textlint",
|
|
|
|
"textlint-filter-rule-allowlist",
|
|
|
|
"textlint-filter-rule-comments",
|
|
|
|
"textlint-rule-terminology",
|
|
|
|
"ts-standard",
|
2021-05-03 17:30:02 -04:00
|
|
|
"typescript"
|
|
|
|
]
|
|
|
|
|
|
|
|
packages.each do |item|
|
|
|
|
describe npm(item, path: "/") do
|
|
|
|
it { should be_installed }
|
|
|
|
end
|
|
|
|
end
|
2023-12-15 05:59:36 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
###############################################
|
|
|
|
# Check to see if PyPi packages are installed #
|
|
|
|
###############################################
|
|
|
|
control "super-linter-installed-pypi-packages" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter installed PyPi packages check"
|
|
|
|
desc "Check that PyPi packages that Super-Linter needs are installed."
|
2021-05-03 17:30:02 -04:00
|
|
|
|
2023-12-15 05:59:36 -05:00
|
|
|
pypi_packages = [
|
|
|
|
"ansible-lint",
|
|
|
|
"black",
|
|
|
|
"cfn-lint",
|
2023-12-22 07:22:15 -05:00
|
|
|
"checkov",
|
2023-12-15 05:59:36 -05:00
|
|
|
"cpplint",
|
|
|
|
"flake8",
|
|
|
|
"isort",
|
|
|
|
"mypy",
|
|
|
|
"pylint",
|
2024-04-10 08:02:28 -04:00
|
|
|
"ruff",
|
2023-12-15 05:59:36 -05:00
|
|
|
"snakefmt",
|
|
|
|
"snakemake",
|
|
|
|
"sqlfluff",
|
|
|
|
"yamllint",
|
|
|
|
"yq"
|
|
|
|
]
|
|
|
|
|
|
|
|
pypi_packages.each do |item|
|
|
|
|
describe pip(item, "/venvs/#{item}/bin/pip") do
|
|
|
|
it { should be_installed }
|
|
|
|
end
|
|
|
|
end
|
2021-05-03 17:30:02 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
# Check to see if directories exist #
|
|
|
|
#####################################
|
|
|
|
control "super-linter-validate-directories" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter check for directories"
|
|
|
|
desc "Check that directories that Super-Linter needs are installed."
|
|
|
|
|
|
|
|
dirs = [
|
|
|
|
"/node_modules",
|
|
|
|
"/action/lib",
|
|
|
|
"/action/lib/functions",
|
|
|
|
"/action/lib/.automation",
|
2024-01-10 05:09:53 -05:00
|
|
|
"/root/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-aws",
|
|
|
|
"/root/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-azurerm",
|
|
|
|
"/root/.tflint.d/plugins/github.com/terraform-linters/tflint-ruleset-google",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/usr/local/lib/",
|
|
|
|
"/usr/local/share/"
|
|
|
|
]
|
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
# Removed linters from slim image
|
|
|
|
SLIM_IMAGE_REMOVED_DIRS=%w(
|
|
|
|
)
|
|
|
|
|
2021-05-03 17:30:02 -04:00
|
|
|
dirs.each do |item|
|
2023-01-08 23:35:37 -05:00
|
|
|
if (image == "slim" && SLIM_IMAGE_REMOVED_DIRS.include?(item))
|
2021-05-25 11:14:43 -04:00
|
|
|
next
|
|
|
|
else
|
|
|
|
describe directory(item) do
|
|
|
|
it { should exist }
|
|
|
|
it { should be_directory }
|
|
|
|
end
|
2021-05-03 17:30:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
###############################
|
|
|
|
# Check to see if files exist #
|
|
|
|
###############################
|
|
|
|
control "super-linter-validate-files" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter check for files"
|
|
|
|
desc "Check that files that Super-Linter needs are installed."
|
|
|
|
|
|
|
|
files = [
|
|
|
|
"/action/lib/linter.sh",
|
|
|
|
"/action/lib/functions/buildFileList.sh",
|
|
|
|
"/action/lib/functions/detectFiles.sh",
|
2024-01-05 17:07:39 -05:00
|
|
|
"/action/lib/functions/githubEvent.sh",
|
2024-01-30 14:24:55 -05:00
|
|
|
"/action/lib/functions/linterCommands.sh",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/functions/linterRules.sh",
|
2024-02-05 07:31:36 -05:00
|
|
|
version_file_path,
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/functions/log.sh",
|
2024-07-30 02:35:14 -04:00
|
|
|
"/action/lib/functions/output.sh",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/functions/possum.sh",
|
|
|
|
"/action/lib/functions/updateSSL.sh",
|
|
|
|
"/action/lib/functions/validation.sh",
|
|
|
|
"/action/lib/functions/worker.sh",
|
2024-07-31 11:00:41 -04:00
|
|
|
"/action/lib/globals/languages.sh",
|
2024-08-07 09:36:16 -04:00
|
|
|
"/action/lib/globals/linterCommandsOptions.sh",
|
2024-08-05 02:56:56 -04:00
|
|
|
"/action/lib/globals/linterRules.sh",
|
2021-07-19 10:28:49 -04:00
|
|
|
"/action/lib/.automation/actionlint.yml",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/.automation/.ansible-lint.yml",
|
|
|
|
"/action/lib/.automation/.arm-ttk.psd1",
|
|
|
|
"/action/lib/.automation/.cfnlintrc.yml",
|
2024-01-02 12:03:30 -05:00
|
|
|
"/action/lib/.automation/.checkov.yaml",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/.automation/.chktexrc",
|
2024-04-11 08:59:47 -04:00
|
|
|
"/action/lib/.automation/.clang-format",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/.automation/.clj-kondo",
|
|
|
|
"/action/lib/.automation/.coffee-lint.json",
|
|
|
|
"/action/lib/.automation/.ecrc",
|
|
|
|
"/action/lib/.automation/.eslintrc.yml",
|
|
|
|
"/action/lib/.automation/.flake8",
|
|
|
|
"/action/lib/.automation/.gherkin-lintrc",
|
|
|
|
"/action/lib/.automation/.golangci.yml",
|
|
|
|
"/action/lib/.automation/.groovylintrc.json",
|
|
|
|
"/action/lib/.automation/.hadolint.yaml",
|
|
|
|
"/action/lib/.automation/.htmlhintrc",
|
|
|
|
"/action/lib/.automation/.isort.cfg",
|
|
|
|
"/action/lib/.automation/.jscpd.json",
|
|
|
|
"/action/lib/.automation/.lintr",
|
|
|
|
"/action/lib/.automation/.luacheckrc",
|
|
|
|
"/action/lib/.automation/.markdown-lint.yml",
|
|
|
|
"/action/lib/.automation/.mypy.ini",
|
|
|
|
"/action/lib/.automation/.openapirc.yml",
|
|
|
|
"/action/lib/.automation/.perlcriticrc",
|
2022-12-23 21:01:24 -05:00
|
|
|
"/action/lib/.automation/.powershell-psscriptanalyzer.psd1",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/.automation/.protolintrc.yml",
|
|
|
|
"/action/lib/.automation/.python-black",
|
|
|
|
"/action/lib/.automation/.python-lint",
|
|
|
|
"/action/lib/.automation/.ruby-lint.yml",
|
2024-04-10 08:02:28 -04:00
|
|
|
"/action/lib/.automation/.ruff.toml",
|
2021-11-10 13:28:50 -05:00
|
|
|
"/action/lib/.automation/.scalafmt.conf",
|
2024-04-25 15:47:55 -04:00
|
|
|
"/action/lib/.automation/.shellcheckrc",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/.automation/.snakefmt.toml",
|
|
|
|
"/action/lib/.automation/.sql-config.json",
|
2022-09-28 09:45:01 -04:00
|
|
|
"/action/lib/.automation/.sqlfluff",
|
2021-05-03 17:30:02 -04:00
|
|
|
"/action/lib/.automation/.stylelintrc.json",
|
|
|
|
"/action/lib/.automation/.tflint.hcl",
|
|
|
|
"/action/lib/.automation/.yaml-lint.yml",
|
|
|
|
"/action/lib/.automation/phpcs.xml",
|
|
|
|
"/action/lib/.automation/phpstan.neon",
|
2024-06-07 11:06:55 -04:00
|
|
|
"/action/lib/.automation/psalm.xml",
|
|
|
|
"/usr/bin/helm", # needed for checkov's helm framework
|
2024-06-27 13:03:16 -04:00
|
|
|
"/usr/bin/kustomize", # needed for checkov's kustomize checks
|
2021-05-03 17:30:02 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
files.each do |item|
|
|
|
|
describe file(item) do
|
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
###############################
|
|
|
|
# Validate powershell modules #
|
|
|
|
###############################
|
|
|
|
control "super-linter-validate-powershell-modules" do
|
|
|
|
impact 1
|
|
|
|
title "Super-Linter validate Powershell Modules"
|
|
|
|
desc "Check that Powershell modules that Super-Linter needs are installed."
|
|
|
|
|
2023-01-08 23:35:37 -05:00
|
|
|
if (image == "slim")
|
2021-05-25 11:14:43 -04:00
|
|
|
next
|
|
|
|
else
|
|
|
|
describe command("pwsh -c \"(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name\" 2>&1") do
|
|
|
|
its("exit_status") { should eq 0 }
|
|
|
|
its("stdout") { should eq "PSScriptAnalyzer\n" }
|
|
|
|
end
|
2021-05-03 17:30:02 -04:00
|
|
|
|
2021-05-25 11:14:43 -04:00
|
|
|
describe command("pwsh -c \"(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name\" 2>&1") do
|
|
|
|
its("exit_status") { should eq 0 }
|
|
|
|
its("stdout") { should eq "Invoke-ScriptAnalyzer\n" }
|
|
|
|
end
|
2021-05-03 17:30:02 -04:00
|
|
|
end
|
|
|
|
end
|