mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-28 19:50:59 -05:00
Merge branch 'master' into OpenAPI
This commit is contained in:
commit
625841f40f
38 changed files with 619 additions and 39 deletions
|
@ -8,7 +8,7 @@
|
|||
# Its based on being built from a GitHub Action, but could be easily updated
|
||||
# To be ran in a different medium.
|
||||
#
|
||||
# PRE-Reqs:
|
||||
# PRE-Requirements:
|
||||
# - Dockerfile
|
||||
# - System with Docker installed
|
||||
# - Global variables met
|
||||
|
|
|
@ -35,7 +35,7 @@ CheckGHEPid()
|
|||
################################################
|
||||
if [ ! -f "$GHE_CONFIG_PID" ]; then
|
||||
# File not found
|
||||
echo "Were good to move forward, no .pid file found at:[$GHE_CONFIG_PID]"
|
||||
echo "We're good to move forward, no .pid file found at:[$GHE_CONFIG_PID]"
|
||||
else
|
||||
# Found the pid running, need to sleep
|
||||
echo "Current PID found, sleeping $SLEEP_SECONDS seconds before next check..."
|
||||
|
@ -189,10 +189,10 @@ CheckGHEProcess
|
|||
####################
|
||||
RunConfigApply
|
||||
|
||||
##########################################
|
||||
# Were going to run it again after a nap #
|
||||
# to make sure there is no crazy actions #
|
||||
##########################################
|
||||
###########################################
|
||||
# We're going to run it again after a nap #
|
||||
# to make sure there is no crazy actions #
|
||||
###########################################
|
||||
sleep 300s
|
||||
|
||||
######################
|
||||
|
|
13
.automation/test/clojure/README.md
Normal file
13
.automation/test/clojure/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Clojure Test Cases
|
||||
This folder holds the test cases for **Clojure**.
|
||||
|
||||
## 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.
|
64
.automation/test/clojure/clojure_bad_1.clj
Normal file
64
.automation/test/clojure/clojure_bad_1.clj
Normal file
|
@ -0,0 +1,64 @@
|
|||
(ns foo
|
||||
(:require
|
||||
[clojure.string :as str]
|
||||
;; We're never using this namespace. Also, the namespaces aren't sorted.
|
||||
[clojure.set :as set]))
|
||||
|
||||
;; Here we made a typo, so the symbol is unresolved:
|
||||
(but-last [1 2 3])
|
||||
|
||||
;; Clj-kondo knows about arities of clojure namespaces, but you can also teach
|
||||
;; it about your libraries or own namespaces
|
||||
(str/join)
|
||||
|
||||
;; foo has an arity of 2, but we're not actually using y
|
||||
(defn foo-fn [x y]
|
||||
;; this do is redundant:
|
||||
(do
|
||||
;; this is handy for debugging, but please remove it before pushing your code:
|
||||
(def tmp_x x)
|
||||
(let [y (fn [] (inc x))]
|
||||
;; the next let can be squashed together with the previous:
|
||||
(let [z y]
|
||||
;; whoopsy, calling a local function with an incorrect number of args:
|
||||
(y x)
|
||||
;; also wrong:
|
||||
(recur)))))
|
||||
|
||||
(letfn
|
||||
[(f [] (h 1))
|
||||
(h [] (f 1))])
|
||||
|
||||
(defn- private-fn [])
|
||||
;; redefining it...
|
||||
(defn- private-fn [])
|
||||
|
||||
(defn foo [] :foo)
|
||||
;; Type error, because foo doesn't return a number!
|
||||
(inc (foo))
|
||||
|
||||
;; I'm tired now, let's sleep...
|
||||
;; Oops, not happening because of wrong amount of args:
|
||||
(Thread/sleep 1000 1 2)
|
||||
|
||||
;; Here we switch to another namespace and require the previous:
|
||||
(ns bar (:require [foo :as f]))
|
||||
|
||||
;; Wrong arity when calling a function from the previous namespace:
|
||||
(f/foo-fn)
|
||||
|
||||
;; private:
|
||||
(f/private-fn)
|
||||
|
||||
;; this won't pass the reader:
|
||||
{:a 1 :a 2}
|
||||
;; and neither will this:
|
||||
#{1 1}
|
||||
;; nor this:
|
||||
{:a 1 :b}
|
||||
|
||||
(ns bar-test (:require [clojure.test :as t]))
|
||||
|
||||
(t/deftest my-tests
|
||||
;; you're not actually testing something here:
|
||||
(odd? (inc 1)))
|
34
.automation/test/clojure/clojure_good_1.clj
Normal file
34
.automation/test/clojure/clojure_good_1.clj
Normal file
|
@ -0,0 +1,34 @@
|
|||
(ns foo
|
||||
(:require
|
||||
[clojure.string :as str]))
|
||||
|
||||
(butlast [1 2 3])
|
||||
|
||||
(str/join "" "")
|
||||
|
||||
(defn foo-fn [x]
|
||||
(let [y (fn [] (inc x))]
|
||||
(y)))
|
||||
|
||||
(letfn
|
||||
[(f [g] (h g))
|
||||
(h [i] (f i))])
|
||||
|
||||
(defn foo [] 1)
|
||||
(inc (foo))
|
||||
|
||||
(Thread/sleep 1000 1)
|
||||
|
||||
;; Here we switch to another namespace and require the previous:
|
||||
(ns bar (:require [foo :as f]))
|
||||
|
||||
(f/foo-fn 1)
|
||||
|
||||
{:a 1 :b 2}
|
||||
#{1 2}
|
||||
{:a 1 :b 2}
|
||||
|
||||
(ns bar-test (:require [clojure.test :as t]))
|
||||
|
||||
(t/deftest my-tests
|
||||
(t/is (odd? (inc 1))))
|
|
@ -6,7 +6,7 @@
|
|||
# `mona echo *` - repeats what you say
|
||||
#
|
||||
# Author:
|
||||
# admiralAwkbar@github.com
|
||||
# admiralawkbar@github.com
|
||||
|
||||
###############################
|
||||
# Drop Hammer array of images #
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# `mona echo *` - repeats what you say
|
||||
#
|
||||
# Author:
|
||||
# admiralAwkbar@github.com
|
||||
# admiralawkbar@github.com
|
||||
|
||||
###############################
|
||||
# Drop Hammer array of images #
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Bad */
|
||||
/* Multiline */
|
||||
/* Multi-line */
|
||||
/* Comment */
|
||||
.selector-3[type="text"] {
|
||||
background: linear-gradient(#FFFFFF, rgba(0, 0, 0, 0.8));
|
||||
|
|
|
@ -16,5 +16,5 @@ ls -la
|
|||
|
||||
# Walk away
|
||||
|
||||
Were all done **here**.
|
||||
We're all done **here**.
|
||||
- [Link Action]https://github.com
|
||||
|
|
|
@ -16,5 +16,5 @@ ls -la
|
|||
|
||||
### Walk away
|
||||
|
||||
Were all done **here**.
|
||||
We're all done **here**.
|
||||
- [Link Action](https://github.com)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
################################################################################
|
||||
################################################################################
|
||||
######### Script action @admiralAwkbar #########################################
|
||||
######### Script action @admiralawkbar #########################################
|
||||
################################################################################
|
||||
|
||||
#############
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
################################################################################
|
||||
################################################################################
|
||||
######### Script action @admiralAwkbar #########################################
|
||||
######### Script action @admiralawkbar #########################################
|
||||
################################################################################
|
||||
|
||||
#############
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# Its based on being built from a GitHub Action, but could be easily updated
|
||||
# To be ran in a different medium.
|
||||
#
|
||||
# PRE-Reqs:
|
||||
# PRE-Requirements:
|
||||
# - Dockerfile
|
||||
# - System with Docker installed
|
||||
# - Global variables met
|
||||
|
|
7
.github/actions/spelling/allow/Dockerfile.txt
vendored
Normal file
7
.github/actions/spelling/allow/Dockerfile.txt
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
musl
|
||||
nvq
|
||||
rdoc
|
||||
setuptools
|
||||
uninstall
|
||||
wget
|
||||
WORKDIR
|
1
.github/actions/spelling/allow/cleanup-docker.sh.txt
vendored
Normal file
1
.github/actions/spelling/allow/cleanup-docker.sh.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
alnum
|
3
.github/actions/spelling/allow/disabling-linters.md.txt
vendored
Normal file
3
.github/actions/spelling/allow/disabling-linters.md.txt
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
noqa
|
||||
toc
|
||||
todo
|
48
.github/actions/spelling/allow/emoji.txt
vendored
Normal file
48
.github/actions/spelling/allow/emoji.txt
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
abcd
|
||||
bangbang
|
||||
bento
|
||||
bullettrain
|
||||
busstop
|
||||
cn
|
||||
couplekiss
|
||||
dango
|
||||
dvd
|
||||
facepunch
|
||||
feelsgood
|
||||
finnadie
|
||||
fuelpump
|
||||
gb
|
||||
goberserk
|
||||
godmode
|
||||
gua
|
||||
hankey
|
||||
heartpulse
|
||||
hocho
|
||||
hurtrealbad
|
||||
icecream
|
||||
inbox
|
||||
iphone
|
||||
izakaya
|
||||
jp
|
||||
keycap
|
||||
mega
|
||||
minidisc
|
||||
moyai
|
||||
neckbeard
|
||||
octocat
|
||||
oden
|
||||
ramen
|
||||
ru
|
||||
scorpius
|
||||
shipit
|
||||
snowboarder
|
||||
tada
|
||||
tanabata
|
||||
thumbsdown
|
||||
thumbsup
|
||||
tophat
|
||||
trollface
|
||||
tshirt
|
||||
uk
|
||||
vhs
|
||||
zzz
|
2
.github/actions/spelling/allow/ghe-api-config-apply.yml.txt
vendored
Normal file
2
.github/actions/spelling/allow/ghe-api-config-apply.yml.txt
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
configcheck
|
||||
nohup
|
2
.github/actions/spelling/allow/ghe-config-apply.sh.txt
vendored
Normal file
2
.github/actions/spelling/allow/ghe-config-apply.sh.txt
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
args
|
||||
pid
|
1
.github/actions/spelling/allow/ghe-initial-configuration.yml.txt
vendored
Normal file
1
.github/actions/spelling/allow/ghe-initial-configuration.yml.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
initialconfig
|
2
.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt
vendored
Normal file
2
.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
ldapconfig
|
||||
openldap
|
8
.github/actions/spelling/allow/gitignore.txt
vendored
Normal file
8
.github/actions/spelling/allow/gitignore.txt
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
cov
|
||||
eslintcache
|
||||
jscoverage
|
||||
jspm
|
||||
nyc
|
||||
tgz
|
||||
typings
|
||||
wscript
|
7
.github/actions/spelling/allow/linter.sh.txt
vendored
Normal file
7
.github/actions/spelling/allow/linter.sh.txt
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
cw
|
||||
Mstrict
|
||||
printenv
|
||||
rcfile
|
||||
tf
|
||||
tolower
|
||||
whoami
|
8
.github/actions/spelling/allow/main.yml.txt
vendored
Normal file
8
.github/actions/spelling/allow/main.yml.txt
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
Autobots
|
||||
basemap
|
||||
cas
|
||||
cn
|
||||
crt
|
||||
rsa
|
||||
tlsv
|
||||
tmp
|
4
.github/actions/spelling/allow/settings.json.j2.txt
vendored
Normal file
4
.github/actions/spelling/allow/settings.json.j2.txt
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
dotcom
|
||||
identicons
|
||||
oauth
|
||||
timezone
|
158
.github/actions/spelling/allow/words.txt
vendored
Normal file
158
.github/actions/spelling/allow/words.txt
vendored
Normal file
|
@ -0,0 +1,158 @@
|
|||
admiralawkbar
|
||||
ansible
|
||||
api
|
||||
apk
|
||||
aws
|
||||
baz
|
||||
beardofedu
|
||||
certs
|
||||
changeset
|
||||
codebase
|
||||
CODEOWNERS
|
||||
coffeelint
|
||||
coffeescript
|
||||
collectd
|
||||
concat
|
||||
config
|
||||
configs
|
||||
css
|
||||
dest
|
||||
devops
|
||||
dirname
|
||||
dockerfile
|
||||
dockerfilelint
|
||||
dockerfilelintrc
|
||||
dotenv
|
||||
elif
|
||||
emails
|
||||
entrypoint
|
||||
Errorf
|
||||
eslint
|
||||
eslintrc
|
||||
filetype
|
||||
func
|
||||
gcc
|
||||
getenv
|
||||
ghe
|
||||
GHES
|
||||
ghl
|
||||
github
|
||||
globals
|
||||
golang
|
||||
golangci
|
||||
Google
|
||||
gpg
|
||||
gql
|
||||
Grafana
|
||||
graphql
|
||||
grep
|
||||
homepage
|
||||
hookshot
|
||||
hostname
|
||||
hostvars
|
||||
http
|
||||
https
|
||||
hubot
|
||||
idp
|
||||
ip
|
||||
Jani
|
||||
javascript
|
||||
jq
|
||||
json
|
||||
jsonlint
|
||||
jwiebalk
|
||||
JWT
|
||||
ldap
|
||||
len
|
||||
lfs
|
||||
libxml
|
||||
linted
|
||||
linting
|
||||
loadbalancer
|
||||
localhost
|
||||
loglevel
|
||||
markdownlint
|
||||
millis
|
||||
mkdir
|
||||
nodejs
|
||||
NONINFRINGEMENT
|
||||
noproxy
|
||||
noreply
|
||||
npm
|
||||
ntp
|
||||
opensource
|
||||
opensourcefriday
|
||||
perl
|
||||
plugin
|
||||
posix
|
||||
pprint
|
||||
Prego
|
||||
prettyjson
|
||||
Println
|
||||
probot
|
||||
px
|
||||
py
|
||||
pylint
|
||||
rb
|
||||
readlines
|
||||
README
|
||||
regex
|
||||
regexp
|
||||
resqued
|
||||
rgba
|
||||
rien
|
||||
Rubo
|
||||
rubocop
|
||||
saml
|
||||
screenshots
|
||||
shellcheck
|
||||
signup
|
||||
smtp
|
||||
snmp
|
||||
socio
|
||||
splunk
|
||||
src
|
||||
ssh
|
||||
ssl
|
||||
sso
|
||||
stackoverflow
|
||||
stacktraces
|
||||
standardjs
|
||||
stringify
|
||||
stylelint
|
||||
stylelintrc
|
||||
subdomain
|
||||
subfolders
|
||||
sudo
|
||||
sys
|
||||
syslog
|
||||
taz
|
||||
terraform
|
||||
tflint
|
||||
tileserver
|
||||
tls
|
||||
typeof
|
||||
ubuntu
|
||||
udp
|
||||
uid
|
||||
undef
|
||||
uniq
|
||||
uri
|
||||
url
|
||||
urlencode
|
||||
username
|
||||
usr
|
||||
utils
|
||||
Vape
|
||||
vnd
|
||||
webhook
|
||||
wiki
|
||||
wildcards
|
||||
workflow
|
||||
xml
|
||||
xmllint
|
||||
yaml
|
||||
yamllint
|
||||
yml
|
||||
yq
|
||||
zkoppert
|
2
.github/actions/spelling/excludes.txt
vendored
Normal file
2
.github/actions/spelling/excludes.txt
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
^\.github/linters/
|
||||
^TEMPLATES/\.\S*
|
39
.github/actions/spelling/expect.txt
vendored
Normal file
39
.github/actions/spelling/expect.txt
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
cdxml
|
||||
changelog
|
||||
chmod
|
||||
Dockerhub
|
||||
EOL
|
||||
GPR
|
||||
IAm
|
||||
icu
|
||||
jre
|
||||
kotlin
|
||||
krb
|
||||
ktlint
|
||||
libgcc
|
||||
libintl
|
||||
libssl
|
||||
libstdc
|
||||
linux
|
||||
lttng
|
||||
microsoft
|
||||
ncurses
|
||||
nq
|
||||
openjdk
|
||||
php
|
||||
powershell
|
||||
println
|
||||
psd
|
||||
psm
|
||||
psrc
|
||||
pssc
|
||||
psscriptanalyzer
|
||||
pwsh
|
||||
rcu
|
||||
rhc
|
||||
ry
|
||||
terminfo
|
||||
tzdata
|
||||
userspace
|
||||
xargs
|
||||
zlib
|
7
.github/actions/spelling/patterns.txt
vendored
Normal file
7
.github/actions/spelling/patterns.txt
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
https?:\S*
|
||||
# ignore long runs of a single character:
|
||||
([A-Za-z])\1{3,}
|
||||
# Any CLI args (-xzf -aef)
|
||||
\ -\w+\b
|
||||
# Hex colors (dummy group to not be treated as comment)
|
||||
(?:#)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})
|
2
.github/linters/.clj-kondo/config.edn
vendored
Normal file
2
.github/linters/.clj-kondo/config.edn
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
{:linters {:unresolved-symbol {:exclude [(compojure.api.sweet/defroutes)]}
|
||||
:refer-all {:exclude [clj-time.jdbc]}}}
|
48
.github/workflows/check-spelling.yml
vendored
Normal file
48
.github/workflows/check-spelling.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
####################
|
||||
## Check spelling ##
|
||||
####################
|
||||
|
||||
#
|
||||
# Documentation:
|
||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
||||
#
|
||||
|
||||
name: Spell checking
|
||||
#############################
|
||||
# Start the job on all push #
|
||||
#############################
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'master'
|
||||
|
||||
###############
|
||||
# Set the Job #
|
||||
###############
|
||||
jobs:
|
||||
build:
|
||||
# Name the Job
|
||||
name: Spell checking
|
||||
# Set the agent to run on
|
||||
runs-on: ubuntu-latest
|
||||
##################
|
||||
# Load all steps #
|
||||
##################
|
||||
steps:
|
||||
##########################
|
||||
# Checkout the code base #
|
||||
##########################
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
#############################
|
||||
# Run check spelling action #
|
||||
#############################
|
||||
- name: Check spelling
|
||||
uses: check-spelling/check-spelling@0.0.16-alpha
|
||||
with:
|
||||
bucket: .github/actions
|
||||
project: spelling
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
13
.github/workflows/welcome_new_people.yml
vendored
Normal file
13
.github/workflows/welcome_new_people.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
name: Greetings
|
||||
|
||||
on: [pull_request, issues]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: 'Thanks for opening your first issue in the **super-linter** repo! :tada:'
|
||||
pr-message: 'Thanks for opening your first pr in the **super-linter** repo! :tada: This project is built on contributions just like this.'
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -29,7 +29,7 @@ bower_components
|
|||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
# Compiled binary add-ons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
|
@ -59,3 +59,6 @@ typings/
|
|||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# clj-kondo cache
|
||||
.cache
|
10
Dockerfile
10
Dockerfile
|
@ -132,6 +132,15 @@ RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/r
|
|||
RUN wget "https://github.com/dotenv-linter/dotenv-linter/releases/latest/download/dotenv-linter-alpine-x86_64.tar.gz" -O - -q | tar -xzf - \
|
||||
&& mv "dotenv-linter" /usr/bin
|
||||
|
||||
#####################
|
||||
# Install clj-kondo #
|
||||
#####################
|
||||
ARG CLJ_KONDO_VERSION='2020.06.12'
|
||||
RUN curl -sLO https://github.com/borkdude/clj-kondo/releases/download/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \
|
||||
&& unzip clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \
|
||||
&& rm clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \
|
||||
&& mv clj-kondo /usr/bin/
|
||||
|
||||
##################
|
||||
# Install ktlint #
|
||||
##################
|
||||
|
@ -167,6 +176,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \
|
|||
VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \
|
||||
VALIDATE_CSS=${VALIDATE_CSS} \
|
||||
VALIDATE_ENV=${VALIDATE_ENV} \
|
||||
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
||||
VALIDATE_KOTLIN=${VALIDATE_KOTLIN} \
|
||||
VALIDATE_POWERSHELL=${VALIDATE_POWERSHELL} \
|
||||
VALIDATE_OPENAPI=${VALIDATE_OPENAPI} \
|
||||
|
|
20
README.md
20
README.md
|
@ -8,10 +8,26 @@ The end goal of this tool:
|
|||
- Build guidelines for code layout and format
|
||||
- Automate the process to help streamline code reviews
|
||||
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [How it works](#how-it-works)
|
||||
- [Supported linters](#supported-linters)
|
||||
- [Usage](#how-to-use)
|
||||
- [Environment variables](#environment-variables)
|
||||
- [Disable rules](#disabling-rules)
|
||||
- [Docker Hub](#docker-hub)
|
||||
- [Run Super-Linter locally](#running-super-linter-locally-troubleshootingdebuggingenhancements)
|
||||
- [CI / CT/ CD](#cictcd)
|
||||
- [Limitations](#limitations)
|
||||
- [Contributing](#how-to-contribute)
|
||||
|
||||
## How it Works
|
||||
|
||||
The super-linter finds issues and reports them to the console output. Fixes are suggested in the console output but not automatically fixed, and a status check will show up as failed on the pull request.
|
||||
|
||||
The design of the **Super-Linter** is currently to allow linting to occur in **GitHub Actions** as a part of continuous integration occurring on pull requests as the commits get pushed. It works best when commits are being pushed early and often to a branch with an open or draft pull request. There is some desire to move this closer to local development for faster feedback on linting errors but this is not yet supported.
|
||||
|
||||
## Supported Linters
|
||||
|
||||
Developers on **GitHub** can call the **GitHub Action** to lint their code base with the following list of linters:
|
||||
|
@ -20,6 +36,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
|||
| --- | --- |
|
||||
| **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) |
|
||||
| **CSS** | [stylelint](https://stylelint.io/) |
|
||||
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
||||
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
|
||||
| **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) |
|
||||
| **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) |
|
||||
|
@ -144,6 +161,7 @@ and won't run anything unexpected.
|
|||
| **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_CLOJURE** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_KOTLIN** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the language. |
|
||||
| **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). |
|
||||
|
@ -165,6 +183,8 @@ The **Docker** container that is built from this repository is located at `https
|
|||
## Running Super-Linter locally (troubleshooting/debugging/enhancements)
|
||||
If you find that you need to run super-linter locally, you can follow the documentation at [Running super-linter locally](https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md)
|
||||
|
||||
Check out the [note](#how-it-works) in **How it Works** to understand more about the **Super-Linter** linting locally versus via continuous integration.
|
||||
|
||||
### CI/CT/CD
|
||||
The **Super-Linter** has *CI/CT/CD* configured utilizing **GitHub** Actions.
|
||||
- When a branch is created and code is pushed, a **GitHub** Action is triggered for building the new **Docker** container with the new codebase
|
||||
|
|
2
TEMPLATES/.clj-kondo/config.edn
Normal file
2
TEMPLATES/.clj-kondo/config.edn
Normal file
|
@ -0,0 +1,2 @@
|
|||
{:linters {:unresolved-symbol {:exclude [(compojure.api.sweet/defroutes)]}
|
||||
:refer-all {:exclude [clj-time.jdbc]}}}
|
|
@ -157,9 +157,9 @@ This line is waaaaaaaaaay too long # yamllint disable-line
|
|||
### Yamllint disable code block
|
||||
```yml
|
||||
# yamllint disable rule:colons
|
||||
- Lorem : ipsum
|
||||
dolor : sit amet,
|
||||
consectetur : adipiscing elit
|
||||
- Key : value
|
||||
dolor : sit,
|
||||
foo : bar
|
||||
# yamllint enable
|
||||
```
|
||||
|
||||
|
@ -223,9 +223,9 @@ class Foo(object):
|
|||
def meth3(self):
|
||||
"""test one line disabling"""
|
||||
# no error
|
||||
print(self.bla) # pylint: disable=no-member
|
||||
print(self.baz) # pylint: disable=no-member
|
||||
# error
|
||||
print(self.blop)
|
||||
print(self.baz)
|
||||
```
|
||||
|
||||
### Pylint disable entire file
|
||||
|
@ -629,3 +629,23 @@ import package.b.*
|
|||
### OpenAPI disable entire file
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
- However, you can make [rule exceptions](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/6-exceptions.md?srn=gh/stoplightio/spectral/docs/guides/6-exceptions.md) in the config for individual file(s).
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
## Clojure
|
||||
- [clj-kondo](https://github.com/borkdude/clj-kondo)
|
||||
- Since clj-kondo approaches static analysis in a very Clojure way, it is advised to read the [configuration docs](https://github.com/borkdude/clj-kondo/blob/master/doc/config.md)
|
||||
|
||||
### clj-kondo standard Config file
|
||||
- `.github/linters/.clj-kondo/config.edn`
|
||||
|
||||
### clj-kondo disable single line
|
||||
- There is currently **No** way to disable rules in a single line
|
||||
|
||||
### clj-kondo disable code block
|
||||
- There is currently **No** way to disable rules in a code block
|
||||
|
||||
### clj-kondo disable entire file
|
||||
```clojure
|
||||
{:output {:exclude-files ["path/to/file"]}}
|
||||
```
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
################################################################################
|
||||
################################################################################
|
||||
########### Super-Linter (Lint all the code) @AdmiralAwkbar ####################
|
||||
########### Super-Linter (Lint all the code) @admiralawkbar ####################
|
||||
################################################################################
|
||||
################################################################################
|
||||
|
||||
|
@ -27,7 +27,7 @@ RUBY_FILE_NAME='.ruby-lint.yml' # Name of th
|
|||
RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules
|
||||
# Coffee Vars
|
||||
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file
|
||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffescript lint rules
|
||||
COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules
|
||||
# Javascript Vars
|
||||
JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file
|
||||
JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules
|
||||
|
@ -57,6 +57,9 @@ CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to th
|
|||
# OpenAPI Vars
|
||||
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
|
||||
OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to the OpenAPI lint rules
|
||||
# Clojure Vars
|
||||
CLOJURE_FILE_NAME='.clj-kondo/config.edn'
|
||||
CLOJURE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CLOJURE_FILE_NAME"
|
||||
|
||||
#######################################
|
||||
# Linter array for information prints #
|
||||
|
@ -64,7 +67,7 @@ OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to th
|
|||
LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
|
||||
"pylint" "perl" "rubocop" "coffeelint" "eslint" "standard"
|
||||
"ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint"
|
||||
"stylelint" "dotenv-linter" "powershell" "ktlint" "spectral")
|
||||
"stylelint" "dotenv-linter" "powershell" "ktlint" "clj-kondo" "spectral")
|
||||
|
||||
#############################
|
||||
# Language array for prints #
|
||||
|
@ -72,7 +75,7 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck"
|
|||
LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'PHP' 'RUBY' 'PYTHON'
|
||||
'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES'
|
||||
'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM'
|
||||
'ENV' 'POWERSHELL' 'KOTLIN' 'OPENAPI')
|
||||
'CSS' 'ENV' 'POWERSHELL' 'KOTLIN' 'CLOJURE' 'OPENAPI')
|
||||
|
||||
###################
|
||||
# GitHub ENV Vars #
|
||||
|
@ -102,6 +105,7 @@ VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate lang
|
|||
VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language
|
||||
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
|
||||
VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language
|
||||
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||
VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language
|
||||
VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language
|
||||
|
@ -118,16 +122,16 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info
|
|||
################
|
||||
# Default Vars #
|
||||
################
|
||||
DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files
|
||||
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
|
||||
DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory
|
||||
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
|
||||
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
|
||||
DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output
|
||||
RAW_FILE_ARRAY=() # Array of all files that were changed
|
||||
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
|
||||
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
|
||||
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
|
||||
DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files
|
||||
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
|
||||
DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory
|
||||
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
|
||||
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
|
||||
DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output
|
||||
RAW_FILE_ARRAY=() # Array of all files that were changed
|
||||
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md
|
||||
TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore
|
||||
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
|
||||
|
||||
##########################
|
||||
# Array of changed files #
|
||||
|
@ -152,6 +156,7 @@ FILE_ARRAY_TERRAFORM=() # Array of files to check
|
|||
FILE_ARRAY_POWERSHELL=() # Array of files to check
|
||||
FILE_ARRAY_CSS=() # Array of files to check
|
||||
FILE_ARRAY_ENV=() # Array of files to check
|
||||
FILE_ARRAY_CLOJURE=() # Array of files to check
|
||||
FILE_ARRAY_KOTLIN=() # Array of files to check
|
||||
FILE_ARRAY_OPENAPI=() # Array of files to check
|
||||
|
||||
|
@ -179,6 +184,7 @@ ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
|||
ERRORS_FOUND_POWERSHELL=0 # Count of errors found
|
||||
ERRORS_FOUND_CSS=0 # Count of errors found
|
||||
ERRORS_FOUND_ENV=0 # Count of errors found
|
||||
ERRORS_FOUND_CLOJURE=0 # Count of errors found
|
||||
ERRORS_FOUND_KOTLIN=0 # Count of errors found
|
||||
ERRORS_FOUND_OPENAPI=0 # Count of errors found
|
||||
|
||||
|
@ -774,6 +780,7 @@ GetValidationInfo()
|
|||
VALIDATE_POWERSHELL=$(echo "$VALIDATE_POWERSHELL" | awk '{print tolower($0)}')
|
||||
VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}')
|
||||
VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}')
|
||||
VALIDATE_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)')
|
||||
VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}')
|
||||
VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}')
|
||||
|
||||
|
@ -802,8 +809,9 @@ GetValidationInfo()
|
|||
-n "$VALIDATE_POWERSHELL" || \
|
||||
-n "$VALIDATE_CSS" || \
|
||||
-n "$VALIDATE_ENV" || \
|
||||
-n "$VALIDATE_KOTLIN" || \
|
||||
-n "$VALIDATE_OPENAPI" ]]; then
|
||||
-n "$VALIDATE_CLOJURE" || \
|
||||
-n "$VALIDATE_OPENAPI" ]] \
|
||||
-n "$VALIDATE_KOTLIN" ]]; then
|
||||
ANY_SET="true"
|
||||
fi
|
||||
|
||||
|
@ -1129,6 +1137,20 @@ GetValidationInfo()
|
|||
VALIDATE_OPENAPI="true"
|
||||
fi
|
||||
|
||||
#######################################
|
||||
# Validate if we should check Clojure #
|
||||
#######################################
|
||||
if [[ "$ANY_SET" == "true" ]]; then
|
||||
# Some linter flags were set - only run those set to true
|
||||
if [[ -z "$VALIDATE_CLOJURE" ]]; then
|
||||
# Clojure flag was not set - default to false
|
||||
VALIDATE_CLOJURE="false"
|
||||
fi
|
||||
else
|
||||
# No linter flags were set - default all to true
|
||||
VALIDATE_CLOJURE="true"
|
||||
fi
|
||||
|
||||
#######################################
|
||||
# Print which linters we are enabling #
|
||||
#######################################
|
||||
|
@ -1232,6 +1254,11 @@ GetValidationInfo()
|
|||
else
|
||||
PRINT_ARRAY+=("- Excluding [CSS] files in code base...")
|
||||
fi
|
||||
if [[ "$VALIDATE_CLOJURE" == "true" ]]; then
|
||||
PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...")
|
||||
else
|
||||
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
|
||||
fi
|
||||
if [[ "$VALIDATE_ENV" == "true" ]]; then
|
||||
PRINT_ARRAY+=("- Validating [ENV] files in code base...")
|
||||
else
|
||||
|
@ -1644,6 +1671,15 @@ BuildFileList()
|
|||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
READ_ONLY_CHANGE_FLAG=1
|
||||
elif [ "$FILE" == "clj" ] || [ "$FILE" == "cljs" ] || [ "$FILE" == "cljc" ] || [ "$FILE" == "edn" ]; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_CLOJURE+=("$FILE")
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
READ_ONLY_CHANGE_FLAG=1
|
||||
else
|
||||
##############################################
|
||||
# Use file to see if we can parse what it is #
|
||||
|
@ -1873,7 +1909,7 @@ LintCodebase()
|
|||
# Lint the file with the rules #
|
||||
################################
|
||||
# Need to append "'" to make the pwsh call syntax correct, also exit with exit code from inner subshell
|
||||
LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1)
|
||||
LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1)
|
||||
else
|
||||
################################
|
||||
# Lint the file with the rules #
|
||||
|
@ -2173,8 +2209,9 @@ Footer()
|
|||
[ "$ERRORS_FOUND_RUBY" -ne 0 ] || \
|
||||
[ "$ERRORS_FOUND_CSS" -ne 0 ] || \
|
||||
[ "$ERRORS_FOUND_ENV" -ne 0 ] || \
|
||||
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ] || \
|
||||
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ]; then
|
||||
[ "$ERRORS_FOUND_OPENAPI" -ne 0 ] \
|
||||
[ "$ERRORS_FOUND_CLOJURE" -ne 0 ] || \
|
||||
[ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then
|
||||
# Failed exit
|
||||
echo "Exiting with errors found!"
|
||||
exit 1
|
||||
|
@ -2235,6 +2272,7 @@ RunTestCases()
|
|||
TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$"
|
||||
TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$"
|
||||
TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$"
|
||||
TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$"
|
||||
TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$"
|
||||
TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$"
|
||||
|
||||
|
@ -2568,6 +2606,20 @@ if [ "$VALIDATE_DOCKER" == "true" ]; then
|
|||
LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}"
|
||||
fi
|
||||
|
||||
###################
|
||||
# CLOJURE LINTING #
|
||||
###################
|
||||
if [ "$VALIDATE_CLOJURE" == "true" ]; then
|
||||
#################################
|
||||
# Get Clojure standard rules #
|
||||
#################################
|
||||
GetStandardRules "clj-kondo"
|
||||
#########################
|
||||
# Lint the Clojure files #
|
||||
#########################
|
||||
LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILE_ARRAY_CLOJURE[@]}"
|
||||
fi
|
||||
|
||||
######################
|
||||
# POWERSHELL LINTING #
|
||||
######################
|
||||
|
|
Loading…
Reference in a new issue