From 41ddd0e1d3aed722217bab7fc65454411b15896d Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 14 Jul 2020 14:48:28 +0100 Subject: [PATCH 1/7] [tests] validate TAP format --- .../test/ansible/reports/expected-ANSIBLE.tap | 7 ++ .../reports/expected-COFFEESCRIPT.tap | 7 ++ .../test/docker/reports/expected-DOCKER.tap | 7 ++ .../reports/expected-JAVASCRIPT_ES.tap | 7 ++ .../reports/expected-JAVASCRIPT_STANDARD.tap | 7 ++ .../test/json/reports/expected-JSON.tap | 7 ++ .../test/kotlin/reports/expected-KOTLIN.tap | 7 ++ .../markdown/reports/expected-MARKDOWN.tap | 8 ++ .../test/perl/reports/expected-PERL.tap | 7 ++ .automation/test/php/reports/expected-PHP.tap | 7 ++ .../test/python/reports/expected-PYTHON.tap | 7 ++ .../test/ruby/reports/expected-RUBY.tap | 7 ++ .../test/shell/reports/expected-BASH.tap | 7 ++ .../reports/expected-TYPESCRIPT_ES.tap | 7 ++ .../reports/expected-TYPESCRIPT_STANDARD.tap | 7 ++ .automation/test/xml/reports/expected-XML.tap | 7 ++ .automation/test/yml/reports/expected-YML.tap | 7 ++ .github/workflows/deploy-DEV.yml | 2 +- lib/worker.sh | 75 ++++++++++++++++--- 19 files changed, 187 insertions(+), 10 deletions(-) create mode 100644 .automation/test/ansible/reports/expected-ANSIBLE.tap create mode 100644 .automation/test/coffeescript/reports/expected-COFFEESCRIPT.tap create mode 100644 .automation/test/docker/reports/expected-DOCKER.tap create mode 100644 .automation/test/javascript/reports/expected-JAVASCRIPT_ES.tap create mode 100644 .automation/test/javascript/reports/expected-JAVASCRIPT_STANDARD.tap create mode 100644 .automation/test/json/reports/expected-JSON.tap create mode 100644 .automation/test/kotlin/reports/expected-KOTLIN.tap create mode 100644 .automation/test/markdown/reports/expected-MARKDOWN.tap create mode 100644 .automation/test/perl/reports/expected-PERL.tap create mode 100644 .automation/test/php/reports/expected-PHP.tap create mode 100644 .automation/test/python/reports/expected-PYTHON.tap create mode 100644 .automation/test/ruby/reports/expected-RUBY.tap create mode 100644 .automation/test/shell/reports/expected-BASH.tap create mode 100644 .automation/test/typescript/reports/expected-TYPESCRIPT_ES.tap create mode 100644 .automation/test/typescript/reports/expected-TYPESCRIPT_STANDARD.tap create mode 100644 .automation/test/xml/reports/expected-XML.tap create mode 100644 .automation/test/yml/reports/expected-YML.tap diff --git a/.automation/test/ansible/reports/expected-ANSIBLE.tap b/.automation/test/ansible/reports/expected-ANSIBLE.tap new file mode 100644 index 00000000..5f81e1ed --- /dev/null +++ b/.automation/test/ansible/reports/expected-ANSIBLE.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - ansible_bad_1.yml + --- + message: Traceback (most recent call last) \n File "/usr/bin/ansible-lint", line 11, in \n load_entry_point('ansible-lint==4.2.0', 'console_scripts', 'ansible-lint')()\n File "/usr/lib/python3.8/site-packages/ansiblelint/__main__.py", line 187, in main\n matches.extend(runner.run())\n File "/usr/lib/python3.8/site-packages/ansiblelint/__init__.py", line 267, in run\n for child in ansiblelint.utils.find_children(arg, self.playbook_dir) \n File "/usr/lib/python3.8/site-packages/ansiblelint/utils.py", line 163, in find_children\n for child in play_children(basedir, item, playbook[1], playbook_dir) \n File "/usr/lib/python3.8/site-packages/ansiblelint/utils.py", line 215, in play_children\n return delegate_map[k](basedir, k, v, parent_type)\n File "/usr/lib/python3.8/site-packages/ansiblelint/utils.py", line 246, in _taskshandlers_children\n results.extend(_roles_children(basedir, k, [th['action'].get('name')],\n File "/usr/lib/python3.8/site-packages/ansiblelint/utils.py", line 285, in _roles_children\n results.extend(_look_for_role_files(basedir, role, main=main))\n File "/usr/lib/python3.8/site-packages/ansiblelint/utils.py", line 330, in _look_for_role_files\n role_path = _rolepath(basedir, role)\n File "/usr/lib/python3.8/site-packages/ansiblelint/utils.py", line 299, in _rolepath\n path_dwim(basedir, os.path.join('roles', role)),\n File "/usr/lib/python3.8/posixpath.py", line 90, in join\n genericpath._check_arg_types('join', a, *p)\n File "/usr/lib/python3.8/genericpath.py", line 152, in _check_arg_types\n raise TypeError(f'{funcname}() argument must be str, bytes, or '\nTypeError join() argument must be str, bytes, or os.PathLike object, not 'NoneType'\n + ... +ok 2 - ansible_good_1.yml diff --git a/.automation/test/coffeescript/reports/expected-COFFEESCRIPT.tap b/.automation/test/coffeescript/reports/expected-COFFEESCRIPT.tap new file mode 100644 index 00000000..4ce33752 --- /dev/null +++ b/.automation/test/coffeescript/reports/expected-COFFEESCRIPT.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - coffeescript_bad_1.coffee + --- + message: ✗ /tmp/lint/.automation/test/coffeescript/coffeescript_bad_1.coffee\n ✗ #39 [stdin] 39 29 error unmatched )\nmodule.exports = (robot) -> )\n ^. (coffeescript_error)\n\n✗ Lint! » 1 error and 0 warnings in 1 file\n + ... +ok 2 - coffeescript_good_1.coffee diff --git a/.automation/test/docker/reports/expected-DOCKER.tap b/.automation/test/docker/reports/expected-DOCKER.tap new file mode 100644 index 00000000..6aafb4c6 --- /dev/null +++ b/.automation/test/docker/reports/expected-DOCKER.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - Dockerfile + --- + message: \nFile /tmp/lint/.automation/test/docker/bad/Dockerfile\nIssues 6\n\nLine 1 from node latest\nIssue Category Title Description\n 1 Clarity Capitalize For clarity and readability, all instructions in a Dockerfile\n Dockerfile should be uppercase.\n Instructions This is a convention adopted by most of the official images and\n greatly improves readability in long Dockerfiles. For an example\n of\n why this makes a difference, check out the current [redis\n Dockerfile](https //github.com/docker-library/redis/blob/b375650fb6\n 9b7db819e90c0033433c705b28656e/3.0/Dockerfile)\n and you should be able to easily see the instructions used.\n 2 Clarity Base Image Latest Base images should not use the latest tag.\n Tag\n\nLine 4 run mkdir -p /usr/src/app\nIssue Category Title Description\n 3 Clarity Capitalize For clarity and readability, all instructions in a Dockerfile\n Dockerfile should be uppercase.\n Instructions This is a convention adopted by most of the official images and\n greatly improves readability in long Dockerfiles. For an example\n of\n why this makes a difference, check out the current [redis\n Dockerfile](https //github.com/docker-library/redis/blob/b375650fb6\n 9b7db819e90c0033433c705b28656e/3.0/Dockerfile)\n and you should be able to easily see the instructions used.\n\nLine 8 copy package.json /usr/src/app/ /here/there\nIssue Category Title Description\n 4 Clarity Capitalize For clarity and readability, all instructions in a Dockerfile\n Dockerfile should be uppercase.\n Instructions This is a convention adopted by most of the official images and\n greatly improves readability in long Dockerfiles. For an example\n of\n why this makes a difference, check out the current [redis\n Dockerfile](https //github.com/docker-library/redis/blob/b375650fb6\n 9b7db819e90c0033433c705b28656e/3.0/Dockerfile)\n and you should be able to easily see the instructions used.\n\nLine 9 RUN sudo npm install\nIssue Category Title Description\n 5 Possible Bug Use Of sudo Is Not Use of `sudo` is not allowed in a Dockerfile. From the official\n Allowed document [Best practices for writing\n Dockerfiles](https //docs.docker.com/engine/userguide/eng-image/doc\n kerfile_best-practices/) \n > You should avoid installing or using `sudo` since it has\n unpredictable TTY and signal-forwarding behavior that can cause\n more problems than it solves.\n > If you absolutely need functionality similar to `sudo` (e.g.,\n initializing the daemon as root but running it as non-root), you\n may be able to use `gosu`.\n\nLine 14 ENtrypoint /tmp/here.sh\nIssue Category Title Description\n 6 Clarity Capitalize For clarity and readability, all instructions in a Dockerfile\n Dockerfile should be uppercase.\n Instructions This is a convention adopted by most of the official images and\n greatly improves readability in long Dockerfiles. For an example\n of\n why this makes a difference, check out the current [redis\n Dockerfile](https //github.com/docker-library/redis/blob/b375650fb6\n 9b7db819e90c0033433c705b28656e/3.0/Dockerfile)\n and you should be able to easily see the instructions used.\n + ... +ok 2 - Dockerfile diff --git a/.automation/test/javascript/reports/expected-JAVASCRIPT_ES.tap b/.automation/test/javascript/reports/expected-JAVASCRIPT_ES.tap new file mode 100644 index 00000000..9e605d09 --- /dev/null +++ b/.automation/test/javascript/reports/expected-JAVASCRIPT_ES.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - javascript_bad_1.js + --- + message: \n/tmp/lint/.automation/test/javascript/javascript_bad_1.js\n 4 39 error Parsing error Unterminated regular expression literal\n\n✖ 1 problem (1 error, 0 warnings)\n + ... +ok 2 - javascript_good_1.js diff --git a/.automation/test/javascript/reports/expected-JAVASCRIPT_STANDARD.tap b/.automation/test/javascript/reports/expected-JAVASCRIPT_STANDARD.tap new file mode 100644 index 00000000..42d92b34 --- /dev/null +++ b/.automation/test/javascript/reports/expected-JAVASCRIPT_STANDARD.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - javascript_bad_1.js + --- + message: standard Use JavaScript Standard Style (https //standardjs.com)\n /tmp/lint/.automation/test/javascript/javascript_bad_1.js 4 40 Parsing error Unterminated regular expression\n + ... +ok 2 - javascript_good_1.js diff --git a/.automation/test/json/reports/expected-JSON.tap b/.automation/test/json/reports/expected-JSON.tap new file mode 100644 index 00000000..2b43a1ec --- /dev/null +++ b/.automation/test/json/reports/expected-JSON.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - json_bad_1.json + --- + message: Error Parse error on line 6 \n...ng" { "level" 'ignore', "space\n----------------------^\nExpecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'\n at Object.parseError (/usr/lib/node_modules/jsonlint/lib/jsonlint.js 55 11)\n at Object.parse (/usr/lib/node_modules/jsonlint/lib/jsonlint.js 132 22)\n at parse (/usr/lib/node_modules/jsonlint/lib/cli.js 82 14)\n at main (/usr/lib/node_modules/jsonlint/lib/cli.js 135 14)\n at Object. (/usr/lib/node_modules/jsonlint/lib/cli.js 179 1)\n at Module._compile (internal/modules/cjs/loader.js 1138 30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js 1158 10)\n at Module.load (internal/modules/cjs/loader.js 986 32)\n at Function.Module._load (internal/modules/cjs/loader.js 879 14)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js 71 12)\n + ... +ok 2 - json_good_1.json diff --git a/.automation/test/kotlin/reports/expected-KOTLIN.tap b/.automation/test/kotlin/reports/expected-KOTLIN.tap new file mode 100644 index 00000000..89c7fbc8 --- /dev/null +++ b/.automation/test/kotlin/reports/expected-KOTLIN.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - kotlin_bad_1.kt + --- + message: /tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 1 1 File must end with a newline (\n)\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 2 20 Unnecessary semicolon\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 16 Redundant curly braces\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 3 27 Unnecessary semicolon\n/tmp/lint/.automation/test/kotlin/kotlin_bad_1.kt 5 15 Unnecessary semicolon\n + ... +ok 2 - kotlint_good_1.kt diff --git a/.automation/test/markdown/reports/expected-MARKDOWN.tap b/.automation/test/markdown/reports/expected-MARKDOWN.tap new file mode 100644 index 00000000..8960605d --- /dev/null +++ b/.automation/test/markdown/reports/expected-MARKDOWN.tap @@ -0,0 +1,8 @@ +TAP version 13 +1..3 +ok 1 - README.md +not ok 2 - markdown_bad_1.md + --- + message: /tmp/lint/.automation/test/markdown/markdown_bad_1.md 1 MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context "## Bad Markdown"]\n/tmp/lint/.automation/test/markdown/markdown_bad_1.md 5 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected h3; Actual h6]\n/tmp/lint/.automation/test/markdown/markdown_bad_1.md 11 1 MD007/ul-indent Unordered list indentation [Expected 4; Actual 6]\n/tmp/lint/.automation/test/markdown/markdown_bad_1.md 13 MD040/fenced-code-language Fenced code blocks should have a language specified [Context "```"]\n/tmp/lint/.automation/test/markdown/markdown_bad_1.md 20 16 MD034/no-bare-urls Bare URL used [Context "https //github.com"]\n + ... +ok 3 - markdown_good_1.md diff --git a/.automation/test/perl/reports/expected-PERL.tap b/.automation/test/perl/reports/expected-PERL.tap new file mode 100644 index 00000000..932c3621 --- /dev/null +++ b/.automation/test/perl/reports/expected-PERL.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - perl_bad_1.pl + --- + message: Global symbol "$here" requires explicit package name (did you forget to declare "my $here"?) at /tmp/lint/.automation/test/perl/perl_bad_1.pl line 37.\n/tmp/lint/.automation/test/perl/perl_bad_1.pl had compilation errors.\n + ... +ok 2 - perl_good_1.pl diff --git a/.automation/test/php/reports/expected-PHP.tap b/.automation/test/php/reports/expected-PHP.tap new file mode 100644 index 00000000..48408065 --- /dev/null +++ b/.automation/test/php/reports/expected-PHP.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - php_bad_1.php + --- + message: PHP Parse error syntax error, unexpected 'pe98y' (T_STRING) in /tmp/lint/.automation/test/php/php_bad_1.php on line 3\nErrors parsing /tmp/lint/.automation/test/php/php_bad_1.php\n + ... +ok 2 - php_good_1.php diff --git a/.automation/test/python/reports/expected-PYTHON.tap b/.automation/test/python/reports/expected-PYTHON.tap new file mode 100644 index 00000000..1751d70f --- /dev/null +++ b/.automation/test/python/reports/expected-PYTHON.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - python_bad_1.py + --- + message: ************* Module python_bad_1\npython/python_bad_1.py 15 24 E0001 invalid syntax (, line 15) (syntax-error)\n + ... +ok 2 - python_good_1.py diff --git a/.automation/test/ruby/reports/expected-RUBY.tap b/.automation/test/ruby/reports/expected-RUBY.tap new file mode 100644 index 00000000..3f0a1372 --- /dev/null +++ b/.automation/test/ruby/reports/expected-RUBY.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - ruby_bad_1.rb + --- + message: /usr/lib/ruby/gems/2.7.0/gems/rubocop-0.74.0/lib/rubocop/config_loader_resolver.rb 76 warning Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call\n/usr/lib/ruby/gems/2.7.0/gems/rubocop-0.74.0/lib/rubocop/config_loader_resolver.rb 84 warning The called method `merge' is defined here\nInspecting 1 file\nC\n\nOffenses \n\nruby/ruby_bad_1.rb 1 1 C Style/FrozenStringLiteralComment Missing magic comment # frozen_string_literal true.\nruby/ruby_bad_1.rb 11 11 C Style/StringLiterals Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^^^^^^^^^^^^^^^\nruby/ruby_bad_1.rb 11 32 C Layout/SpaceInsideParens Space inside parentheses detected.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^\nruby/ruby_bad_1.rb 11 39 C Layout/SpaceAroundBlockParameters Space before first block parameter detected.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^\nruby/ruby_bad_1.rb 12 24 C Layout/SpaceAroundBlockParameters Space after last block parameter detected.\n Hook.active.map do |h |\n ^\nruby/ruby_bad_1.rb 13 13 C Layout/SpaceInsideArrayLiteralBrackets Do not use space inside array brackets.\n urls = [ ARRAY_OF_URLS_CALLING_INSTANCE]\n ^\n\n1 file inspected, 6 offenses detected\n + ... +ok 2 - ruby_good_1.rb diff --git a/.automation/test/shell/reports/expected-BASH.tap b/.automation/test/shell/reports/expected-BASH.tap new file mode 100644 index 00000000..f3bedca8 --- /dev/null +++ b/.automation/test/shell/reports/expected-BASH.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - shell_bad_1.sh + --- + message: \nIn /tmp/lint/.automation/test/shell/shell_bad_1.sh line 10 \nif [ $ERROR_CODE -ne 0]; then\n^-- SC1009 The mentioned syntax error was in this if expression.\n ^-- SC1073 Couldn't parse this test expression. Fix to allow more checks.\n ^-- SC1020 You need a space before the ].\n ^-- SC1072 Missing space before ]. Fix any mentioned problems and try again.\n\nFor more information \n https //www.shellcheck.net/wiki/SC1020 -- You need a space before the ].\n https //www.shellcheck.net/wiki/SC1072 -- Missing space before ]. Fix any m...\n https //www.shellcheck.net/wiki/SC1073 -- Couldn't parse this test expressi...\n + ... +ok 2 - shell_good_1.sh diff --git a/.automation/test/typescript/reports/expected-TYPESCRIPT_ES.tap b/.automation/test/typescript/reports/expected-TYPESCRIPT_ES.tap new file mode 100644 index 00000000..c08faa21 --- /dev/null +++ b/.automation/test/typescript/reports/expected-TYPESCRIPT_ES.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - typescript_bad_1.ts + --- + message: \n/tmp/lint/.automation/test/typescript/typescript_bad_1.ts\n 5 39 error Parsing error Unterminated regular expression literal\n\n✖ 1 problem (1 error, 0 warnings)\n + ... +ok 2 - typescript_good_1.ts diff --git a/.automation/test/typescript/reports/expected-TYPESCRIPT_STANDARD.tap b/.automation/test/typescript/reports/expected-TYPESCRIPT_STANDARD.tap new file mode 100644 index 00000000..1271fc8f --- /dev/null +++ b/.automation/test/typescript/reports/expected-TYPESCRIPT_STANDARD.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - typescript_bad_1.ts + --- + message: standard Use JavaScript Standard Style (https //standardjs.com)\n /tmp/lint/.automation/test/typescript/typescript_bad_1.ts 5 39 Parsing error Unterminated regular expression literal.\n + ... +ok 2 - typescript_good_1.ts diff --git a/.automation/test/xml/reports/expected-XML.tap b/.automation/test/xml/reports/expected-XML.tap new file mode 100644 index 00000000..4a3081b9 --- /dev/null +++ b/.automation/test/xml/reports/expected-XML.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - xml_bad_1.xml + --- + message: /tmp/lint/.automation/test/xml/xml_bad_1.xml 7 parser error EndTag '&1) + mapfile -t LIST_FILES < <(find "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER" -type f -regex "$FILE_EXTENSIONS" ! -path "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible/ghe-initialize/*" | sort 2>&1) + + ######################################## + # Prepare context if TAP output format # + ######################################## + if IsTAP ; then + TMPFILE=$(mktemp -q "/tmp/super-linter-${FILE_TYPE}.XXXXXX") + mkdir -p "${REPORT_OUTPUT_FOLDER}" + REPORT_OUTPUT_FILE="${REPORT_OUTPUT_FOLDER}/super-linter-${FILE_TYPE}.${OUTPUT_FORMAT}" + fi ################## # Lint the files # @@ -406,6 +415,11 @@ function TestCodebase() { ####################### ERROR_CODE=$? + ######################################## + # Increment counter that check was ran # + ######################################## + (("TESTS_RAN++")) + ######################################## # Check for if it was supposed to pass # ######################################## @@ -422,15 +436,17 @@ function TestCodebase() { echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]${NC}" # Increment the error count (("ERRORS_FOUND_$FILE_TYPE++")) - # Increment counter that check was ran - ((TESTS_RAN++)) else ########### # Success # ########### echo -e "${NC}${F[B]} - File:${F[W]}[$FILE_NAME]${F[B]} was linted with ${F[W]}[$LINTER_NAME]${F[B]} successfully${NC}" - # Increment counter that check was ran - ((TESTS_RAN++)) + fi + ####################################################### + # Store the linting as a temporary file in TAP format # + ####################################################### + if IsTAP ; then + echo "ok ${TESTS_RAN} - ${FILE_NAME}" >> "${TMPFILE}" fi else ####################################### @@ -449,19 +465,60 @@ function TestCodebase() { echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Linter CMD:[$LINTER_COMMAND $FILE]${NC}" # Increment the error count (("ERRORS_FOUND_$FILE_TYPE++")) - # Increment counter that check was ran - ((TESTS_RAN++)) else ########### # Success # ########### echo -e "${NC}${F[B]} - File:${F[W]}[$FILE_NAME]${F[B]} failed test case with ${F[W]}[$LINTER_NAME]${F[B]} successfully${NC}" - # Increment counter that check was ran - ((TESTS_RAN++)) + fi + ####################################################### + # Store the linting as a temporary file in TAP format # + ####################################################### + if IsTAP ; then + echo "not ok ${TESTS_RAN} - ${FILE_NAME}" >> "${TMPFILE}" + ########################################## + # Report the detailed message if enabled # + ########################################## + DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD") + if [ -n "${DETAILED_MSG}" ] ; then + printf " ---\n message: %s\n ...\n" "${DETAILED_MSG}" >> "${TMPFILE}" + fi fi fi done + ########################################################################### + # Generate report in TAP format and validate with the expected TAP output # + ########################################################################### + if IsTAP && [ ${TESTS_RAN} -gt 0 ] ; then + printf "TAP version 13\n1..%s\n" "${TESTS_RAN}" > "${REPORT_OUTPUT_FILE}" + cat "${TMPFILE}" >> "${REPORT_OUTPUT_FILE}" + + ######################################################################## + # If expected TAP report exists then compare with the generated report # + ######################################################################## + EXPECTED_FILE="$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$INDVIDUAL_TEST_FOLDER/reports/expected-${FILE_TYPE}.tap" + if [ -e "$EXPECTED_FILE" ] ; then + TMPFILE=$(mktemp -q "/tmp/diff-${FILE_TYPE}.XXXXXX") + ## Ignore white spaces, case sensitive + if ! diff -a -w -i "${EXPECTED_FILE}" "${REPORT_OUTPUT_FILE}" > "${TMPFILE}" 2>&1; then + ############################################# + # We failed to compare the reporting output # + ############################################# + echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to assert TAP output:[$LINTER_NAME]${NC}"! + echo "Please validate the asserts!" + cat "${TMPFILE}" + exit 1 + else + # Success + echo -e "${NC}${F[B]}Successfully validation in the expected TAP format for ${F[W]}[$LINTER_NAME]${NC}" + fi + else + echo -e "${NC}${F[Y]}WARN!${NC} No TAP expected file found at:[$EXPECTED_FILE]${NC}" + echo "skipping report assertions" + fi + fi + ############################## # Validate we ran some tests # ############################## From 759b5bac1f1eee48a3e05d2494ee0d2c0851b33b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 15 Jul 2020 22:26:24 +0100 Subject: [PATCH 2/7] no more duplicated entries for ok/not ok tap and tap header --- lib/worker.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/worker.sh b/lib/worker.sh index a04f1117..1fe46a02 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -219,7 +219,7 @@ function LintCodebase() { # Store the linting as a temporary file in TAP format # ####################################################### if IsTAP ; then - echo "not ok ${INDEX} - ${FILE}" >> "${TMPFILE}" + NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" ########################################## # Report the detailed message if enabled # ########################################## @@ -238,7 +238,7 @@ function LintCodebase() { # Store the linting as a temporary file in TAP format # ####################################################### if IsTAP ; then - echo "ok ${INDEX} - ${FILE}" >> "${TMPFILE}" + OkTap "${INDEX}" "${FILE}" "${TMPFILE}" fi fi done @@ -247,7 +247,7 @@ function LintCodebase() { # Generate report in TAP format # ################################# if IsTAP && [ ${INDEX} -gt 0 ] ; then - printf "TAP version 13\n1..%s\n" "${INDEX}" > "${REPORT_OUTPUT_FILE}" + HeaderTap "${INDEX}" "${REPORT_OUTPUT_FILE}" cat "${TMPFILE}" >> "${REPORT_OUTPUT_FILE}" fi fi @@ -446,7 +446,7 @@ function TestCodebase() { # Store the linting as a temporary file in TAP format # ####################################################### if IsTAP ; then - echo "ok ${TESTS_RAN} - ${FILE_NAME}" >> "${TMPFILE}" + OkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}" fi else ####################################### @@ -475,7 +475,7 @@ function TestCodebase() { # Store the linting as a temporary file in TAP format # ####################################################### if IsTAP ; then - echo "not ok ${TESTS_RAN} - ${FILE_NAME}" >> "${TMPFILE}" + NotOkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}" ########################################## # Report the detailed message if enabled # ########################################## @@ -491,7 +491,7 @@ function TestCodebase() { # Generate report in TAP format and validate with the expected TAP output # ########################################################################### if IsTAP && [ ${TESTS_RAN} -gt 0 ] ; then - printf "TAP version 13\n1..%s\n" "${TESTS_RAN}" > "${REPORT_OUTPUT_FILE}" + HeaderTap "${TESTS_RAN}" "${REPORT_OUTPUT_FILE}" cat "${TMPFILE}" >> "${REPORT_OUTPUT_FILE}" ######################################################################## @@ -759,7 +759,7 @@ function LintAnsibleFiles() { # Store the linting as a temporary file in TAP format # ####################################################### if IsTAP ; then - echo "not ok ${INDEX} - ${FILE}" >> "${TMPFILE}" + NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" ########################################## # Report the detailed message if enabled # ########################################## @@ -779,7 +779,7 @@ function LintAnsibleFiles() { # Store the linting as a temporary file in TAP format # ####################################################### if IsTAP ; then - echo "ok ${INDEX} - ${FILE}" >> "${TMPFILE}" + OkTap "${INDEX}" "${FILE}" "${TMPFILE}" fi fi done @@ -788,7 +788,7 @@ function LintAnsibleFiles() { # Generate report in TAP format # ################################# if IsTAP && [ ${INDEX} -gt 0 ] ; then - printf "TAP version 13\n1..%s\n" "${INDEX}" > "${REPORT_OUTPUT_FILE}" + HeaderTap "${INDEX}" "${REPORT_OUTPUT_FILE}" cat "${TMPFILE}" >> "${REPORT_OUTPUT_FILE}" fi else # No ansible directory found in path @@ -824,3 +824,18 @@ function TransformTAPDetails() { echo "${DATA}" | awk 'BEGIN{RS="\n";ORS="\\n"}1' | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | tr ':' ' ' fi } +################################################################################ +#### Function HeaderTap ######################################################## +function HeaderTap() { + printf "TAP version 13\n1..%s\n" "${1}" > "${2}" +} +################################################################################ +#### Function OkTap ############################################################ +function OkTap() { + echo "ok ${1} - ${2}" >> "${3}" +} +################################################################################ +#### Function NotOkTap ######################################################### +function NotOkTap() { + echo "not ok ${1} - ${2}" >> "${3}" +} \ No newline at end of file From cee9d3a95695554eb1b4664f1de5d585eb7761f9 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 15 Jul 2020 22:37:46 +0100 Subject: [PATCH 3/7] refactored AddDetailedMessageIfEnabled --- lib/worker.sh | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/worker.sh b/lib/worker.sh index 1fe46a02..36ea789b 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -220,13 +220,7 @@ function LintCodebase() { ####################################################### if IsTAP ; then NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" - ########################################## - # Report the detailed message if enabled # - ########################################## - DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD") - if [ -n "${DETAILED_MSG}" ] ; then - printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${TMPFILE}" - fi + AddDetailedMessageIfEnabled "$LINT_CMD" "${TMPFILE}" fi else ########### @@ -476,13 +470,7 @@ function TestCodebase() { ####################################################### if IsTAP ; then NotOkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}" - ########################################## - # Report the detailed message if enabled # - ########################################## - DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD") - if [ -n "${DETAILED_MSG}" ] ; then - printf " ---\n message: %s\n ...\n" "${DETAILED_MSG}" >> "${TMPFILE}" - fi + AddDetailedMessageIfEnabled "$LINT_CMD" "${TMPFILE}" fi fi done @@ -760,13 +748,7 @@ function LintAnsibleFiles() { ####################################################### if IsTAP ; then NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" - ########################################## - # Report the detailed message if enabled # - ########################################## - DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD") - if [ -n "${DETAILED_MSG}" ] ; then - printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${TMPFILE}" - fi + AddDetailedMessageIfEnabled "${LINT_CMD}" "${TMPFILE}" fi else @@ -838,4 +820,12 @@ function OkTap() { #### Function NotOkTap ######################################################### function NotOkTap() { echo "not ok ${1} - ${2}" >> "${3}" -} \ No newline at end of file +} +################################################################################ +#### Function AddDetailedMessageIfEnabled ###################################### +function AddDetailedMessageIfEnabled() { + DETAILED_MSG=$(TransformTAPDetails "${1}") + if [ -n "${DETAILED_MSG}" ] ; then + printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${2}" + fi +} From 9d6838169617a9da7db47919a653ef68c6507cac Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Sun, 19 Jul 2020 20:26:20 +0100 Subject: [PATCH 4/7] Generate report for the warnings --- lib/linter.sh | 9 +++++++++ lib/worker.sh | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/lib/linter.sh b/lib/linter.sh index c63df84e..b57fc05f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -177,6 +177,8 @@ TEST_CASE_FOLDER='.automation/test' # Folder for test c echo "${TEST_CASE_FOLDER}" > /dev/null 2>&1 || true # Workaround SC2034 DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory echo "${DEFAULT_ANSIBLE_DIRECTORY}" > /dev/null 2>&1 || true # Workaround SC2034 +WARNING_ARRAY_TEST=() # Array of warning linters that did not have an expected test result. +echo "${WARNING_ARRAY_TEST[*]}" > /dev/null 2>&1 || true # Workaround SC2034 ############## # Format # @@ -784,6 +786,13 @@ Footer() { fi done + ################################ + # Prints for warnings if found # + ################################ + for TEST in "${WARNING_ARRAY_TEST[@]}"; do + echo -e "${NC}${F[Y]}WARN!${NC} Expected file to compare with was not found for ${TEST}${NC}" + done + ################################## # Exit with 0 if errors disabled # ################################## diff --git a/lib/worker.sh b/lib/worker.sh index 918f5361..721d7022 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -504,6 +504,10 @@ function TestCodebase() { else echo -e "${NC}${F[Y]}WARN!${NC} No TAP expected file found at:[$EXPECTED_FILE]${NC}" echo "skipping report assertions" + ##################################### + # Append the file type to the array # + ##################################### + WARNING_ARRAY_TEST+=("${FILE_TYPE}") fi fi From 0bc699a72ff60259eaf3c2d150437f5e3911ec99 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Sun, 19 Jul 2020 20:38:18 +0100 Subject: [PATCH 5/7] Add more expected reports validations --- .automation/test/arm/reports/expected-ARM.tap | 7 ++++++ .automation/test/cfn/reports/expected-CFN.tap | 22 +++++++++++++++++++ .../reports/expected-CLOJURE.tap.ignored | 7 ++++++ .automation/test/css/reports/expected-CSS.tap | 7 ++++++ .../test/dart/reports/expected-DART.tap | 7 ++++++ .automation/test/env/reports/expected-ENV.tap | 7 ++++++ .../golang/reports/expected-GO.tap.ignored | 7 ++++++ .../html/reports/expected-HTML.tap.ignored | 7 ++++++ .../test/json/reports/expected-JSON.tap | 2 +- .../test/openapi/reports/expected-OPENAPI.tap | 12 ++++++++++ .../reports/expected-POWERSHELL.tap.ignored | 17 ++++++++++++++ .../protobuf/reports/expected-PROTOBUF.tap | 7 ++++++ .../test/raku/reports/expected-RAKU.tap | 7 ++++++ .../test/ruby/reports/expected-RUBY.tap | 2 +- .../terraform/reports/expected-TERRAFORM.tap | 7 ++++++ 15 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 .automation/test/arm/reports/expected-ARM.tap create mode 100644 .automation/test/cfn/reports/expected-CFN.tap create mode 100644 .automation/test/clojure/reports/expected-CLOJURE.tap.ignored create mode 100644 .automation/test/css/reports/expected-CSS.tap create mode 100644 .automation/test/dart/reports/expected-DART.tap create mode 100644 .automation/test/env/reports/expected-ENV.tap create mode 100644 .automation/test/golang/reports/expected-GO.tap.ignored create mode 100644 .automation/test/html/reports/expected-HTML.tap.ignored create mode 100644 .automation/test/openapi/reports/expected-OPENAPI.tap create mode 100644 .automation/test/powershell/reports/expected-POWERSHELL.tap.ignored create mode 100644 .automation/test/protobuf/reports/expected-PROTOBUF.tap create mode 100644 .automation/test/raku/reports/expected-RAKU.tap create mode 100644 .automation/test/terraform/reports/expected-TERRAFORM.tap diff --git a/.automation/test/arm/reports/expected-ARM.tap b/.automation/test/arm/reports/expected-ARM.tap new file mode 100644 index 00000000..1866f179 --- /dev/null +++ b/.automation/test/arm/reports/expected-ARM.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - arm_bad_1.json + --- + message: \nValidating arm\arm_bad_1.json\n deploymentTemplate\n [+] adminUsername Should Not Be A Literal (109 ms)\n [+] apiVersions Should Be Recent (121 ms)\n [+] artifacts parameter (13 ms)\n [+] DependsOn Best Practices (7 ms)\n [+] Deployment Resources Must Not Be Debug (6 ms)\n [+] DeploymentTemplate Schema Is Correct (4 ms)\n [+] Dynamic Variable References Should Not Use Concat (8 ms)\n [+] IDs Should Be Derived From ResourceIDs (40 ms)\n [?] Location Should Not Be Hardcoded (5 ms)\n Skipped because IsMainTemplate was missing\n\n [+] ManagedIdentityExtension must not be used (54 ms)\n [+] Min And Max Value Are Numbers (6 ms)\n [+] Outputs Must Not Contain Secrets (15 ms)\n [+] Parameters Must Be Referenced (9 ms)\n [+] Parameters Property Must Exist (2 ms)\n [+] providers apiVersions Is Not Permitted (2 ms)\n [+] ResourceIds should not contain (14 ms)\n [+] Resources Should Have Location (3 ms)\n [+] Secure String Parameters Cannot Have Default (4 ms)\n [-] Template Should Not Contain Blanks (33 ms)\n Empty property [] found on line 28 Index 1331\n Empty property "" found on line 3 Index 121\n\n [-] Variables Must Be Referenced (35 ms)\n Unreferenced variable Network.Location\n Unreferenced variable Test.Blank.Variable\n\n [+] Virtual Machines Should Not Be Preview (17 ms)\n [+] VM Images Should Use Latest Version (1 ms)\n [+] VM Size Should Be A Parameter (15 ms)\n \n + ... +ok 2 - arm_good_1.json diff --git a/.automation/test/cfn/reports/expected-CFN.tap b/.automation/test/cfn/reports/expected-CFN.tap new file mode 100644 index 00000000..98466237 --- /dev/null +++ b/.automation/test/cfn/reports/expected-CFN.tap @@ -0,0 +1,22 @@ +TAP version 13 +1..8 +not ok 1 - cfn_bad_1.json + --- + message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cfn/cfn_bad_1.json 6 10\n + ... +not ok 2 - cfn_bad_2.yaml + --- + message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cfn/cfn_bad_2.yaml 5 5\n + ... +not ok 3 - cfn_bad_3.json + --- + message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cfn/cfn_bad_3.json 11 13\n + ... +not ok 4 - cfn_bad_4.yaml + --- + message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cfn/cfn_bad_4.yaml 9 7\n + ... +ok 5 - cfn_good_1.json +ok 6 - cfn_good_2.yaml +ok 7 - cfn_good_3.json +ok 8 - cfn_good_4.yaml diff --git a/.automation/test/clojure/reports/expected-CLOJURE.tap.ignored b/.automation/test/clojure/reports/expected-CLOJURE.tap.ignored new file mode 100644 index 00000000..63784819 --- /dev/null +++ b/.automation/test/clojure/reports/expected-CLOJURE.tap.ignored @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - clojure_bad_1.clj + --- + message: /tmp/lint/.automation/test/clojure/clojure_bad_1.clj 5 5 warning namespace clojure.set is required but never used\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 8 2 error unresolved symbol but-last\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 12 1 error clojure.string/join is called with 0 args but expects 1 or 2\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 15 17 warning unused binding y\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 17 3 warning redundant do\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 19 5 warning inline def\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 22 7 warning Redundant let expression.\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 22 13 warning unused binding z\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 24 9 error y is called with 1 arg but expects 0\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 26 9 error recur argument count mismatch (expected 2, got 0)\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 29 9 error h is called with 1 arg but expects 0\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 30 9 error f is called with 1 arg but expects 0\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 34 1 warning redefined var #'foo/private-fn\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 34 8 warning Unused private var foo/private-fn\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 38 6 error Expected number, received keyword.\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 42 1 error java.lang.Thread/sleep is called with 3 args but expects 1 or 2\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 48 1 error foo/foo-fn is called with 0 args but expects 2\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 51 1 error #'foo/private-fn is private\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 54 7 error duplicate key a\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 56 5 error duplicate set element 1\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 58 7 error missing value for key b\n/tmp/lint/.automation/test/clojure/clojure_bad_1.clj 64 3 warning missing test assertion\nlinting took 18ms, errors 13, warnings 9\n + ... +ok 2 - clojure_good_1.clj diff --git a/.automation/test/css/reports/expected-CSS.tap b/.automation/test/css/reports/expected-CSS.tap new file mode 100644 index 00000000..98d94702 --- /dev/null +++ b/.automation/test/css/reports/expected-CSS.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - css_bad_01.css + --- + message: \ncss/css_bad_01.css\n 2 1 ✖ Expected empty line before comment comment-empty-line-before\n 3 1 ✖ Expected empty line before comment comment-empty-line-before\n 5 5 ✖ Expected indentation of 2 spaces indentation \n 5 33 ✖ Expected "#FFFFFF" to be "#ffffff" color-hex-case \n 5 33 ✖ Expected "#FFFFFF" to be "#FFF" color-hex-length \n 6 5 ✖ Expected indentation of 2 spaces indentation \n 7 5 ✖ Expected indentation of 2 spaces indentation \n 8 5 ✖ Expected indentation of 2 spaces indentation \n 8 12 ✖ Expected "#AAAAAA" to be "#aaaaaa" color-hex-case \n 8 12 ✖ Expected "#AAAAAA" to be "#AAA" color-hex-length\n + ... +ok 2 - css_good_01.css diff --git a/.automation/test/dart/reports/expected-DART.tap b/.automation/test/dart/reports/expected-DART.tap new file mode 100644 index 00000000..6ca0aa21 --- /dev/null +++ b/.automation/test/dart/reports/expected-DART.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - dart_bad_1.dart + --- + message: Analyzing /tmp/lint/.automation/test/dart/dart_bad_1.dart...\n lint • Use `;` instead of `{}` for empty constructor bodies. • dart/dart_bad_1.dart 4 25 • empty_constructor_bodies\n1 lint found.\n + ... +ok 2 - dart_good_1.dart diff --git a/.automation/test/env/reports/expected-ENV.tap b/.automation/test/env/reports/expected-ENV.tap new file mode 100644 index 00000000..73030e1c --- /dev/null +++ b/.automation/test/env/reports/expected-ENV.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - env_bad_1.env + --- + message: env/env_bad_1.env 1 LeadingCharacter Invalid leading character detected\nenv/env_bad_1.env 2 KeyWithoutValue The MY_ENV key should be with a value or have an equal sign\nenv/env_bad_1.env 3 IncorrectDelimiter The DB-NAME key has incorrect delimiter\nenv/env_bad_1.env 3 UnorderedKey The DB-NAME key should go before the LOGGER_LEVEL key\nenv/env_bad_1.env 4 LowercaseKey The DEbUG_hTTP key should be in uppercase\nenv/env_bad_1.env 4 UnorderedKey The DEbUG_hTTP key should go before the LOGGER_LEVEL key\nenv/env_bad_1.env 5 UnorderedKey The DB_NAME key should go before the DEbUG_hTTP key\n + ... +ok 2 - env_good_1.env diff --git a/.automation/test/golang/reports/expected-GO.tap.ignored b/.automation/test/golang/reports/expected-GO.tap.ignored new file mode 100644 index 00000000..13d6c1a7 --- /dev/null +++ b/.automation/test/golang/reports/expected-GO.tap.ignored @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - golang_bad_01.go + --- + message: level=error msg="[linters context] typechecking error golang/golang_bad_01.go 1 1 expected 'package', found 'if'"\nlevel=warning msg="[runner] Can't run linter goanalysis_metalinter S1005 failed prerequisites [(inspect@command-line-arguments, isgenerated@command-line-arguments) analysis skipped errors in package [- golang/golang_bad_01.go 1 1 expected 'package', found 'if']]"\nlevel=warning msg="[runner] Can't run linter unused buildir analysis skipped errors in package [- golang/golang_bad_01.go 1 1 expected 'package', found 'if']"\nlevel=error msg="Running error buildir analysis skipped errors in package [- golang/golang_bad_01.go 1 1 expected 'package', found 'if']"\n + ... +ok 2 - golang_good_01.go diff --git a/.automation/test/html/reports/expected-HTML.tap.ignored b/.automation/test/html/reports/expected-HTML.tap.ignored new file mode 100644 index 00000000..68a1d69f --- /dev/null +++ b/.automation/test/html/reports/expected-HTML.tap.ignored @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - html_bad_01.html + --- + message: \n Config loaded /tmp/lint/.github/linters/.htmlhintrc\n\n /tmp/lint/.automation/test/html/html_bad_01.html\n L8 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L8 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L8 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L9 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L9 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L9 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L10 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L10 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L10 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L11 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L11 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L11 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L12 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L12 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L12 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L13 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L13 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L13 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L14 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L14 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L14 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L15 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L15 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L15 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L16 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L16 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L16 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L17 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L17 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L17 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L18 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L18 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L18 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L19 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L19 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L19 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L20 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L20 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L20 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L21 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L21 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L21 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L22 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L22 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L22 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L23 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L23 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L23 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L24 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L24 |
\n ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)\n L24 |
\n ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)\n L25 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L26 |
\n ^ Special characters must be escaped [ < ]. (spec-char-escape)\n L26 |
\n ^ Special characters must be escaped [ > ]. (spec-char-escape)\n L28 |
\n ^ Tag must be paired, no start tag [
] (tag-pair)\n L29 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L30 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L31 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L32 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L38 |
\n ^ The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes)\n L38 |
\n ^ The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes)\n L38 |
\n ^ The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes)\n L44 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L50 |
\n ^ The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes)\n L50 |
\n ^ The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes)\n L50 |
\n ^ The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes)\n L56 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L62 |
\n ^ The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes)\n L62 |
\n ^ The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes)\n L62 |
\n ^ The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes)\n L68 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L74 |
\n ^ The value of attribute [ class ] must be in double quotes. (attr-value-double-quotes)\n L74 |
\n ^ The value of attribute [ what ] must be in double quotes. (attr-value-double-quotes)\n L74 |
\n ^ The value of attribute [ something ] must be in double quotes. (attr-value-double-quotes)\n L80 | \n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L81 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L82 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L83 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L84 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L85 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L86 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L87 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L88 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L89 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L90 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L91 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L92 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L93 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L94 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L95 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L96 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n L97 |\n ^ Tag must be paired, no start tag [ ] (tag-pair)\n\nScanned 1 files, found 92 errors in 1 files (27 ms)\n + ... +ok 2 - html_good_01.html diff --git a/.automation/test/json/reports/expected-JSON.tap b/.automation/test/json/reports/expected-JSON.tap index 2b43a1ec..e9be32b5 100644 --- a/.automation/test/json/reports/expected-JSON.tap +++ b/.automation/test/json/reports/expected-JSON.tap @@ -2,6 +2,6 @@ TAP version 13 1..2 not ok 1 - json_bad_1.json --- - message: Error Parse error on line 6 \n...ng" { "level" 'ignore', "space\n----------------------^\nExpecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'\n at Object.parseError (/usr/lib/node_modules/jsonlint/lib/jsonlint.js 55 11)\n at Object.parse (/usr/lib/node_modules/jsonlint/lib/jsonlint.js 132 22)\n at parse (/usr/lib/node_modules/jsonlint/lib/cli.js 82 14)\n at main (/usr/lib/node_modules/jsonlint/lib/cli.js 135 14)\n at Object. (/usr/lib/node_modules/jsonlint/lib/cli.js 179 1)\n at Module._compile (internal/modules/cjs/loader.js 1138 30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js 1158 10)\n at Module.load (internal/modules/cjs/loader.js 986 32)\n at Function.Module._load (internal/modules/cjs/loader.js 879 14)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js 71 12)\n + message: Error Parse error on line 6 \n...ng" { "level" 'ignore', "space\n----------------------^\nExpecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'\n at Object.parseError (/node_modules/jsonlint/lib/jsonlint.js 55 11)\n at Object.parse (/node_modules/jsonlint/lib/jsonlint.js 132 22)\n at parse (/node_modules/jsonlint/lib/cli.js 82 14)\n at main (/node_modules/jsonlint/lib/cli.js 135 14)\n at Object. (/node_modules/jsonlint/lib/cli.js 179 1)\n at Module._compile (internal/modules/cjs/loader.js 1138 30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js 1158 10)\n at Module.load (internal/modules/cjs/loader.js 986 32)\n at Function.Module._load (internal/modules/cjs/loader.js 879 14)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js 71 12)\n ... ok 2 - json_good_1.json diff --git a/.automation/test/openapi/reports/expected-OPENAPI.tap b/.automation/test/openapi/reports/expected-OPENAPI.tap new file mode 100644 index 00000000..a57d14bc --- /dev/null +++ b/.automation/test/openapi/reports/expected-OPENAPI.tap @@ -0,0 +1,12 @@ +TAP version 13 +1..4 +not ok 1 - openapi_bad_1.ymlopenapi + --- + message: OpenAPI 3.x detected\n\n/tmp/lint/.automation/test/openapi/openapi_bad_1.ymlopenapi\n 1 1 warning info-contact Info object should contain `contact` object.\n 1 1 warning info-description OpenAPI object info `description` must be present and non-empty string.\n 1 1 warning oas3-api-servers OpenAPI `servers` must be present and non-empty array.\n 1 1 error oas3-schema Object should have required property `info`.\n 1 1 warning openapi-tags OpenAPI object should have non-empty `tags` array.\n\n✖ 5 problems (1 error, 4 warnings, 0 infos, 0 hints)\n + ... +not ok 2 - openapi_bad_2.jsonopenapi + --- + message: OpenAPI 3.x detected\n\n/tmp/lint/.automation/test/openapi/openapi_bad_2.jsonopenapi\n 1 1 warning info-contact Info object should contain `contact` object.\n 1 1 warning info-description OpenAPI object info `description` must be present and non-empty string.\n 1 1 warning oas3-api-servers OpenAPI `servers` must be present and non-empty array.\n 1 1 error oas3-schema Object should have required property `info`.\n 1 1 warning openapi-tags OpenAPI object should have non-empty `tags` array.\n\n✖ 5 problems (1 error, 4 warnings, 0 infos, 0 hints)\n + ... +ok 3 - openapi_good_1.ymlopenapi +ok 4 - openapi_good_2.jsonopenapi diff --git a/.automation/test/powershell/reports/expected-POWERSHELL.tap.ignored b/.automation/test/powershell/reports/expected-POWERSHELL.tap.ignored new file mode 100644 index 00000000..c1ba772d --- /dev/null +++ b/.automation/test/powershell/reports/expected-POWERSHELL.tap.ignored @@ -0,0 +1,17 @@ +TAP version 13 +1..6 +not ok 1 - powershell_bad_1.ps1 + --- + message: \nRuleName Severity ScriptName Line Message\n-------- -------- ---------- ---- -------\nPSAvoidUsingEmptyCatchBlock Warning powershell 12 Empty catch b\n _bad_1.ps1 lock is used.\n Please use W\n rite-Error or\n throw statem\n ents in catch\n blocks.\nPSAvoidUsingUsernameAndPasswordPara Error powershell 4 Function 'Bad\nms _bad_1.ps1 Function' has\n both Usernam\n e and Passwor\n d parameters.\n Either set t\n he type of th\n e Password pa\n rameter to Se\n cureString or\n replace the\n Username and\n Password para\n meters with a\n Credential p\n arameter of t\n ype PSCredent\n ial. If using\n a Credential\n parameter in\n PowerShell 4\n .0 or earlier\n , please defi\n ne a credenti\n al transforma\n tion attribut\n e after the P\n SCredential t\n ype attribute\n .\nPSAvoidTrailingWhitespace Information powershell 11 Line has trai\n _bad_1.ps1 ling whitespa\n ce\nPSAvoidUsingPlainTextForPassword Warning powershell 5 Parameter '$P\n _bad_1.ps1 assword' shou\n ld use Secure\n String, other\n wise this wil\n l expose sens\n itive informa\n tion. See Con\n vertTo-Secure\n String for mo\n re informatio\n n.\nPSUseDeclaredVarsMoreThanAssignment Warning powershell 9 The variable\ns _bad_1.ps1 'VariableThat\n IsNotUsedLate\n r' is assigne\n d but never u\n sed.\n + ... +not ok 2 - powershell_bad_1.psd1 + --- + message: \nRuleName Severity ScriptName Line Message\n-------- -------- ---------- ---- -------\nTerminatorExpectedAtEndOfString ParseError powershell 2 The string is\n _bad_1.psd missing the\n 1 terminator '\n .\nMissingEndCurlyBrace ParseError powershell 1 Missing closi\n _bad_1.psd ng '}' in sta\n 1 tement block\n or type defin\n ition.\n + ... +not ok 3 - powershell_bad_1.psm1 + --- + message: \nRuleName Severity ScriptName Line Message\n-------- -------- ---------- ---- -------\nTerminatorExpectedAtEndOfString ParseError powershell 1 The string is\n _bad_1.psm missing the\n 1 terminator "\n .\n + ... +ok 4 - powershell_good_1.ps1 +ok 5 - powershell_good_1.psd1 +ok 6 - powershell_good_1.psm1 diff --git a/.automation/test/protobuf/reports/expected-PROTOBUF.tap b/.automation/test/protobuf/reports/expected-PROTOBUF.tap new file mode 100644 index 00000000..14453e36 --- /dev/null +++ b/.automation/test/protobuf/reports/expected-PROTOBUF.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - protobuf_bad_1.proto + --- + message: [protobuf/protobuf_bad_1.proto 8 1] The order of Import is invalid. Check if the file is ordered in the correct manner.\n[protobuf/protobuf_bad_1.proto 18 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 19 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 20 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 21 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 24 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 26 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 28 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 25 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 27 7] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 29 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 30 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 31 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 34 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 47 5] Found an incorrect indentation style " ". " " is correct.\n[protobuf/protobuf_bad_1.proto 3 1] The line length is 91, but it must be shorter than 80\n[protobuf/protobuf_bad_1.proto 4 1] Package name "examplePb" must only contains lowercase letters, digits and/or periods.\n[protobuf/protobuf_bad_1.proto 8 1] Imports are not sorted.\n[protobuf/protobuf_bad_1.proto 9 1] Imports are not sorted.\n[protobuf/protobuf_bad_1.proto 14 1] Imports are not sorted.\n[protobuf/protobuf_bad_1.proto 15 1] Imports are not sorted.\n[protobuf/protobuf_bad_1.proto 19 5] EnumField name "UNKNOWN" with zero value should have the suffix "UNSPECIFIED"\n[protobuf/protobuf_bad_1.proto 17 1] Enum name "enumAllowingAlias" must be UpperCamelCase\n[protobuf/protobuf_bad_1.proto 36 3] Field "inner_message" should avoid required for proto3\n[protobuf/protobuf_bad_1.proto 37 3] Group "Result" should be avoided for proto3\n[protobuf/protobuf_bad_1.proto 40 3] Group "Result" should be avoided for proto3\n[protobuf/protobuf_bad_1.proto 43 3] Group "Regular" should be avoided for proto3\n[protobuf/protobuf_bad_1.proto 29 5] Repeated field name "inner_message" must be pluralized name "inner_messages"\n[protobuf/protobuf_bad_1.proto 40 3] Repeated group name "Result" must be pluralized name "Results"\n[protobuf/protobuf_bad_1.proto 42 3] Repeated field name "paper" must be pluralized name "papers"\n[protobuf/protobuf_bad_1.proto 43 3] Repeated group name "Regular" must be pluralized name "Regulars"\n[protobuf/protobuf_bad_1.proto 23 1] Message name "outer" must be UpperCamelCase\n[protobuf/protobuf_bad_1.proto 26 5] Message name "inner" must be UpperCamelCase\n[protobuf/protobuf_bad_1.proto 47 5] RPC name "search" must be UpperCamelCase\n + ... +ok 2 - protobuf_good_1.proto diff --git a/.automation/test/raku/reports/expected-RAKU.tap b/.automation/test/raku/reports/expected-RAKU.tap new file mode 100644 index 00000000..13ce7ff5 --- /dev/null +++ b/.automation/test/raku/reports/expected-RAKU.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - raku_bad_1.raku + --- + message: ===SORRY!=== Error while compiling /tmp/lint/.automation/test/raku/raku_bad_1.raku\nVariable '$foo' is not declared. Did you mean '@foo'?\nat /tmp/lint/.automation/test/raku/raku_bad_1.raku 4\n------> ⏏$foo[1] = 42\n + ... +ok 2 - raku_good_1.raku diff --git a/.automation/test/ruby/reports/expected-RUBY.tap b/.automation/test/ruby/reports/expected-RUBY.tap index 3f0a1372..df404771 100644 --- a/.automation/test/ruby/reports/expected-RUBY.tap +++ b/.automation/test/ruby/reports/expected-RUBY.tap @@ -2,6 +2,6 @@ TAP version 13 1..2 not ok 1 - ruby_bad_1.rb --- - message: /usr/lib/ruby/gems/2.7.0/gems/rubocop-0.74.0/lib/rubocop/config_loader_resolver.rb 76 warning Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call\n/usr/lib/ruby/gems/2.7.0/gems/rubocop-0.74.0/lib/rubocop/config_loader_resolver.rb 84 warning The called method `merge' is defined here\nInspecting 1 file\nC\n\nOffenses \n\nruby/ruby_bad_1.rb 1 1 C Style/FrozenStringLiteralComment Missing magic comment # frozen_string_literal true.\nruby/ruby_bad_1.rb 11 11 C Style/StringLiterals Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^^^^^^^^^^^^^^^\nruby/ruby_bad_1.rb 11 32 C Layout/SpaceInsideParens Space inside parentheses detected.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^\nruby/ruby_bad_1.rb 11 39 C Layout/SpaceAroundBlockParameters Space before first block parameter detected.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^\nruby/ruby_bad_1.rb 12 24 C Layout/SpaceAroundBlockParameters Space after last block parameter detected.\n Hook.active.map do |h |\n ^\nruby/ruby_bad_1.rb 13 13 C Layout/SpaceInsideArrayLiteralBrackets Do not use space inside array brackets.\n urls = [ ARRAY_OF_URLS_CALLING_INSTANCE]\n ^\n\n1 file inspected, 6 offenses detected\n + message: Inspecting 1 file\nC\n\nOffenses \n\nruby/ruby_bad_1.rb 1 1 C Style/FrozenStringLiteralComment Missing frozen string literal comment.\nruby/ruby_bad_1.rb 11 11 C Style/StringLiterals Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^^^^^^^^^^^^^^^\nruby/ruby_bad_1.rb 11 32 C Layout/SpaceInsideParens Space inside parentheses detected.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^\nruby/ruby_bad_1.rb 11 39 C Layout/SpaceAroundBlockParameters Space before first block parameter detected.\nFile.open('/tmp/urls.txt', " w" ) do | file|\n ^\nruby/ruby_bad_1.rb 12 24 C Layout/SpaceAroundBlockParameters Space after last block parameter detected.\n Hook.active.map do |h |\n ^\nruby/ruby_bad_1.rb 13 13 C Layout/SpaceInsideArrayLiteralBrackets Do not use space inside array brackets.\n urls = [ ARRAY_OF_URLS_CALLING_INSTANCE]\n ^\n\n1 file inspected, 6 offenses detected\n ... ok 2 - ruby_good_1.rb diff --git a/.automation/test/terraform/reports/expected-TERRAFORM.tap b/.automation/test/terraform/reports/expected-TERRAFORM.tap new file mode 100644 index 00000000..3434675d --- /dev/null +++ b/.automation/test/terraform/reports/expected-TERRAFORM.tap @@ -0,0 +1,7 @@ +TAP version 13 +1..2 +not ok 1 - terraform_bad_1.tf + --- + message: Failed to load configurations. 1 error(s) occurred \n\nError Invalid expression\n\n on /tmp/lint/.automation/test/terraform/bad/terraform_bad_1.tf line 3, in resource "aws_instance" "bad" \n 3 instance_type = # invalid type!\n 4 }\n\nExpected the start of an expression, but found an invalid expression token.\n + ... +ok 2 - terraform_good_1.tf From c7887882ae07c779c2f565a86e05acc6fc3af23e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Sun, 19 Jul 2020 20:54:41 +0100 Subject: [PATCH 6/7] ARM linting uses the execution time --- .../arm/reports/{expected-ARM.tap => expected-ARM.tap.ignored} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .automation/test/arm/reports/{expected-ARM.tap => expected-ARM.tap.ignored} (100%) diff --git a/.automation/test/arm/reports/expected-ARM.tap b/.automation/test/arm/reports/expected-ARM.tap.ignored similarity index 100% rename from .automation/test/arm/reports/expected-ARM.tap rename to .automation/test/arm/reports/expected-ARM.tap.ignored From 3327bab09fd8ed24c414bd93e444fe50ffef9b52 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 08:14:40 -0500 Subject: [PATCH 7/7] Adding some additional details --- lib/worker.sh | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/lib/worker.sh b/lib/worker.sh index 721d7022..3c1c82c3 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -813,23 +813,61 @@ function TransformTAPDetails() { ################################################################################ #### Function HeaderTap ######################################################## function HeaderTap() { - printf "TAP version 13\n1..%s\n" "${1}" > "${2}" + ################ + # Pull in Vars # + ################ + INDEX="$1" # File being validated + OUTPUT_FILE="$2" # Output location + + ################### + # Print the goods # + ################### + printf "TAP version 13\n1..%s\n" "${INDEX}" > "${OUTPUT_FILE}" } ################################################################################ #### Function OkTap ############################################################ function OkTap() { - echo "ok ${1} - ${2}" >> "${3}" + ################ + # Pull in Vars # + ################ + INDEX="$1" # Location + FILE="$2" # File being validated + TEMP_FILE="$3" # Temp file location + + ################### + # Print the goods # + ################### + echo "ok ${INDEX} - ${FILE}" >> "${TEMP_FILE}" } ################################################################################ #### Function NotOkTap ######################################################### function NotOkTap() { - echo "not ok ${1} - ${2}" >> "${3}" + ################ + # Pull in Vars # + ################ + INDEX="$1" # Location + FILE="$2" # File being validated + TEMP_FILE="$3" # Temp file location + + ################### + # Print the goods # + ################### + echo "not ok ${INDEX} - ${FILE}" >> "${TEMP_FILE}" } ################################################################################ #### Function AddDetailedMessageIfEnabled ###################################### function AddDetailedMessageIfEnabled() { - DETAILED_MSG=$(TransformTAPDetails "${1}") + ################ + # Pull in Vars # + ################ + LINT_CMD="$1" # Linter command + TEMP_FILE="$2" # Temp file + + #################### + # Check the return # + #################### + DETAILED_MSG=$(TransformTAPDetails "${LINT_CMD}") if [ -n "${DETAILED_MSG}" ] ; then - printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${2}" + printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${TEMP_FILE}" fi }