Merge branch 'master' into dart

This commit is contained in:
Casey Vega 2020-07-06 22:03:31 -07:00 committed by GitHub
commit 00bcbfb897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 136 additions and 10 deletions

View file

@ -0,0 +1,13 @@
# Raku Test Cases
This folder holds the test cases for **Raku**.
## Additional Docs
No Additional information is needed for this test case.
## Good Test Cases
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
- **Note:** They are linted utilizing the default linter rules.
## Bad Test Cases
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
- **Note:** They are linted utilizing the default linter rules.

View file

@ -0,0 +1,4 @@
use v6.d;
my @foo;
$foo[1] = 42

View file

@ -0,0 +1,4 @@
use v6;
my @foo;
@foo[1] = 42

View file

@ -4,7 +4,7 @@ template: |
# Changelog
$CHANGES
See details of [all code changes](https://github.com/github/super-linter/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since last release
See details of [all code changes](https://github.com/github/super-linter/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release
categories:
- title: '🚀 Features'

View file

@ -32,6 +32,10 @@ ARG ARM_TTK_DIRECTORY='/opt/microsoft/arm-ttk'
ARG CLJ_KONDO_VERSION='2020.06.21'
# Go Linter
ARG GO_VERSION='v1.27.0'
# Raku Linter
ARG RAKU_VER="2020.06"
ARG RAKU_INSTALL_PATH=/usr
ARG RAKUBREW_HOME=/tmp/rakubrew
####################
# Run APK installs #
@ -47,7 +51,9 @@ RUN apk add --no-cache \
php7 \
ca-certificates less ncurses-terminfo-base \
krb5-libs libgcc libintl libssl1.1 libstdc++ \
tzdata userspace-rcu zlib icu-libs lttng-ust
tzdata userspace-rcu zlib icu-libs lttng-ust \
libffi-dev openssl-dev
#########################################
# Install Powershell + PSScriptAnalyzer #
@ -197,6 +203,24 @@ RUN wget https://storage.googleapis.com/dart-archive/channels/stable/release/${D
&& mv dart-sdk/bin/* /usr/bin/ && mv dart-sdk/lib/* /usr/lib/ && mv dart-sdk/include/* /usr/include/ \
&& rm -r dart-sdk/
################
# Install Raku #
################
# Environment
ENV PATH="$RAKU_INSTALL_PATH/share/perl6/site/bin:${PATH}"
# Basic setup, programs and init
RUN mkdir -p $RAKUBREW_HOME/bin \
&& curl -sSLo $RAKUBREW_HOME/bin/rakubrew https://rakubrew.org/perl/rakubrew \
&& chmod 755 $RAKUBREW_HOME/bin/rakubrew \
&& eval "$($RAKUBREW_HOME/bin/rakubrew init Sh)"\
&& rakubrew build moar $RAKU_VER --configure-opts='--prefix=$RAKU_INSTALL_PATH' \
&& rm -rf $RAKUBREW_HOME/versions/moar-$RAKU_VER \
&& rakubrew build-zef \
&& rm -rf $RAKUBREW_HOME
################################
# Install editorconfig-checker #
################################
@ -218,6 +242,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
VALIDATE_MD=${VALIDATE_MD} \
VALIDATE_BASH=${VALIDATE_BASH} \
VALIDATE_PERL=${VALIDATE_PERL} \
VALIDATE_RAKU=${VALIDATE_RAKU} \
VALIDATE_PHP=${VALIDATE_PHP} \
VALIDATE_PYTHON=${VALIDATE_PYTHON} \
VALIDATE_RUBY=${VALIDATE_RUBY} \

View file

@ -55,6 +55,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
| **PowerShell** | [PSScriptAnalyzer](https://github.com/PowerShell/Psscriptanalyzer) |
| **Protocol Buffers** | [protolint](https://github.com/yoheimuta/protolint) |
| **Python3** | [pylint](https://www.pylint.org/) |
| **Raku** | [raku](https://raku.org) |
| **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) |
| **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) |
| **Terraform** | [tflint](https://github.com/terraform-linters/tflint) |
@ -160,6 +161,7 @@ and won't run anything unexpected.
| **VALIDATE_MD** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_BASH** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_RAKU** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the language. |

View file

@ -21,6 +21,7 @@ For some linters it is also possible to override rules on a case by case level w
- [JSON](#json)
- [Markdown](#markdown)
- [Perl](#perl)
- [Raku](#raku)
- [PHP](#php)
- [XML](#xml)
- [Coffeescript](#coffeescript)
@ -310,9 +311,8 @@ ignore_templates:
- [markdownlint inline comment syntax](https://github.com/DavidAnson/markdownlint#configuration)
### markdownlint Config file
- `.github/linters/.markdown-lint.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.markdownlint.yml`
- File should be located at: `.github/linters/.markdown-lint.yml`
### markdownlint disable single line
```markdown
@ -355,6 +355,24 @@ Here is more data
--------------------------------------------------------------------------------
## Raku
- [raku](https://raku.org)
### Raku Config file
- There is no top level *configuration file* available at this time
### Raku disable single line
- There is currently **No** way to disable rules inline of the file(s)
### Raku disable code block
- There is currently **No** way to disable rules inline of the file(s)
### Raku disable entire file
- There is currently **No** way to disable rules inline of the file(s)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
## PHP
- [PHP](https://www.php.net/)

View file

@ -209,6 +209,20 @@ function BuildFileList() {
##########################################################
READ_ONLY_CHANGE_FLAG=1
######################
# Get the RAKU files #
######################
elif [ "$FILE_TYPE" == "raku" ] || [ "$FILE_TYPE" == "rakumod" ] \
|| [ "$FILE_TYPE" == "rakutest" ] || [ "$FILE_TYPE" == "pm6" ] \
|| [ "$FILE_TYPE" == "pl6" ] || [ "$FILE_TYPE" == "p6" ] ; then
################################
# Append the file to the array #
################################
FILE_ARRAY_RAKU+=("$FILE")
##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
##########################################################
READ_ONLY_CHANGE_FLAG=1
######################
# Get the PHP files #
######################
elif [ "$FILE_TYPE" == "php" ]; then

View file

@ -91,7 +91,7 @@ HTML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$HTML_FILE_NAME" # Path t
# Linter array for information prints #
#######################################
LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
"pylint" "perl" "rubocop" "coffeelint" "eslint" "standard"
"pylint" "perl" "raku" "rubocop" "coffeelint" "eslint" "standard"
"ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint"
"stylelint" "dotenv-linter" "pwsh" "arm-ttk" "ktlint" "protolint" "clj-kondo"
"spectral" "cfn-lint" "dart" "htmlhint")
@ -99,7 +99,7 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
#############################
# Language array for prints #
#############################
LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'PHP' 'RUBY' 'PYTHON'
LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RAKU' 'PHP' 'RUBY' 'PYTHON'
'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES'
'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM'
'CSS' 'ENV' 'POWERSHELL' 'ARM' 'KOTLIN' 'PROTOBUF' 'CLOJURE' 'OPENAPI'
@ -120,6 +120,7 @@ VALIDATE_XML="${VALIDATE_XML}" # Boolean to vali
VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language
VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
@ -184,6 +185,7 @@ FILE_ARRAY_XML=() # Array of files to check
FILE_ARRAY_MD=() # Array of files to check
FILE_ARRAY_BASH=() # Array of files to check
FILE_ARRAY_PERL=() # Array of files to check
FILE_ARRAY_RAKU=() # Array of files to check
FILE_ARRAY_PHP=() # Array of files to check
FILE_ARRAY_RUBY=() # Array of files to check
FILE_ARRAY_PYTHON=() # Array of files to check
@ -216,6 +218,7 @@ ERRORS_FOUND_XML=0 # Count of errors found
ERRORS_FOUND_MARKDOWN=0 # Count of errors found
ERRORS_FOUND_BASH=0 # Count of errors found
ERRORS_FOUND_PERL=0 # Count of errors found
ERRORS_FOUND_RAKU=0 # Count of errors found
ERRORS_FOUND_PHP=0 # Count of errors found
ERRORS_FOUND_RUBY=0 # Count of errors found
ERRORS_FOUND_PYTHON=0 # Count of errors found
@ -342,7 +345,7 @@ GetLinterRules() {
########################################
# Update the path to the file location #
########################################
declare -g "${LANGUAGE_LINTER_RULES}=$GITHUB_WORKSPACE/$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}"
eval "${LANGUAGE_LINTER_RULES}=$GITHUB_WORKSPACE/$LINTER_RULES_PATH/${!LANGUAGE_FILE_NAME}"
else
########################################################
# No user default provided, using the template default #
@ -603,6 +606,11 @@ GetGitHubVars() {
GITHUB_WORKSPACE="$DEFAULT_WORKSPACE"
fi
if [ ! -d "$GITHUB_WORKSPACE" ]; then
echo -e "${NC}${B[R]}${F[W]}ERROR:${NC} Provided volume is not a directory!${NC}"
exit 1
fi
echo "Linting all files in mapped directory:[$DEFAULT_WORKSPACE]"
# No need to touch or set the GITHUB_SHA
@ -770,6 +778,7 @@ Footer() {
[ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] ||
[ "$ERRORS_FOUND_BASH" -ne 0 ] ||
[ "$ERRORS_FOUND_PERL" -ne 0 ] ||
[ "$ERRORS_FOUND_RAKU" -ne 0 ] ||
[ "$ERRORS_FOUND_PHP" -ne 0 ] ||
[ "$ERRORS_FOUND_PYTHON" -ne 0 ] ||
[ "$ERRORS_FOUND_COFFEESCRIPT" -ne 0 ] ||
@ -951,7 +960,7 @@ if [ "$VALIDATE_BASH" == "true" ]; then
# Lint the bash files #
#######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\)\$" "${FILE_ARRAY_BASH[@]}"
LintCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "${FILE_ARRAY_BASH[@]}"
fi
##################
@ -987,6 +996,21 @@ if [ "$VALIDATE_PERL" == "true" ]; then
LintCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "${FILE_ARRAY_PERL[@]}"
fi
################
# RAKU LINTING #
################
if [ "$VALIDATE_RAKU" == "true" ]; then
#######################
# Lint the raku files #
#######################
echo "$GITHUB_WORKSPACE/META6.json"
if [ -e "$GITHUB_WORKSPACE/META6.json" ]; then
cd "$GITHUB_WORKSPACE" && zef install --deps-only --/test .
fi
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "RAKU" "raku" "raku -I $GITHUB_WORKSPACE/lib -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "${FILE_ARRAY_RAKU[@]}"
fi
################
# PHP LINTING #
################

View file

@ -52,6 +52,7 @@ function GetValidationInfo() {
VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}')
VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}')
VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}')
VALIDATE_RAKU=$(echo "$VALIDATE_RAKU" | awk '{print tolower($0)}')
VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}')
VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}')
VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}')
@ -86,6 +87,7 @@ function GetValidationInfo() {
$VALIDATE_MD || -n \
$VALIDATE_BASH || -n \
$VALIDATE_PERL || -n \
$VALIDATE_RAKU || -n \
$VALIDATE_PHP || -n \
$VALIDATE_PYTHON || -n \
$VALIDATE_RUBY || -n \
@ -196,6 +198,20 @@ function GetValidationInfo() {
VALIDATE_PERL="true"
fi
####################################
# Validate if we should check RAKU #
####################################
if [[ $ANY_SET == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z $VALIDATE_RAKU ]]; then
# RAKU flag was not set - default to false
VALIDATE_RAKU="false"
fi
else
# No linter flags were set - default all to true
VALIDATE_RAKU="true"
fi
####################################
# Validate if we should check PHP #
####################################
@ -551,6 +567,11 @@ function GetValidationInfo() {
else
PRINT_ARRAY+=("- Excluding [PERL] files in code base...")
fi
if [[ $VALIDATE_RAKU == "true" ]]; then
PRINT_ARRAY+=("- Validating [RAKU] files in code base...")
else
PRINT_ARRAY+=("- Excluding [RAKU] files in code base...")
fi
if [[ $VALIDATE_PHP == "true" ]]; then
PRINT_ARRAY+=("- Validating [PHP] files in code base...")
else

View file

@ -455,9 +455,10 @@ function RunTestCases() {
TestCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "json"
TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml"
TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MD_LINTER_RULES" ".*\.\(md\)\$" "markdown"
TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\)\$" "shell"
TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell"
TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES" ".*\.\(py\)\$" "python"
TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl"
TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku"
TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "php"
TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$" "ruby"
TestCodebase "GO" "golangci-lint" "golangci-lint run -c $GO_LINTER_RULES" ".*\.\(go\)\$" "golang"