├── .automation ├── test │ ├── terraform │ │ ├── README.md │ │ ├── good │ │ │ └── terraform_good_1.tf │ │ └── bad │ │ │ └── terraform_bad_1.tf │ ├── env │ │ ├── env_good_1.env │ │ ├── env_bad_1.env │ │ └── README.md │ ├── golang │ │ ├── golang_bad_01.go │ │ ├── golang_good_01.go │ │ └── README.md │ ├── xml │ │ ├── xml_bad_1.xml │ │ ├── xml_good_1.xml │ │ └── README.md │ ├── typescript │ │ ├── typescript_good_1.ts │ │ ├── typescript_bad_1.ts │ │ └── README.md │ ├── json │ │ ├── json_bad_1.json │ │ ├── json_good_1.json │ │ └── README.md │ ├── ansible │ │ ├── ghe-initialize │ │ │ ├── templates │ │ │ │ ├── forwarding.conf.j2 │ │ │ │ ├── splunk-settings.json.j2 │ │ │ │ ├── collectd-settings.json.j2 │ │ │ │ ├── ldap-settings.json.j2 │ │ │ │ ├── settings.json.j2 │ │ │ │ └── ghe-config-apply.sh │ │ │ ├── files │ │ │ │ └── ghe-initial-config.json │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ ├── tasks │ │ │ │ ├── ghe-config-apply.yml │ │ │ │ ├── ghe-ldap-configuration.yml │ │ │ │ ├── splunk-settings.yml │ │ │ │ ├── ghe-api-config-apply.yml │ │ │ │ ├── main.yml │ │ │ │ ├── collectd-settings.yml │ │ │ │ └── ghe-initial-configuration.yml │ │ │ └── defaults │ │ │ │ └── main.yml │ │ ├── README.md │ │ ├── ansible_bad_1.yml │ │ └── ansible_good_1.yml │ ├── css │ │ ├── css_bad_01.css │ │ ├── css_good_01.css │ │ └── README.md │ ├── docker │ │ ├── good │ │ │ └── Dockerfile │ │ ├── bad │ │ │ └── Dockerfile │ │ └── README.md │ ├── yml │ │ ├── yml_good_1.yml │ │ ├── yml_bad_1.yml │ │ └── README.md │ ├── shell │ │ ├── shell_bad_1.sh │ │ ├── shell_good_1.sh │ │ └── README.md │ ├── markdown │ │ ├── markdown_good_1.md │ │ ├── markdown_bad_1.md │ │ └── README.md │ ├── perl │ │ ├── README.md │ │ ├── perl_good_1.pl │ │ └── perl_bad_1.pl │ ├── ruby │ │ ├── README.md │ │ ├── ruby_good_1.rb │ │ └── ruby_bad_1.rb │ ├── python │ │ ├── README.md │ │ ├── python_bad_1.py │ │ └── python_good_1.py │ ├── javascript │ │ ├── README.md │ │ ├── javascript_good_1.js │ │ └── javascript_bad_1.js │ ├── coffeescript │ │ ├── README.md │ │ ├── coffeescript_bad_1.coffee │ │ └── coffeescript_good_1.coffee │ └── README.md ├── README.md ├── cleanup-docker.sh └── upload-docker.sh ├── TEMPLATES ├── .stylelintrc.json ├── .ruby-lint.yml ├── README.md ├── .tflint.hcl ├── .eslintrc.yml ├── .markdown-lint.yml ├── .golangci.yml ├── .ansible-lint.yml ├── .yaml-lint.yml ├── .coffee-lint.json ├── .dockerfilelintrc └── .python-lint ├── .github ├── linters │ ├── .stylelintrc.json │ ├── .ruby-lint.yml │ ├── .eslintrc.yml │ ├── .markdown-lint.yml │ ├── .golangci.yml │ ├── .ansible-lint.yml │ ├── .yaml-lint.yml │ └── .coffee-lint.json ├── ISSUE_TEMPLATE │ ├── BLANK.md │ ├── general-question.md │ ├── ISSUE.md │ ├── bug_report.md │ ├── feature_request.md │ └── ENHANCEMENT-REQUEST.md ├── CODEOWNERS ├── workflows │ ├── stack-linter.yml │ ├── blank.yml │ ├── deploy-PROD.yml │ ├── cleanup-DEV.yml │ └── deploy-DEV.yml └── CONTRIBUTING.md ├── newfile.js ├── SECURITY.md ├── action.yml ├── LICENSE ├── .gitignore ├── lib └── possum.sh ├── docs ├── run-linter-locally.md └── disabling-linters.md ├── CODE_OF_CONDUCT.md ├── Dockerfile └── README.md /.automation/test/terraform/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TEMPLATES/.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-standard" 3 | } 4 | -------------------------------------------------------------------------------- /.github/linters/.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-standard" 3 | } 4 | -------------------------------------------------------------------------------- /newfile.js: -------------------------------------------------------------------------------- 1 | console.log('hi'); 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | console.log('bye') 11 | -------------------------------------------------------------------------------- /.automation/test/env/env_good_1.env: -------------------------------------------------------------------------------- 1 | DB_NAME=development 2 | DEBUG_HTTP=true 3 | LOGGER_LEVEL=info 4 | MY_ENV= 5 | -------------------------------------------------------------------------------- /.automation/test/golang/golang_bad_01.go: -------------------------------------------------------------------------------- 1 | if len(in) == 0 { 2 | return "", fmt.Errorf("Input is empty") 3 | } 4 | -------------------------------------------------------------------------------- /.automation/test/env/env_bad_1.env: -------------------------------------------------------------------------------- 1 | LOGGER_LEVEL=info 2 | MY_ENV 3 | DB-NAME=testing 4 | DEbUG_hTTP=true 5 | DB_NAME=development 6 | -------------------------------------------------------------------------------- /.automation/test/golang/golang_good_01.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt.Println("hello world") 7 | } 8 | -------------------------------------------------------------------------------- /.automation/test/terraform/good/terraform_good_1.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "good" { 2 | ami = "ami-0ff8a91507f77f867" 3 | instance_type = "t2.small" 4 | } 5 | -------------------------------------------------------------------------------- /.automation/test/xml/xml_bad_1.xml: -------------------------------------------------------------------------------- 1 | 2 | Tove 3 | Jani 4 | Reminder 5 | Don't forget me this weekend! 6 | 7 | -------------------------------------------------------------------------------- /.automation/test/terraform/bad/terraform_bad_1.tf: -------------------------------------------------------------------------------- 1 | resource "aws_instance" "bad" { 2 | ami = "ami-0ff8a91507f77f867" 3 | instance_type = # invalid type! 4 | } 5 | -------------------------------------------------------------------------------- /.automation/test/xml/xml_good_1.xml: -------------------------------------------------------------------------------- 1 | 2 | Tove 3 | Jani 4 | Reminder 5 | Don't forget me this weekend! 6 | 7 | -------------------------------------------------------------------------------- /.automation/test/typescript/typescript_good_1.ts: -------------------------------------------------------------------------------- 1 | const spiderman = (person) => { 2 | return 'Hello, ' + person 3 | } 4 | 5 | const user = 'Peter Parker' 6 | console.log(spiderman(user)) 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BLANK.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | name: Blank issue 4 | about: Freeform issue, can be used for any topic. 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /TEMPLATES/.ruby-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ####################### 3 | # Rubocop Config file # 4 | ####################### 5 | 6 | inherit_gem: 7 | rubocop-github: 8 | - config/default.yml 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general-question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: General question 3 | about: Ask a question here 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/linters/.ruby-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ####################### 3 | # Rubocop Config file # 4 | ####################### 5 | 6 | inherit_gem: 7 | rubocop-github: 8 | - config/default.yml 9 | -------------------------------------------------------------------------------- /.automation/test/json/json_bad_1.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrow_spacing": { 3 | "level": ["ignore"] 4 | }, 5 | "braces_spacing": { 6 | "level": 'ignore', 7 | "spaces": 0 8 | "empty_object_spaces": 0 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.automation/test/json/json_good_1.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrow_spacing": { 3 | "level": "ignore" 4 | }, 5 | "braces_spacing": { 6 | "level": "ignore", 7 | "spaces": 0, 8 | "empty_object_spaces": 0 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | If you discover a security issue in this repo, please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github) 4 | 5 | Thanks for helping make GitHub Actions safe for everyone. 6 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/templates/forwarding.conf.j2: -------------------------------------------------------------------------------- 1 | 2 | LoadPlugin network 3 | 4 | 5 | ResolveInterval "300" 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.automation/test/css/css_bad_01.css: -------------------------------------------------------------------------------- 1 | /* Bad */ 2 | /* Multiline */ 3 | /* Comment */ 4 | .selector-3[type="text"] { 5 | background: linear-gradient(#FFFFFF, rgba(0, 0, 0, 0.8)); 6 | box-sizing: border-box; 7 | display: block; 8 | color: #AAAAAA; 9 | } 10 | -------------------------------------------------------------------------------- /.automation/test/typescript/typescript_bad_1.ts: -------------------------------------------------------------------------------- 1 | const spiderman = (person: String) => { 2 | return 'Hello, ' + person; 3 | } 4 | 5 | var handler = createHandler( { path : /webhook, secret : (process.env.SECRET) }) 6 | 7 | let user = 1; 8 | console.log(spiderman(user)); 9 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # These owners will be the default owners for everything in the repo # 3 | ###################################################################### 4 | * @admiralawkbar @jwiebalk @zkoppert -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/templates/splunk-settings.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "syslog": { 3 | "enabled": true, 4 | "server": "{{ splunk_host }}:{{ splunk_port }}", 5 | "protocol_name": "udp", 6 | "tls_enabled": false, 7 | "cert": null 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Super-Linter' 2 | author: 'GitHub' 3 | description: 'It is a simple combination of various linters, written in bash, to help validate your source code.' 4 | runs: 5 | using: 'docker' 6 | image: 'Dockerfile' 7 | branding: 8 | icon: 'check-square' 9 | color: 'white' 10 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/templates/collectd-settings.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "collectd": { 3 | "enabled": true, 4 | "server": "{{ collectd_server }}", 5 | "port": {{ collectd_port }}, 6 | "encryption": null, 7 | "username": null, 8 | "password": null 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/files/ghe-initial-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "private_mode": false, 3 | "signup_enabled": true, 4 | "github_hostname": "github-test.local", 5 | "github_ssl": { 6 | "enabled": false, 7 | "cert": null, 8 | "key": null 9 | }, 10 | "auth_mode": "default" 11 | } 12 | -------------------------------------------------------------------------------- /.automation/test/docker/good/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10 2 | 3 | # Create app directory 4 | RUN mkdir -p /usr/src/app 5 | WORKDIR /usr/src/app 6 | 7 | # Install app dependencies 8 | COPY package.json /usr/src/app/ 9 | RUN npm install 10 | 11 | ADD server.js server.js 12 | EXPOSE 3000 13 | CMD ["node", "server.js"] 14 | -------------------------------------------------------------------------------- /.automation/test/yml/yml_good_1.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ##################### 4 | ##################### 5 | ## Heres some vars ## 6 | ##################### 7 | ##################### 8 | 9 | ############ 10 | # Env Vars # 11 | ############ 12 | env: 13 | browser: true 14 | es6: true 15 | jest: true 16 | 17 | Here: there 18 | 19 | something: "For Nothing" 20 | -------------------------------------------------------------------------------- /.automation/test/docker/bad/Dockerfile: -------------------------------------------------------------------------------- 1 | from node:latest 2 | 3 | # Create app directory 4 | run mkdir -p /usr/src/app 5 | WORKDIR /usr/src/app 6 | 7 | # Install app dependencies 8 | copy package.json /usr/src/app/ /here/there 9 | RUN sudo npm install 10 | 11 | ADD server.js server.js 12 | EXPOSE 1 13 | CMD ["node", "server.js"] 14 | ENtrypoint /tmp/here.sh 15 | -------------------------------------------------------------------------------- /.automation/test/shell/shell_bad_1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # CMD 4 | HELLO_WORLD=($(echo "Hello World" | cut -f1 -d' ' 2>&1)) 5 | 6 | # Load the error code 7 | ERROR_CODE=$? 8 | 9 | # Check the shell 10 | if [ $ERROR_CODE -ne 0]; then 11 | echo "We did it!" 12 | exit 0 13 | else 14 | echo "We done goofed it..." 15 | echo $HELLO_WORLD 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /.automation/test/shell/shell_good_1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # CMD 4 | HELLO_WORLD=$(echo "Hello World" | cut -f1 -d' ' 2>&1) 5 | 6 | # Load the error code 7 | ERROR_CODE=$? 8 | 9 | # Check the shell 10 | if [ $ERROR_CODE -ne 0 ]; then 11 | echo "We did it!" 12 | exit 0 13 | else 14 | echo "We done goofed it..." 15 | echo "$HELLO_WORLD" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /.automation/test/yml/yml_bad_1.yml: -------------------------------------------------------------------------------- 1 | ##################### 2 | ##################### 3 | ## Heres some vars ## 4 | ##################### 5 | ##################### 6 | 7 | ############ 8 | # Env Vars # 9 | ############ 10 | env: 11 | browser: here: there : again "yep" 12 | es6: 0 13 | jest: yes 14 | 15 | Here: there 'is' something going on 16 | 17 | something: "For 'Nothing'" 123 18 | -------------------------------------------------------------------------------- /.automation/test/markdown/markdown_good_1.md: -------------------------------------------------------------------------------- 1 | # Good Markdown 2 | 3 | This is just standard good markdown. 4 | 5 | ## Second level header 6 | 7 | This header follows the step down from `level 1`. 8 | 9 | - Here it *is* 10 | - Some more **indention** 11 | - why so much? 12 | 13 | ```bash 14 | ls -la 15 | ``` 16 | 17 | ### Walk away 18 | 19 | Were all done **here**. 20 | - [Link Action](https://github.com) 21 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ################################ 3 | ################################ 4 | ## GitHub Enterprise Handlers ## 5 | ################################ 6 | ################################ 7 | 8 | #################### 9 | # GHE config apply # 10 | #################### 11 | - name: ghe config apply 12 | command: ghe-config-apply 13 | poll: 0 14 | async: 300 15 | -------------------------------------------------------------------------------- /.automation/test/markdown/markdown_bad_1.md: -------------------------------------------------------------------------------- 1 | ## Bad Markdown 2 | 3 | This is just standard good markdown. 4 | 5 | ###### Second level header 6 | 7 | This header does **NOT** follow the step down from `level 1`. 8 | 9 | - Here it *is* 10 | - Some more indention 11 | - why so much? 12 | 13 | ``` 14 | ls -la 15 | ``` 16 | 17 | # Walk away 18 | 19 | Were all done **here**. 20 | - [Link Action]https://github.com 21 | -------------------------------------------------------------------------------- /.automation/test/css/css_good_01.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Multi-line comment 3 | */ 4 | 5 | .selector-1, 6 | .selector-2, 7 | .selector-3[type="text"] { 8 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 9 | box-sizing: border-box; 10 | display: block; 11 | color: #333; 12 | } 13 | 14 | .selector-a, 15 | .selector-b:not(:first-child) { 16 | padding: 10px !important; 17 | top: calc(calc(1em * 2) / 3); 18 | } 19 | 20 | .selector-x { width: 10%; } 21 | .selector-y { width: 20%; } 22 | .selector-z { width: 30%; } 23 | -------------------------------------------------------------------------------- /.automation/test/docker/README.md: -------------------------------------------------------------------------------- 1 | # Docker Test Cases 2 | This folder holds the test cases for **Docker**. 3 | 4 | ## Additional Docs 5 | Due to the nature of the naming of files, we have `2` subfolders in this directory. 6 | - `good` is for working, and correct **Dockerfile**(s) 7 | - `bad` is for invalid, and incorrect **Dockerfile**(s) 8 | 9 | ## Good Test Cases 10 | - **Note:** They are linted utilizing the default linter rules. 11 | 12 | ## Bad Test Cases 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/ISSUE.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | name: Issue Template 4 | about: Used for creating issues about the GitHub Super-Linter 5 | 6 | --- 7 | 8 | --- 9 | ### Issue with GitHub Super-Linter 10 | 11 | --- 12 | **Branch/Version:** Example: Master 13 | 14 | --- 15 | **How to Reproduce:** Example: tried to build it 16 | 17 | --- 18 | **Expected Behavior:** Example: It should have worked 19 | 20 | --- 21 | **Additional Details:** Example: only happens half past midnight 22 | 23 | -------------------------------------------------------------------------------- /TEMPLATES/README.md: -------------------------------------------------------------------------------- 1 | # TEMPLATES 2 | 3 | The files in this folder are template rules for the linters that will run against your code base. If you chose to copy these to your local repository in the directory: `.github/` they will be used at runtime. If they are not present, they will be used by default in the linter run. 4 | 5 | The file(s) will be parsed at run time on the local branch to load all rules needed to run the **Super-Linter** **GitHub** Action. 6 | The **GitHub** Action will inform the user via the **Checks API** on the status and success of the process. 7 | -------------------------------------------------------------------------------- /.automation/test/css/README.md: -------------------------------------------------------------------------------- 1 | # CSS Test Cases 2 | This folder holds the test cases for **CSS**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/env/README.md: -------------------------------------------------------------------------------- 1 | # ENV Test Cases 2 | This folder holds the test cases for **ENV**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/xml/README.md: -------------------------------------------------------------------------------- 1 | # XML Test Cases 2 | This folder holds the test cases for **XML**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/yml/README.md: -------------------------------------------------------------------------------- 1 | # Yml Test Cases 2 | This folder holds the test cases for **Yml**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/json/README.md: -------------------------------------------------------------------------------- 1 | # Json Test Cases 2 | This folder holds the test cases for **Json**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/perl/README.md: -------------------------------------------------------------------------------- 1 | # Perl Test Cases 2 | This folder holds the test cases for **Perl**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/ruby/README.md: -------------------------------------------------------------------------------- 1 | # Ruby Test Cases 2 | This folder holds the test cases for **Ruby**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/shell/README.md: -------------------------------------------------------------------------------- 1 | # Bash Test Cases 2 | This folder holds the test cases for **Bash**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/golang/README.md: -------------------------------------------------------------------------------- 1 | # Golang Test Cases 2 | This folder holds the test cases for **Golang**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/python/README.md: -------------------------------------------------------------------------------- 1 | # Python Test Cases 2 | This folder holds the test cases for **Python**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/markdown/README.md: -------------------------------------------------------------------------------- 1 | # Markdown Test Cases 2 | This folder holds the test cases for **Markdown**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/javascript/README.md: -------------------------------------------------------------------------------- 1 | # Javascript Test Cases 2 | This folder holds the test cases for **Javascript**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/typescript/README.md: -------------------------------------------------------------------------------- 1 | # Typescript Test Cases 2 | This folder holds the test cases for **Typescript**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/coffeescript/README.md: -------------------------------------------------------------------------------- 1 | # Coffeescript Test Cases 2 | This folder holds the test cases for **Coffeescript**. 3 | 4 | ## Additional Docs 5 | No Additional information is needed for this test case. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.automation/test/ansible/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Test Cases 2 | This folder holds the test cases for **Ansible**. 3 | 4 | ## Additional Docs 5 | The folder **ghe-initialize** is pulled from the **GitHub-Demo-Stack** and is a valid **Ansible** role. 6 | 7 | ## Good Test Cases 8 | The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. 9 | - **Note:** They are linted utilizing the default linter rules. 10 | 11 | ## Bad Test Cases 12 | The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. 13 | - **Note:** They are linted utilizing the default linter rules. 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /TEMPLATES/.tflint.hcl: -------------------------------------------------------------------------------- 1 | // https://github.com/terraform-linters/tflint/blob/master/docs/guides/config.md 2 | config { 3 | module = true 4 | deep_check = false 5 | force = false 6 | 7 | // aws_credentials = { 8 | // access_key = "AWS_ACCESS_KEY" 9 | // secret_key = "AWS_SECRET_KEY" 10 | // region = "us-east-1" 11 | // } 12 | 13 | // ignore_module = { 14 | // "github.com/terraform-linters/example-module" = true 15 | // } 16 | 17 | // varfile = ["example1.tfvars", "example2.tfvars"] 18 | 19 | // variables = ["foo=bar", "bar=[\"baz\"]"] 20 | } 21 | 22 | rule "aws_instance_invalid_type" { 23 | enabled = false 24 | } 25 | 26 | rule "aws_instance_previous_type" { 27 | enabled = false 28 | } 29 | 30 | // plugin "example" { 31 | // enabled = true 32 | // } 33 | -------------------------------------------------------------------------------- /TEMPLATES/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ############################# 4 | ############################# 5 | ## JavaScript Linter rules ## 6 | ############################# 7 | ############################# 8 | 9 | ############ 10 | # Env Vars # 11 | ############ 12 | env: 13 | browser: true 14 | es6: true 15 | jest: true 16 | 17 | ############### 18 | # Global Vars # 19 | ############### 20 | globals: 21 | Atomics: readonly 22 | SharedArrayBuffer: readonly 23 | 24 | ############### 25 | # Parser vars # 26 | ############### 27 | parser: '@typescript-eslint/parser' 28 | parserOptions: 29 | ecmaVersion: 2018 30 | sourceType: module 31 | 32 | ########### 33 | # Plugins # 34 | ########### 35 | plugins: 36 | - '@typescript-eslint' 37 | 38 | ######### 39 | # Rules # 40 | ######### 41 | rules: {} 42 | -------------------------------------------------------------------------------- /.github/linters/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ############################# 4 | ############################# 5 | ## JavaScript Linter rules ## 6 | ############################# 7 | ############################# 8 | 9 | ############ 10 | # Env Vars # 11 | ############ 12 | env: 13 | browser: true 14 | es6: true 15 | jest: true 16 | 17 | ############### 18 | # Global Vars # 19 | ############### 20 | globals: 21 | Atomics: readonly 22 | SharedArrayBuffer: readonly 23 | 24 | ############### 25 | # Parser vars # 26 | ############### 27 | parser: '@typescript-eslint/parser' 28 | parserOptions: 29 | ecmaVersion: 2018 30 | sourceType: module 31 | 32 | ########### 33 | # Plugins # 34 | ########### 35 | plugins: 36 | - '@typescript-eslint' 37 | 38 | ######### 39 | # Rules # 40 | ######### 41 | rules: {} 42 | -------------------------------------------------------------------------------- /.automation/test/README.md: -------------------------------------------------------------------------------- 1 | # Test Cases 2 | This folder holds `test cases` that are used to validate the sanity of the **Super-Linter**. 3 | The format: 4 | - Each **Super-Linter** language should have its own folder 5 | - Folder(s) containing test cases for each language supported 6 | - Passing test case(s) per language denoted in naming scheme 7 | - **FORMAT:** `LANGUAGE_(TYPE)_FILE.EXTENSION` 8 | - **Example:** `markdown_good_5.md` 9 | - **Note:** This allows the process to understand if linting of the file should pass or fail\ 10 | - **Note:** (good=Standard linting should be successful bad=standard linting should fail ) 11 | - Failing test case(s) per language denoted in naming scheme 12 | - **FORMAT:** `LANGUAGE_(TYPE)_FILE.EXTENSION` 13 | - **Example:** `markdown_bad_5.md` 14 | - **Note:** (good=Standard linting should be successful bad=standard linting should fail ) 15 | - Script to run test cases and validate the sanity of **Super-Linter** 16 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/tasks/ghe-config-apply.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | ######################################## 4 | # Copy the script to the local machine # 5 | ######################################## 6 | - name: Copy the script to the GHE instance 7 | become: true 8 | template: 9 | force: 'yes' 10 | src: "ghe-config-apply.sh" 11 | dest: /tmp/ghe-config-apply.sh 12 | owner: admin 13 | group: admin 14 | mode: 0755 15 | 16 | ################################## 17 | # Run config to take in settings # 18 | ################################## 19 | - name: Run ghe-config-apply for Settings to Take Effect 20 | shell: "nohup ./tmp/ghe-config-apply.sh /dev/null 2>&1 &" 21 | async: 300 22 | poll: 0 23 | args: 24 | executable: "/bin/bash" 25 | 26 | ###################### 27 | # Set the tags block # 28 | ###################### 29 | tags: 30 | - github 31 | - ghe_primary 32 | - initialize 33 | -------------------------------------------------------------------------------- /.automation/test/ruby/ruby_good_1.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Rails Console only 4 | # This script will output all active webhooks currently being processed by an instance. 5 | # Replace ARRAY_OF_URLS_CALLING_INSTANCE and GHES_URL with the appropriate values before running 6 | 7 | # Prior to running this script, compile a list of the top URLs containing the phrase webhook 8 | # This should be ran prior to entering the Rails Console with the command: 9 | # grep -B1 --no-group-separator 'Faraday::TimeoutError' hookshot-logs/resqued.log | sed -n 1~2p | 10 | # \ grep -v 'Faraday::TimeoutError: request timed out' | sort | uniq -c |sort -rn | head -n 20 11 | 12 | File.open("/tmp/urls.txt", "w") do |file| 13 | Hook.active.map do |h| 14 | urls = [ARRAY_OF_URLS_CALLING_INSTANCE] 15 | next if urls.include? h.url 16 | 17 | begin 18 | file.puts "https://GHES_URL/api/v3/repos/#{h.installation_target.full_name}/hooks/#{h.id}" 19 | rescue StandardError => e 20 | puts e.message 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /.automation/test/ruby/ruby_bad_1.rb: -------------------------------------------------------------------------------- 1 | 2 | # Rails Console only 3 | # This script will output all active webhooks currently being processed by an instance. 4 | # Replace ARRAY_OF_URLS_CALLING_INSTANCE and GHES_URL with the appropriate values before running 5 | 6 | # Prior to running this script, compile a list of the top URLs containing the phrase webhook 7 | # This should be ran prior to entering the Rails Console with the command: 8 | # grep -B1 --no-group-separator 'Faraday::TimeoutError' hookshot-logs/resqued.log | sed -n 1~2p | 9 | # \ grep -v 'Faraday::TimeoutError: request timed out' | sort | uniq -c |sort -rn | head -n 20 10 | 11 | File.open('/tmp/urls.txt', " w" ) do | file| 12 | Hook.active.map do |h | 13 | urls = [ ARRAY_OF_URLS_CALLING_INSTANCE] 14 | 15 | next if urls.include? h.url 16 | 17 | 18 | begin 19 | file.puts "https://GHES_URL/api/v3/repos/#{h.installation_target.full_name}/hooks/#{h.id}" 20 | 21 | rescue StandardError => e 22 | puts e.message 23 | 24 | end 25 | 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /TEMPLATES/.markdown-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################### 3 | ########################### 4 | ## Markdown Linter rules ## 5 | ########################### 6 | ########################### 7 | 8 | # Linter rules doc: 9 | # - https://github.com/DavidAnson/markdownlint 10 | # 11 | # Note: 12 | # To comment out a single error: 13 | # 14 | # any violations you want 15 | # 16 | # 17 | 18 | ############### 19 | # Rules by id # 20 | ############### 21 | MD004: false # Unordered list style 22 | MD007: 23 | indent: 2 # Unordered list indentation 24 | MD013: 25 | line_length: 808 # Line length 26 | MD026: 27 | punctuation: ".,;:!。,;:" # List of not allowed 28 | MD029: false # Ordered list item prefix 29 | MD033: false # Allow inline HTML 30 | MD036: false # Emphasis used instead of a heading 31 | 32 | ################# 33 | # Rules by tags # 34 | ################# 35 | blank_lines: false # Error on blank lines 36 | -------------------------------------------------------------------------------- /.github/linters/.markdown-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################### 3 | ########################### 4 | ## Markdown Linter rules ## 5 | ########################### 6 | ########################### 7 | 8 | # Linter rules doc: 9 | # - https://github.com/DavidAnson/markdownlint 10 | # 11 | # Note: 12 | # To comment out a single error: 13 | # 14 | # any violations you want 15 | # 16 | # 17 | 18 | ############### 19 | # Rules by id # 20 | ############### 21 | MD004: false # Unordered list style 22 | MD007: 23 | indent: 2 # Unordered list indentation 24 | MD013: 25 | line_length: 808 # Line length 26 | MD026: 27 | punctuation: ".,;:!。,;:" # List of not allowed 28 | MD029: false # Ordered list item prefix 29 | MD033: false # Allow inline HTML 30 | MD036: false # Emphasis used instead of a heading 31 | 32 | ################# 33 | # Rules by tags # 34 | ################# 35 | blank_lines: false # Error on blank lines 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 GitHub 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /TEMPLATES/.golangci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ######################### 3 | ######################### 4 | ## Golang Linter rules ## 5 | ######################### 6 | ######################### 7 | 8 | # configure golangci-lint 9 | # see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml 10 | issues: 11 | exclude-rules: 12 | - path: _test\.go 13 | linters: 14 | - dupl 15 | - gosec 16 | - goconst 17 | linters: 18 | enable: 19 | - golint 20 | - gosec 21 | - unconvert 22 | - gocyclo 23 | - goconst 24 | - goimports 25 | - maligned 26 | - gocritic 27 | linters-settings: 28 | errcheck: 29 | # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 30 | # default is false: such cases aren't reported by default. 31 | check-blank: true 32 | govet: 33 | # report about shadowed variables 34 | check-shadowing: true 35 | gocyclo: 36 | # minimal code complexity to report, 30 by default 37 | min-complexity: 15 38 | maligned: 39 | # print struct with more effective memory layout or not, false by default 40 | suggest-new: true 41 | -------------------------------------------------------------------------------- /.github/linters/.golangci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ######################### 3 | ######################### 4 | ## Golang Linter rules ## 5 | ######################### 6 | ######################### 7 | 8 | # configure golangci-lint 9 | # see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml 10 | issues: 11 | exclude-rules: 12 | - path: _test\.go 13 | linters: 14 | - dupl 15 | - gosec 16 | - goconst 17 | linters: 18 | enable: 19 | - golint 20 | - gosec 21 | - unconvert 22 | - gocyclo 23 | - goconst 24 | - goimports 25 | - maligned 26 | - gocritic 27 | linters-settings: 28 | errcheck: 29 | # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; 30 | # default is false: such cases aren't reported by default. 31 | check-blank: true 32 | govet: 33 | # report about shadowed variables 34 | check-shadowing: true 35 | gocyclo: 36 | # minimal code complexity to report, 30 by default 37 | min-complexity: 15 38 | maligned: 39 | # print struct with more effective memory layout or not, false by default 40 | suggest-new: true 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | -------------------------------------------------------------------------------- /.automation/README.md: -------------------------------------------------------------------------------- 1 | # .automation 2 | This folder holds automation scripts to help `deploy` and `cleanup` **DockerHub** images of the **Super-Linter** 3 | 4 | ## cleanup-docker.md 5 | This script uses **GitHub Actions** so that when a PR is merged and closed, the **GitHub Action** is triggered. 6 | It will then search **DockerHub** for the image that was deployed during the development, and remove it. 7 | 8 | ## upload-docker.sh 9 | This script uses **GitHub Actions** so that a push to the repository is committed, it will complete the following: 10 | - Checkout the source code 11 | - Build the **Docker** container for **Super-Linter** using that source code 12 | - Upload the container to **DockerHub** 13 | 14 | When the script is triggered on master, it will push with the tag:**latest** which is used by all scripting for general availability. 15 | When the script is triggered in a branch, it will push with the tag:**NameOfBranch** which can be used for: 16 | - *testing* 17 | - *troubleshooting* 18 | - *debugging* 19 | - **Note:** The branch name will be reduced to AlpaNumeric for consistency and uploading 20 | 21 | ## test 22 | This folder holds all **Test Cases** to help run the *CI/CT/CD* process for the **Super-Linter**. 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/ENHANCEMENT-REQUEST.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | name: Enhancement Request 4 | about: Used for requesting enhancements to the GitHub Super-Linter 5 | 6 | --- 7 | 8 | 9 | **What is the current behavior, if applicable?** 10 | 11 | 12 | **What is the desired behavior?** 13 | 14 | 15 | **Your impression of priority / how important this request is** 16 | 17 | - [ ] Critical: Can't use the tool without it. 18 | - [ ] Business Critical: Immediate opportunity to win business with this feature 19 | - [ ] Important: Will significantly enhance the overall utility of the demo 20 | - [ ] Nice to have: self-explanatory 21 | 22 | **Business case or other information justifying priority** 23 | 24 | **Agreed upon priority** 25 | - [ ] Critical: Can't use the tool without it. 26 | - [ ] Business Critical: Immediate opportunity to win business with this feature 27 | - [ ] Important: Will significantly enhance the overall utility of the demo 28 | - [ ] Nice to have: self-explanatory 29 | 30 | **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc) 31 | 32 | -------------------------------------------------------------------------------- /.github/workflows/stack-linter.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ############################ 3 | ############################ 4 | ## Preflight Stack Linter ## 5 | ############################ 6 | ############################ 7 | 8 | # 9 | # Documentation: 10 | # https://help.github.com/en/articles/workflow-syntax-for-github-actions 11 | # 12 | 13 | ############################# 14 | # Start the job on all push # 15 | ############################# 16 | on: 17 | push: 18 | branches-ignore: 19 | - 'master' 20 | 21 | ############### 22 | # Set the Job # 23 | ############### 24 | jobs: 25 | build: 26 | # Name the Job 27 | name: Stack linter 28 | # Set the agent to run on 29 | runs-on: ubuntu-latest 30 | ################## 31 | # Load all steps # 32 | ################## 33 | steps: 34 | ########################## 35 | # Checkout the code base # 36 | ########################## 37 | - name: Checkout Code 38 | uses: actions/checkout@v2 39 | 40 | ################################ 41 | # Run Linter against code base # 42 | ################################ 43 | - name: Lint Code Base 44 | uses: docker://github/super-linter:latest 45 | env: 46 | VALIDATE_ALL_CODEBASE: false 47 | -------------------------------------------------------------------------------- /.github/workflows/blank.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the master branch 7 | on: 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | # This workflow contains a single job called "build" 16 | build: 17 | # The type of runner that the job will run on 18 | runs-on: ubuntu-latest 19 | 20 | # Steps represent a sequence of tasks that will be executed as part of the job 21 | steps: 22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 23 | - uses: actions/checkout@v2 24 | 25 | # Runs a single command using the runners shell 26 | - name: Run a one-line script 27 | run: echo Hello, world! 28 | 29 | # Runs a set of commands using the runners shell 30 | - name: Run a multi-line script 31 | run: | 32 | echo Add other actions to build, 33 | echo test, and deploy your project. 34 | 35 | - name: Super-Linter 36 | uses: github/super-linter@v2.1.0 37 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/tasks/ghe-ldap-configuration.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | ####################################################### 4 | # Copy License file to GHE to decrypt file and upload # 5 | ####################################################### 6 | # Copy of the file will allow for Ansible Vault to decrypt the file 7 | # and place it on the new remote machine 8 | - name: Copy ldap-settings.json File to GHE 9 | become: true 10 | template: 11 | src: "ldap-settings.json.j2" 12 | dest: /tmp/ldap-settings.json 13 | owner: admin 14 | group: admin 15 | mode: 0644 16 | 17 | ####################################### 18 | # Set up LDAP with ldap-settings.json # 19 | ####################################### 20 | - name: Setup ldap with ldap-settings.json 21 | shell: curl --fail -Lk -X PUT 'https://api_key:{{ github_admin_password }}@{{ ansible_host }}:8443/setup/api/settings' --data-urlencode "settings=`cat /tmp/ldap-settings.json`" # yamllint disable-line 22 | retries: 10 23 | delay: 2 24 | register: http_ldapconfig_result 25 | until: http_ldapconfig_result.rc == 0 26 | 27 | ###################### 28 | # Set the tags block # 29 | ###################### 30 | tags: 31 | - openldap 32 | -------------------------------------------------------------------------------- /TEMPLATES/.ansible-lint.yml: -------------------------------------------------------------------------------- 1 | ########################## 2 | ########################## 3 | ## Ansible Linter rules ## 4 | ########################## 5 | ########################## 6 | 7 | ############################# 8 | # Exclude paths from linter # 9 | ############################# 10 | #exclude_paths: 11 | 12 | ######################## 13 | # Make output parsable # 14 | ######################## 15 | parseable: true 16 | 17 | ####################### 18 | # Set output to quiet # 19 | ####################### 20 | quiet: true 21 | 22 | ##################### 23 | # Path to rules dir # 24 | ##################### 25 | #rulesdir: 26 | 27 | ################ 28 | # Tags to skip # 29 | ################ 30 | skip_list: 31 | - '602' # Allow compare to empty string 32 | - '204' # Allow string length greater that 160 chars 33 | - '301' # False positives for running command shells 34 | - '303' # Allow git commands for push add, etc... 35 | - '305' # Allow use of shell when you want 36 | - '503' # Allow step to run like handler 37 | 38 | ################## 39 | # Tags to follow # 40 | ################## 41 | #tags: 42 | 43 | ############# 44 | # Use rules # 45 | ############# 46 | use_default_rules: true 47 | 48 | ################# 49 | # Set verbosity # 50 | ################# 51 | verbosity: 1 52 | -------------------------------------------------------------------------------- /.github/linters/.ansible-lint.yml: -------------------------------------------------------------------------------- 1 | ########################## 2 | ########################## 3 | ## Ansible Linter rules ## 4 | ########################## 5 | ########################## 6 | 7 | ############################# 8 | # Exclude paths from linter # 9 | ############################# 10 | #exclude_paths: 11 | 12 | ######################## 13 | # Make output parsable # 14 | ######################## 15 | parseable: true 16 | 17 | ####################### 18 | # Set output to quiet # 19 | ####################### 20 | quiet: true 21 | 22 | ##################### 23 | # Path to rules dir # 24 | ##################### 25 | #rulesdir: 26 | 27 | ################ 28 | # Tags to skip # 29 | ################ 30 | skip_list: 31 | - '602' # Allow compare to empty string 32 | - '204' # Allow string length greater that 160 chars 33 | - '301' # False positives for running command shells 34 | - '303' # Allow git commands for push add, etc... 35 | - '305' # Allow use of shell when you want 36 | - '503' # Allow step to run like handler 37 | 38 | ################## 39 | # Tags to follow # 40 | ################## 41 | #tags: 42 | 43 | ############# 44 | # Use rules # 45 | ############# 46 | use_default_rules: true 47 | 48 | ################# 49 | # Set verbosity # 50 | ################# 51 | verbosity: 1 52 | -------------------------------------------------------------------------------- /lib/possum.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat </dev/null 2>&1 &" 8 | # async: 45 9 | # poll: 0 10 | # args: 11 | # executable: "/bin/bash" 12 | 13 | ################################## 14 | # Run config to take in settings # 15 | ################################## 16 | - name: Run Configure for Settings to Take Effect 17 | uri: 18 | url: "https://{{ ansible_host }}:8443/setup/api/configure" 19 | method: POST 20 | return_content: "yes" 21 | user: "api_key" 22 | password: "{{ github_admin_password }}" 23 | force_basic_auth: "yes" 24 | validate_certs: "no" 25 | status_code: 202 26 | 27 | ################################################################# 28 | # Wait for 'ghe-config-apply' to be completed before continuing # 29 | ################################################################# 30 | - name: Ensure ghe-config-apply is completed 31 | # https://docs.ansible.com/ansible/uri_module.html 32 | # yamllint disable-line 33 | # https://developer.github.com/enterprise/v3/enterprise-admin/management_console/#check-configuration-status 34 | uri: 35 | url: "https://{{ ansible_host }}:8443/setup/api/configcheck" 36 | method: GET 37 | return_content: "yes" 38 | user: "api_key" 39 | password: "{{ github_admin_password }}" 40 | force_basic_auth: "yes" 41 | validate_certs: "no" 42 | register: configcheck 43 | until: configcheck.status == 200 and configcheck.json.status == "success" 44 | retries: 100 45 | delay: 10 46 | 47 | ##################################### 48 | # Remove the files from the machine # 49 | ##################################### 50 | # Need to remove the license file and settings 51 | # files that were copied to the ghe server 52 | - name: Remove temp Files from GHE 53 | become: true 54 | file: 55 | path: "{{ item }}" 56 | state: absent 57 | with_items: 58 | - "/tmp/ghe-license.ghl" 59 | - "/tmp/settings.json" 60 | - "/tmp/ldap-settings.json" 61 | 62 | ###################### 63 | # Set the tags block # 64 | ###################### 65 | tags: 66 | - github 67 | - ghe_primary 68 | - initialize 69 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | :wave: Hi there! 3 | We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. 4 | 5 | ## Submitting a pull request 6 | [Pull Requests][pulls] are used for adding new playbooks, roles, and documents to the repository, or editing the existing ones. 7 | 8 | **With write access** 9 | 1. Clone the repository (only if you have write access) 10 | 1. Create a new branch: `git checkout -b my-branch-name` 11 | 1. Make your change 12 | 1. Push and [submit a pull request][pr] 13 | 1. Pat yourself on the back and wait for your pull request to be reviewed and merged. 14 | 15 | **Without write access** 16 | 1. [Fork][fork] and clone the repository 17 | 1. Create a new branch: `git checkout -b my-branch-name` 18 | 1. Make your change 19 | 1. Push to your fork and [submit a pull request][pr] 20 | 1. Pat your self on the back and wait for your pull request to be reviewed and merged. 21 | 22 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: 23 | 24 | - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. 25 | - Write [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 26 | 27 | Draft pull requests are also welcome to get feedback early on, or if there is something blocking you. 28 | 29 | - Create a branch with a name that identifies the user and nature of the changes (similar to `user/branch-purpose`) 30 | - Open a pull request 31 | 32 | ## Releasing 33 | If you are the current maintainer of this action: 34 | 1. Update `README.md` to reflect new version number in the suggested workflow file section 35 | 2. Draft [Release](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) document explaining details of Release 36 | 3. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) 37 | 38 | ## Resources 39 | - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) 40 | - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) 41 | - [GitHub Help](https://help.github.com) 42 | 43 | [pulls]: https://github.com/github/super-linter/pulls 44 | [pr]: https://github.com/github/super-linter/compare 45 | [fork]: https://github.com/github/super-linter/fork 46 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ###################################### 3 | ###################################### 4 | ## Configure the GHE Instance Block ## 5 | ###################################### 6 | ###################################### 7 | - block: 8 | ###################################################### 9 | # Need to run the tasks to stand up the GHE instance # 10 | ###################################################### 11 | # Configure the base system 12 | - include_tasks: ghe-initial-configuration.yml 13 | 14 | ###################### 15 | # Set the tags block # 16 | ###################### 17 | tags: 18 | - github 19 | - ghe_primary 20 | - initialize 21 | ################################################# 22 | ############### End of Block #################### 23 | ################################################# 24 | 25 | ################################## 26 | ################################## 27 | ## Configure the GHE LDAP Block ## 28 | ################################## 29 | ################################## 30 | - block: 31 | ############################################################ 32 | # Need to run the tasks to config LDAP on the GHE instance # 33 | ############################################################ 34 | # Configure the base system 35 | - include_tasks: ghe-ldap-configuration.yml 36 | 37 | ###################### 38 | # Set the tags block # 39 | ###################### 40 | tags: 41 | - openldap 42 | ################################################# 43 | ############### End of Block #################### 44 | ################################################# 45 | 46 | ###################################### 47 | ###################################### 48 | ## Configure the GHE Instance Block ## 49 | ###################################### 50 | ###################################### 51 | - block: 52 | ###################################################### 53 | # Need to run the tasks to stand up the GHE instance # 54 | ###################################################### 55 | # Configure the base system 56 | - include_tasks: ghe-api-config-apply.yml 57 | 58 | ###################### 59 | # Set the tags block # 60 | ###################### 61 | tags: 62 | - github 63 | - ghe_primary 64 | - initialize 65 | ################################################# 66 | ############### End of Block #################### 67 | ################################################# 68 | -------------------------------------------------------------------------------- /docs/run-linter-locally.md: -------------------------------------------------------------------------------- 1 | # Run Super-Linter locally to test your branch of code 2 | If you want to test locally against the **Super-Linter** to test your branch of code, you will need to complete the following: 3 | - Clone your testing source code to your local environment 4 | - Install Docker to your local environment 5 | - Pull the container down 6 | - Run the container 7 | - Debug/Troubleshoot 8 | 9 | ## Install Docker to your local machine 10 | You can follow the link below on how to install and configure **Docker** on your local machine 11 | - [Docker Install Documentation](https://docs.docker.com/install/) 12 | 13 | ## Download the latest Super-Linter Docker container 14 | - Pull the latest **Docker** container down from **DockerHub** 15 | - `docker pull github/super-linter:latest` 16 | Once the container has been downloaded to your local environment, you can then begin the process, or running the container against your codebase. 17 | 18 | ## Run the container Locally 19 | - You can run the container locally with the following **Base** flags to run your code: 20 | - `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint github/super-linter` 21 | - To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file github/super-linter` 22 | - **NOTE:** You need to pass the `RUN_LOCAL` flag to bypass some of the GitHub Actions checks, as well as the mapping of your local codebase to `/tmp/lint` so that the linter can pick up the code 23 | - **NOTE:** If you want to override the `/tmp/lint` folder, you can set the `DEFAULT_WORKSPACE` environment variable to point to the folder you'd prefer to scan. 24 | - **NOTE:** The flag:`RUN_LOCAL` will set: `VALIDATE_ALL_CODEBASE` to true. This means it will scan **all** the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted 25 | 26 | ### Flags for running Locally 27 | You can add as many **Additional** flags as needed, documented in [README.md](../README.md#Environment-variables) 28 | 29 | ## Troubleshooting 30 | 31 | ### Run container and gain access to the command line 32 | If you need to run the container locally and gain access to its command line, you can run the following command: 33 | - `docker run -it --entrypoint /bin/bash github/super-linter` 34 | - This will drop you in the command line of the docker container for any testing or troubleshooting that may be needed. 35 | 36 | ### Found issues 37 | If you find a *bug* or *issue*, please open a **GitHub** issue at: `https://github.com/github/super-linter/issues` 38 | -------------------------------------------------------------------------------- /.automation/test/coffeescript/coffeescript_bad_1.coffee: -------------------------------------------------------------------------------- 1 | # Description 2 | # silly hubot scripts 3 | # These were created to blow off steam 4 | # 5 | # Commands: 6 | # `mona echo *` - repeats what you say 7 | # 8 | # Author: 9 | # admiralAwkbar@github.com 10 | 11 | ############################### 12 | # Drop Hammer array of images # 13 | ############################### 14 | dropHammer = [ 15 | "https://s1.yimg.com/uu/api/res/1.2/.kFQAfQ6KQmlf5ip8.UzNA--/dz0xMjMwO2g9NjkyO2FwcGlkPXl0YWNoeW9u/http://media.zenfs.com/en-US/video/video.snl.com/SNL_1554_08_Update_03_Harry_Caray.png", 16 | "http://media.tumblr.com/d12ea80b3a86dfc5fe36d3f306254fe4/tumblr_inline_mq1r0tbBCb1qz4rgp.jpg", 17 | "http://the-artifice.com/wp-content/uploads/2014/01/94309-160x160.png", 18 | "http://25.media.tumblr.com/35826348f2215069835c1733c75b29aa/tumblr_muuxmmBaOI1rw3gqyo2_250.gif", 19 | "http://data2.whicdn.com/images/78766805/large.jpg", 20 | "http://filmfisher.com/wp-content/uploads/2014/11/hunt_for_red_october.jpg", 21 | "http://cdn.meme.am/instances/500x/57495736.jpg", 22 | ] 23 | 24 | ################### 25 | # Thank you array # 26 | ################### 27 | thanks = [ 28 | "You're welcome! Piece of cake...", 29 | It was nothing... 30 | "De nada...", 31 | 'Danke...' 32 | "Bitte...", 33 | "Prego..." 34 | ] 35 | 36 | ################################# 37 | # Start the robot for listening # 38 | ################################# 39 | module.exports = (robot) -> ) 40 | 41 | ############################## 42 | # Show the adapter connected # 43 | ############################## 44 | robot.respond /ADAPTER$/i, (msg) -> 45 | msg.send robot.adapterNameS 46 | 47 | ########################## 48 | # Echo back the response # 49 | ########################## 50 | robot.respond /ECHO (.*)$/i, (msg) -> 51 | msg.send msg.match[2] 52 | 53 | ################## 54 | # Whats going on # 55 | ################## 56 | robot.respond /whats going on/i, (msg) -> 57 | msg.send "not much... robot stuff..." 58 | 59 | ################### 60 | # Drop the hammer # 61 | ################### 62 | robot.respond /drop the hammer/i, (msg) -> 63 | msg.send "Commmencing the hammer dropping..." 64 | msg.send msg.random dropHammer 65 | 66 | ############### 67 | # Vape Nation # 68 | ############### 69 | robot.respond /lets roll/i, (msg) -> 70 | msg.send "First Class! Vape Nation!!! @beardofedu" 71 | 72 | ############## 73 | # Hubot Ping # 74 | ############## 75 | robot.respond /PING$/i, (msg) -> 76 | msg.sned PONG 77 | 78 | ####################### 79 | ####################### 80 | ## END OF THE SCRIPT ## 81 | ####################### 82 | ####################### 83 | -------------------------------------------------------------------------------- /.automation/test/coffeescript/coffeescript_good_1.coffee: -------------------------------------------------------------------------------- 1 | # Description 2 | # silly hubot scripts 3 | # These were created to blow off steam 4 | # 5 | # Commands: 6 | # `mona echo *` - repeats what you say 7 | # 8 | # Author: 9 | # admiralAwkbar@github.com 10 | 11 | ############################### 12 | # Drop Hammer array of images # 13 | ############################### 14 | dropHammer = [ 15 | "https://s1.yimg.com/uu/api/res/1.2/.kFQAfQ6KQmlf5ip8.UzNA--/dz0xMjMwO2g9NjkyO2FwcGlkPXl0YWNoeW9u/http://media.zenfs.com/en-US/video/video.snl.com/SNL_1554_08_Update_03_Harry_Caray.png", 16 | "http://media.tumblr.com/d12ea80b3a86dfc5fe36d3f306254fe4/tumblr_inline_mq1r0tbBCb1qz4rgp.jpg", 17 | "http://the-artifice.com/wp-content/uploads/2014/01/94309-160x160.png", 18 | "http://25.media.tumblr.com/35826348f2215069835c1733c75b29aa/tumblr_muuxmmBaOI1rw3gqyo2_250.gif", 19 | "http://data2.whicdn.com/images/78766805/large.jpg", 20 | "http://filmfisher.com/wp-content/uploads/2014/11/hunt_for_red_october.jpg", 21 | "http://cdn.meme.am/instances/500x/57495736.jpg", 22 | ] 23 | 24 | ################### 25 | # Thank you array # 26 | ################### 27 | thanks = [ 28 | "You're welcome! Piece of cake...", 29 | "It was nothing..." 30 | "De nada...", 31 | "Danke...", 32 | "Merci...", 33 | "Bitte...", 34 | "De rien..." 35 | "Prego..." 36 | ] 37 | 38 | ################################# 39 | # Start the robot for listening # 40 | ################################# 41 | module.exports = (robot) -> 42 | 43 | ############################## 44 | # Show the adapter connected # 45 | ############################## 46 | robot.respond /ADAPTER$/i, (msg) -> 47 | msg.send robot.adapterName 48 | 49 | ########################## 50 | # Echo back the response # 51 | ########################## 52 | robot.respond /ECHO (.*)$/i, (msg) -> 53 | msg.send msg.match[1] 54 | 55 | ################## 56 | # Whats going on # 57 | ################## 58 | robot.respond /whats going on/i, (msg) -> 59 | msg.send "not much... robot stuff..." 60 | 61 | ################### 62 | # Drop the hammer # 63 | ################### 64 | robot.respond /drop the hammer/i, (msg) -> 65 | msg.send "Commmencing the hammer dropping..." 66 | msg.send msg.random dropHammer 67 | 68 | ############### 69 | # Vape Nation # 70 | ############### 71 | robot.respond /lets roll/i, (msg) -> 72 | msg.send "First Class! Vape Nation!!! @beardofedu" 73 | 74 | ############## 75 | # Hubot Ping # 76 | ############## 77 | robot.respond /PING$/i, (msg) -> 78 | msg.send "PONG" 79 | 80 | ####################### 81 | ####################### 82 | ## END OF THE SCRIPT ## 83 | ####################### 84 | ####################### 85 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/tasks/collectd-settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | ############################### 4 | # Wait for admin port to open # 5 | ############################### 6 | - name: Wait for Admin port to come up (Port 8443) 7 | ## Doc: http://docs.ansible.com/ansible/latest/modules/wait_for_module.html 8 | ## Helpful Google: ansible wait_for 9 | wait_for: 10 | host: "{{ ansible_host }}" 11 | port: 8443 12 | delay: 5 13 | timeout: 300 14 | state: started 15 | changed_when: false 16 | 17 | ################################# 18 | # Wait for successful open port # 19 | ################################# 20 | - name: Wait for http status 200 21 | changed_when: false 22 | uri: 23 | url: "https://{{ ansible_host }}:8443" 24 | validate_certs: "no" 25 | register: http_result 26 | # ignore_errors: true 27 | until: http_result.status == 200 28 | retries: 100 29 | delay: 3 30 | 31 | ####################################################### 32 | # Copy License file to GHE to decrypt file and upload # 33 | ####################################################### 34 | # Copy of the file will allow for Ansible Vault to decrypt the file 35 | # and place it on the new remote machine 36 | - name: Copy collectd-settings.json File to GHE 37 | become: true 38 | template: 39 | src: "collectd-settings.json.j2" 40 | dest: /tmp/collectd-settings.json 41 | owner: admin 42 | group: admin 43 | mode: 0644 44 | 45 | ######################################################### 46 | # Set up Admin password, License, and Initial Setttings # 47 | ######################################################### 48 | - name: Setup Grafana 49 | # yamllint disable 50 | shell: curl --fail -Lk \ 51 | -X PUT "https://api_key:{{ github_admin_password }}@{{ ansible_host }}:8443/setup/api/settings" \ 52 | --data-urlencode "settings=`cat /tmp/collectd-settings.json`" 53 | # yamllint enable 54 | retries: 10 55 | delay: 5 56 | register: http_collectd_config_result 57 | until: http_collectd_config_result.rc == 0 58 | notify: ghe config apply 59 | 60 | 61 | ##################################### 62 | # Edit forwarding.conf with metrics # 63 | ##################################### 64 | - name: Copy forwarding.conf File to GHE 65 | become: true 66 | template: 67 | force: true 68 | src: "forwarding.conf.j2" 69 | dest: /etc/collectd/conf.d/forwarding.conf 70 | owner: root 71 | group: root 72 | mode: 0644 73 | 74 | ########################################### 75 | # Restart Collectd service to take effect # 76 | ########################################### 77 | - name: Restart Collectd service 78 | become: true 79 | service: 80 | name: collectd 81 | state: restarted 82 | 83 | ###################### 84 | # Set the tags block # 85 | ###################### 86 | tags: 87 | - metrics 88 | - github 89 | - ghe_primary 90 | - initialize 91 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | ############################### 4 | # Wait for admin port to open # 5 | ############################### 6 | - name: Wait for Admin port to come up (Port 8443) 7 | # yamllint disable-line 8 | ## Documentation: http://docs.ansible.com/ansible/latest/modules/wait_for_module.html 9 | ## Helpful Google: ansible wait_for 10 | wait_for: 11 | host: "{{ ansible_host }}" 12 | port: 8443 13 | delay: 5 14 | timeout: 300 15 | state: started 16 | changed_when: false 17 | 18 | ################################# 19 | # Wait for successful open port # 20 | ################################# 21 | - name: Wait for http status 200 22 | changed_when: false 23 | uri: 24 | url: "https://{{ ansible_host }}:8443" 25 | validate_certs: "no" 26 | register: http_result 27 | # ignore_errors: true 28 | until: http_result.status == 200 29 | retries: 100 30 | delay: 3 31 | 32 | ####################################################### 33 | # Copy License file to GHE to decrypt file and upload # 34 | ####################################################### 35 | # Copy of the file will allow for Ansible Vault to decrypt the file 36 | # and place it on the new remote machine 37 | - name: Copy License File to GHE 38 | become: true 39 | copy: 40 | src: "{{ role_path }}/files/ghe-license.ghl" 41 | dest: /tmp/ghe-license.ghl 42 | owner: admin 43 | group: admin 44 | mode: 0600 45 | 46 | ####################################################### 47 | # Copy License file to GHE to decrypt file and upload # 48 | ####################################################### 49 | # Copy of the file will allow for Ansible Vault to decrypt the file 50 | # and place it on the new remote machine 51 | - name: Copy settings.json File to GHE 52 | become: true 53 | template: 54 | src: "settings.json.j2" 55 | dest: /tmp/settings.json 56 | owner: admin 57 | group: admin 58 | mode: 0644 59 | 60 | ######################################################### 61 | # Set up Admin password, License, and Initial Setttings # 62 | ######################################################### 63 | - name: Setup License, Admin Password, and Initial Setttings 64 | command: curl --fail -Lk \ 65 | -X POST "https://{{ ansible_host }}:8443/setup/api/start" \ 66 | -F license=@/tmp/ghe-license.ghl \ 67 | -F "password={{ github_admin_password }}" \ 68 | -F "settings== 3.3) or 53 | # `--update` followed by the command `rm -rf /var/cache/apk/*` 54 | # when `apk` adding packages. This will result in a smaller image size 55 | apkadd-missing_nocache_or_updaterm: on 56 | 57 | # Consider using a `--virtual` or `-t` switch to group multiple packages 58 | # for easy cleanup. This will help ensure future authors will continue 59 | # to clean up build dependencies and other temporary packages 60 | apkadd-missing-virtual: on 61 | 62 | # Exposing ports should only be valid port numbers 63 | invalid_port: on 64 | 65 | # Only valid commands are allowed in a Dockerfile 66 | invalid_command: on 67 | 68 | # Expose Only Container Port 69 | expose_host_port: on 70 | 71 | # Using LABEL should be in key=value format 72 | label_invalid: on 73 | 74 | # Base images should specify a tag to use 75 | missing_tag: on 76 | 77 | # Base images should not use the latest tag 78 | latest_tag: on 79 | 80 | # This command has extra arguments and will be ignored 81 | extra_args: on 82 | 83 | # This command requires additional arguments 84 | missing_args: on 85 | 86 | # All files referenced in an ADD command should 87 | # be part of the Docker build context 88 | add_src_invalid: on 89 | 90 | # When adding multiple files, the destination should be a directory 91 | add_dest_invalid: on 92 | 93 | # Using a WORKDIR parameter that has spaces should be escaped 94 | invalid_workdir: on 95 | 96 | # The arguments to this command are invalid 97 | invalid_format: on 98 | 99 | # Use of apt-get update should be paired with 100 | # rm -rf /var/lib/apt/lists/* in the same layer 101 | apt-get_missing_rm: on 102 | 103 | # This INSTRUCTION is deprecated as of Docker 1.13 104 | deprecated_in_1.13: on 105 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at opensource@github.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html) 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq) 77 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/templates/settings.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "enterprise": { 3 | "private_mode": {{ core_private_mode }}, 4 | "public_pages": {{ core_public_pages }}, 5 | "subdomain_isolation": {{ core_subdomain_isolation }}, 6 | "signup_enabled": {{ core_signup_enabled }}, 7 | "identicons_host": "dotcom", 8 | "http_proxy": {{ core_http_proxy }}, 9 | "http_noproxy": {{ core_http_noproxy }}, 10 | "auth_mode": "default", 11 | "builtin_auth_fallback": {{ core_builtin_auth_fallback }}, 12 | "expire_sessions": {{ core_expire_sessions }}, 13 | "avatar": null 14 | }, 15 | "cas": { 16 | "url": {{ cas_url }} 17 | }, 18 | "saml": { 19 | "sso_url": {{ saml_sso_url }}, 20 | "certificate": {{ saml_certificate }}, 21 | "certificate_path": "{{ saml_certificate_path }}", 22 | "issuer": {{ saml_issuer }}, 23 | "name_id_format": "{{ saml_name_id_format }}", 24 | "idp_initiated_sso": {{ saml_idp_initiated_sso }}, 25 | "disable_admin_demote": {{ saml_disable_admin_demote }}, 26 | "signature_method": "{{ saml_signature_method }}", 27 | "digest_method": "{{ saml_digest_method }}", 28 | "username_attribute": {{ saml_username_attribute }}, 29 | "full_name_attribute": "{{ saml_full_name_attribute }}", 30 | "emails_attribute": "{{ saml_emails_attribute }}", 31 | "ssh_keys_attribute": "{{ saml_ssh_keys_attribute }}", 32 | "gpg_keys_attribute": "{{ saml_gpg_keys_attribute }}" 33 | }, 34 | "github_oauth": null, 35 | "smtp": { 36 | "enabled": {{ smtp_enabled }}, 37 | "address": {{ smtp_address }}, 38 | "authentication": {{ smtp_authentication }}, 39 | "port": {{ smtp_port }}, 40 | "domain": {{ smtp_domain }}, 41 | "username": {{ smtp_username }}, 42 | "user_name": {{ smtp_user_name }}, 43 | "password": {{ smtp_password }}, 44 | "support_address": "{{ smtp_support_address }}", 45 | "support_address_type": "{{ smtp_support_address_type }}", 46 | "noreply_address": "{{ smtp_noreply_address }}", 47 | "discard_to_noreply_address": {{ smtp_discard_to_noreply_address }} 48 | }, 49 | "ntp": { 50 | "primary_server": "{{ ntp_primary_server }}", 51 | "secondary_server": "{{ ntp_secondary_server }}" 52 | }, 53 | "timezone": null, 54 | "snmp": { 55 | "enabled": {{ snmp_enabled }}, 56 | "version": {{ snmp_version }}, 57 | "community": "{{ snmp_community }}", 58 | "users": [ 59 | 60 | ] 61 | }, 62 | "syslog": { 63 | "enabled": {{ syslog_enabled }}, 64 | "server": "{{ syslog_server }}", 65 | "protocol_name": "{{ syslog_protocol_name }}", 66 | "tls_enabled": {{ syslog_tls_enabled }}, 67 | "cert": {{ syslog_cert }} 68 | }, 69 | "assets": null, 70 | "pages": { 71 | "enabled": {{ pages_enabled }} 72 | }, 73 | "collectd": { 74 | "enabled": {{ collectd_enabled }}, 75 | "server": "{{ collectd_server }}", 76 | "port": {{ collectd_port }}, 77 | "encryption": {{ collectd_encryption }}, 78 | "username": {{ collectd_username }}, 79 | "password": {{ collectd_password }} 80 | }, 81 | "mapping": { 82 | "enabled": {{ mapping_enabled }}, 83 | "tileserver": {{ mapping_tileserver }}, 84 | "token": {{ mapping_token }} 85 | }, 86 | "load_balancer": { 87 | "http_forward": {{ loadbalancer_http_forward }}, 88 | "proxy_protocol": {{ loadbalancer_proxy_protocol }} 89 | }, 90 | "abuse_rate_limiting": { 91 | "enabled": {{ abuse_rate_limiting_enabled }}, 92 | "requests_per_minute": {{ abuse_rate_limiting_requests_per_minute }}, 93 | "cpu_millis_per_minute": {{ abuse_rate_limiting_cpu_millis_per_minute }}, 94 | "search_cpu_millis_per_minute": {{ abuse_rate_limiting_search_cpu_millis_per_minute }} 95 | }, 96 | "api_rate_limiting": { 97 | "enabled": {{ api_rate_limiting_enabled }}, 98 | "unauthenticated_rate_limit": {{ api_rate_limiting_unauthenticated_rate_limit }}, 99 | "default_rate_limit": {{ api_rate_limiting_default_rate_limit }}, 100 | "search_unauthenticated_rate_limit": {{ api_rate_limiting_search_unauthenticated_rate_limit }}, 101 | "search_default_rate_limit": {{ api_rate_limiting_search_default_rate_limit }}, 102 | "lfs_unauthenticated_rate_limit": {{ api_rate_limiting_lfs_unauthenticated_rate_limit }}, 103 | "lfs_default_rate_limit": {{ api_rate_limiting_lfs_default_rate_limit }}, 104 | "graphql_unauthenticated_rate_limit": {{ api_rate_limiting_graphql_unauthenticated_rate_limit }}, 105 | "graphql_default_rate_limit": {{ api_rate_limiting_graphql_default_rate_limit }} 106 | }, 107 | "governor": { 108 | "quotas_enabled": {{ governor_quotas_enabled }}, 109 | "limit_user": {{ governor_limit_user }}, 110 | "limit_network": {{ governor_limit_network }} 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ########################################## 3 | ########################################## 4 | ## Standard Variables for GHE Configure ## 5 | ########################################## 6 | ########################################## 7 | ## These variables will be the defaults. If you want to override them, 8 | ## then change them in 'vars/main.yml' instead of here 9 | github_admin_password: U53r1234 10 | github_initial_user_password: U53r1234 11 | github_host: github.service 12 | github_admin_port: 8443 13 | 14 | ##################### 15 | # Default Rate Vars # 16 | ##################### 17 | api_rate_limiting_enabled: "true" 18 | api_rate_limiting_unauthenticated_rate_limit: "60" 19 | api_rate_limiting_default_rate_limit: "5000" 20 | api_rate_limiting_search_unauthenticated_rate_limit: "10" 21 | api_rate_limiting_search_default_rate_limit: "30" 22 | api_rate_limiting_lfs_unauthenticated_rate_limit: "100" 23 | api_rate_limiting_lfs_default_rate_limit: "3000" 24 | api_rate_limiting_graphql_unauthenticated_rate_limit: "0" 25 | api_rate_limiting_graphql_default_rate_limit: "5000" 26 | 27 | ###################### 28 | # Default Abuse Vars # 29 | ###################### 30 | abuse_rate_limiting_enabled: "true" 31 | abuse_rate_limiting_requests_per_minute: "900" 32 | abuse_rate_limiting_cpu_millis_per_minute: "90000" 33 | abuse_rate_limiting_search_cpu_millis_per_minute: "7500" 34 | 35 | #################### 36 | # Default Cas Vars # 37 | #################### 38 | cas_url: "null" 39 | 40 | ######################### 41 | # Default Collectd Vars # 42 | ######################### 43 | collectd_enabled: "true" 44 | collectd_server: "metrics.service" 45 | collectd_port: "25826" 46 | collectd_encryption: "null" 47 | collectd_username: "null" 48 | collectd_password: "null" 49 | 50 | ##################### 51 | # Default Core Vars # 52 | ##################### 53 | core_private_mode: "true" 54 | core_public_pages: "false" 55 | core_subdomain_isolation: "false" 56 | core_signup_enabled: "false" 57 | core_github_hostname: "null" 58 | core_http_proxy: "null" 59 | core_http_noproxy: "null" 60 | core_builtin_auth_fallback: "false" 61 | core_expire_sessions: "false" 62 | core_package_version: "null" 63 | 64 | ####################### 65 | # Default GitHub Vars # 66 | ####################### 67 | github_ssl_enabled: "true" 68 | github_ssl_tls_mode: "tlsv12" 69 | github_ssl_cert: "null" 70 | github_ssl_key: "null" 71 | 72 | ######################### 73 | # Default Governor Vars # 74 | ######################### 75 | governor_quotas_enabled: "false" 76 | governor_limit_user: "null" 77 | governor_limit_network: "null" 78 | 79 | ##################### 80 | # Default LDAP Vars # 81 | ##################### 82 | ldap_host: "null" 83 | ldap_port: "389" 84 | ldap_method: "None" 85 | ldap_base_dn: "dc=demo,dc=github,dc=local" 86 | ldap_bind_dn: "cn=admin,dc=demo,dc=github,dc=local" 87 | ldap_password: "U53r1234" 88 | ldap_user_groups: "null" 89 | ldap_admin_group: "Autobots" 90 | ldap_user_sync_emails: "true" 91 | ldap_user_sync_keys: "false" 92 | ldap_user_sync_gpg_keys: "false" 93 | ldap_user_sync_interval: "1" 94 | ldap_team_sync_interval: "1" 95 | ldap_sync_enabled: "true" 96 | ldap_profile_uid: "uid" 97 | ldap_profile_name: "displayName" 98 | ldap_profile_mail: "mail" 99 | ldap_profile_key: "null" 100 | ldap_profile_gpg_key: "null" 101 | 102 | ############################# 103 | # Default Loadbalancer Vars # 104 | ############################# 105 | loadbalancer_http_forward: "false" 106 | loadbalancer_proxy_protocol: "false" 107 | 108 | ######################## 109 | # Default Mapping Vars # 110 | ######################## 111 | mapping_enabled: "false" 112 | mapping_tileserver: "null" 113 | mapping_basemap: "null" 114 | mapping_token: "null" 115 | 116 | #################### 117 | # Default NTP Vars # 118 | #################### 119 | ntp_primary_server: "0.ubuntu.pool.ntp.org" 120 | ntp_secondary_server: "1.ubuntu.pool.ntp.org" 121 | 122 | ########################## 123 | # Default GHE Pages Vars # 124 | ########################## 125 | pages_enabled: "true" 126 | 127 | ##################### 128 | # Default SAML Vars # 129 | ##################### 130 | saml_sso_url: "null" 131 | saml_certificate: "null" 132 | saml_certificate_path: "/data/user/common/idp.crt" 133 | saml_issuer: "null" 134 | saml_name_id_format: "persistent" 135 | saml_idp_initiated_sso: "false" 136 | saml_disable_admin_demote: "false" 137 | saml_signature_method: "rsa-sha256" 138 | saml_digest_method: "sha256" 139 | saml_username_attribute: "null" 140 | saml_full_name_attribute: "full_name" 141 | saml_emails_attribute: "emails" 142 | saml_ssh_keys_attribute: "public_keys" 143 | saml_gpg_keys_attribute: "gpg_keys" 144 | 145 | ##################### 146 | # Default SMTP Vars # 147 | ##################### 148 | smtp_enabled: "false" 149 | smtp_address: "null" 150 | smtp_authentication: "null" 151 | smtp_port: "0" 152 | smtp_domain: "null" 153 | smtp_username: "null" 154 | smtp_user_name: "null" 155 | smtp_password: "null" 156 | smtp_support_address: it.broke@github.com 157 | smtp_support_address_type: email 158 | smtp_noreply_address: "noreply@test.github.local" 159 | smtp_discard_to_noreply_address: "false" 160 | 161 | ##################### 162 | # Default SNMP Vars # 163 | ##################### 164 | snmp_enabled: "true" 165 | snmp_version: "2" 166 | snmp_community: "public" 167 | snmp_users: "null" 168 | 169 | ####################### 170 | # Default Syslog Vars # 171 | ####################### 172 | syslog_enabled: "false" 173 | syslog_server: "null" 174 | syslog_protocol_name: "udp" 175 | syslog_tls_enabled: "false" 176 | syslog_cert: "null" 177 | 178 | ####################### 179 | # Default Splunk Vars # 180 | ####################### 181 | splunk_host: splunk.service 182 | splunk_port: 9997 183 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ########################################### 2 | ########################################### 3 | ## Dockerfile to run GitHub Super-Linter ## 4 | ########################################### 5 | ########################################### 6 | 7 | ################## 8 | # Get base image # 9 | ################## 10 | FROM python:alpine 11 | 12 | ######################################### 13 | # Label the instance and set maintainer # 14 | ######################################### 15 | LABEL com.github.actions.name="GitHub Super-Linter" \ 16 | com.github.actions.description="Lint your code base with GitHub Actions" \ 17 | com.github.actions.icon="code" \ 18 | com.github.actions.color="red" \ 19 | maintainer="GitHub DevOps " 20 | 21 | #################### 22 | # Run APK installs # 23 | #################### 24 | RUN apk add --no-cache \ 25 | bash git git-lfs musl-dev curl gcc jq file\ 26 | npm nodejs \ 27 | libxml2-utils perl \ 28 | ruby ruby-dev ruby-bundler ruby-rdoc make \ 29 | py3-setuptools ansible-lint \ 30 | go 31 | 32 | ##################### 33 | # Run Pip3 Installs # 34 | ##################### 35 | RUN pip3 --no-cache-dir install --upgrade --no-cache-dir \ 36 | yamllint pylint yq 37 | 38 | #################### 39 | # Run NPM Installs # 40 | #################### 41 | RUN npm config set package-lock false \ 42 | && npm config set loglevel error \ 43 | && npm -g --no-cache install \ 44 | markdownlint-cli \ 45 | jsonlint prettyjson \ 46 | @coffeelint/cli \ 47 | typescript eslint \ 48 | standard \ 49 | babel-eslint \ 50 | @typescript-eslint/eslint-plugin \ 51 | @typescript-eslint/parser \ 52 | eslint-plugin-jest \ 53 | stylelint \ 54 | stylelint-config-standard \ 55 | && npm --no-cache install \ 56 | markdownlint-cli \ 57 | jsonlint prettyjson \ 58 | @coffeelint/cli \ 59 | typescript eslint \ 60 | standard \ 61 | babel-eslint \ 62 | prettier \ 63 | eslint-config-prettier \ 64 | @typescript-eslint/eslint-plugin \ 65 | @typescript-eslint/parser \ 66 | eslint-plugin-jest \ 67 | stylelint \ 68 | stylelint-config-standard 69 | 70 | #################################### 71 | # Install dockerfilelint from repo # 72 | #################################### 73 | RUN git clone https://github.com/replicatedhq/dockerfilelint.git && cd /dockerfilelint && npm install 74 | 75 | # I think we could fix this with path but not sure the language... 76 | # https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md 77 | 78 | #################### 79 | # Run GEM installs # 80 | #################### 81 | RUN gem install rubocop:0.74.0 rubocop-rails rubocop-github:0.13.0 82 | 83 | # Need to fix the version as it installs 'rubocop:0.85.1' as a dep, and forces the default 84 | # We then need to promot the correct verion, uninstall, and fix deps 85 | RUN sh -c 'gem install --default rubocop:0.74.0; yes | gem uninstall rubocop:0.85.1 -a -x -I; gem install rubocop:0.74.0' 86 | 87 | ###################### 88 | # Install shellcheck # 89 | ###################### 90 | RUN wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv \ 91 | && mv "shellcheck-stable/shellcheck" /usr/bin/ 92 | 93 | ##################### 94 | # Install Go Linter # 95 | ##################### 96 | ARG GO_VERSION='v1.27.0' 97 | RUN wget -O- -nvq https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GO_VERSION" 98 | 99 | ################## 100 | # Install TFLint # 101 | ################## 102 | RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint.zip && unzip tflint.zip && rm tflint.zip \ 103 | && mv "tflint" /usr/bin/ 104 | 105 | ################## 106 | # Install dotenv-linter # 107 | ################## 108 | RUN wget "https://github.com/dotenv-linter/dotenv-linter/releases/latest/download/dotenv-linter-alpine-x86_64.tar.gz" -O - -q | tar -xzf - \ 109 | && mv "dotenv-linter" /usr/bin 110 | 111 | ########################################### 112 | # Load GitHub Env Vars for GitHub Actions # 113 | ########################################### 114 | ENV GITHUB_SHA=${GITHUB_SHA} \ 115 | GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH} \ 116 | GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \ 117 | DEFAULT_BRANCH=${DEFAULT_BRANCH} \ 118 | VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \ 119 | VALIDATE_YAML=${VALIDATE_YAML} \ 120 | VALIDATE_JSON=${VALIDATE_JSON} \ 121 | VALIDATE_XML=${VALIDATE_XML} \ 122 | VALIDATE_MD=${VALIDATE_MD} \ 123 | VALIDATE_BASH=${VALIDATE_BASH} \ 124 | VALIDATE_PERL=${VALIDATE_PERL} \ 125 | VALIDATE_PYTHON=${VALIDATE_PYTHON} \ 126 | VALIDATE_RUBY=${VALIDATE_RUBY} \ 127 | VALIDATE_COFFEE=${VALIDATE_COFFEE} \ 128 | VALIDATE_ANSIBLE=${VALIDATE_ANSIBLE} \ 129 | VALIDATE_DOCKER=${VALIDATE_DOCKER} \ 130 | VALIDATE_JAVASCRIPT_ES=${VALIDATE_JAVASCRIPT_ES} \ 131 | VALIDATE_JAVASCRIPT_STANDARD=${VALIDATE_JAVASCRIPT_STANDARD} \ 132 | VALIDATE_TYPESCRIPT_ES=${VALIDATE_TYPESCRIPT_ES} \ 133 | VALIDATE_TYPESCRIPT_STANDARD=${VALIDATE_TYPESCRIPT_STANDARD} \ 134 | VALIDATE_GO=${VALIDATE_GO} \ 135 | VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ 136 | VALIDATE_CSS=${VALIDATE_CSS} \ 137 | VALIDATE_ENV=${VALIDATE_ENV} \ 138 | ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ 139 | RUN_LOCAL=${RUN_LOCAL} \ 140 | TEST_CASE_RUN=${TEST_CASE_RUN} \ 141 | ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \ 142 | DISABLE_ERRORS=${DISABLE_ERRORS} 143 | 144 | ############################# 145 | # Copy scripts to container # 146 | ############################# 147 | COPY lib /action/lib 148 | 149 | ################################## 150 | # Copy linter rules to container # 151 | ################################## 152 | COPY TEMPLATES /action/lib/.automation 153 | 154 | ###################### 155 | # Set the entrypoint # 156 | ###################### 157 | ENTRYPOINT ["/action/lib/linter.sh"] 158 | -------------------------------------------------------------------------------- /.automation/test/javascript/javascript_good_1.js: -------------------------------------------------------------------------------- 1 | var http = require('http') 2 | var createHandler = require('github-webhook-handler') 3 | var handler = createHandler({ path: '/webhook', secret: (process.env.SECRET) }) 4 | 5 | var userArray = ['user1'] 6 | 7 | var teamDescription = 'Team of Robots' 8 | var teamPrivacy = 'closed' // closed (visibile) / secret (hidden) are options here 9 | 10 | var teamName = process.env.GHES_TEAM_NAME 11 | var teamAccess = 'pull' // pull,push,admin options here 12 | var teamId = '' 13 | 14 | var orgRepos = [] 15 | 16 | // var creator = "" 17 | 18 | http.createServer(function (req, res) { 19 | handler(req, res, function (err) { 20 | console.log(err) 21 | res.statusCode = 404 22 | res.end('no such location') 23 | }) 24 | }).listen(3000) 25 | 26 | handler.on('error', function (err) { 27 | console.error('Error:', err.message) 28 | }) 29 | 30 | handler.on('repository', function (event) { 31 | if (event.payload.action === 'created') { 32 | const repo = event.payload.repository.full_name 33 | console.log(repo) 34 | const org = event.payload.repository.owner.login 35 | getTeamID(org) 36 | setTimeout(checkTeamIDVariable, 1000) 37 | } 38 | }) 39 | 40 | handler.on('team', function (event) { 41 | // TODO user events such as being removed from team or org 42 | if (event.payload.action === 'deleted') { 43 | // const name = event.payload.team.name 44 | const org = event.payload.organization.login 45 | getRepositories(org) 46 | setTimeout(checkReposVariable, 5000) 47 | } else if (event.payload.action === 'removed_from_repository') { 48 | const org = event.payload.organization.login 49 | getTeamID(org) 50 | // const repo = event.payload.repository.full_name 51 | setTimeout(checkTeamIDVariable, 1000) 52 | } 53 | }) 54 | 55 | function getTeamID (org) { 56 | const https = require('https') 57 | 58 | const options = { 59 | hostname: (process.env.GHE_HOST), 60 | port: 443, 61 | path: '/api/v3/orgs/' + org + '/teams', 62 | method: 'GET', 63 | headers: { 64 | Authorization: 'token ' + (process.env.GHE_TOKEN), 65 | 'Content-Type': 'application/json' 66 | } 67 | } 68 | let body = [] 69 | const req = https.request(options, (res) => { 70 | res.on('data', (chunk) => { 71 | body.push(chunk) 72 | }).on('end', () => { 73 | body = JSON.parse(Buffer.concat(body)) 74 | body.forEach(item => { 75 | if (item.name === teamName) { 76 | teamId = item.id 77 | } 78 | }) 79 | }) 80 | }) 81 | 82 | req.on('error', (error) => { 83 | console.error(error) 84 | }) 85 | 86 | req.end() 87 | } 88 | 89 | function checkTeamIDVariable (repo) { 90 | if (typeof teamId !== 'undefined') { 91 | addTeamToRepo(repo, teamId) 92 | } 93 | } 94 | 95 | function checkReposVariable (org) { 96 | if (typeof orgRepos !== 'undefined') { 97 | // for(var repo of orgRepos) { 98 | // addTeamToRepo(repo, teamId) 99 | // } 100 | reCreateTeam(org) 101 | } 102 | } 103 | 104 | function addTeamToRepo (repo, teamId) { 105 | const https = require('https') 106 | const data = JSON.stringify({ 107 | permission: teamAccess 108 | }) 109 | 110 | const options = { 111 | hostname: (process.env.GHE_HOST), 112 | port: 443, 113 | path: '/api/v3/teams/' + teamId + '/repos/' + repo, 114 | method: 'PUT', 115 | headers: { 116 | Authorization: 'token ' + (process.env.GHE_TOKEN), 117 | 'Content-Type': 'application/json', 118 | 'Content-Length': data.length 119 | } 120 | } 121 | let body = [] 122 | const req = https.request(options, (res) => { 123 | res.on('data', (chunk) => { 124 | body.push(chunk) 125 | }).on('end', () => { 126 | body = Buffer.concat(body).toString() 127 | console.log(res.statusCode) 128 | console.log('added team to ' + repo) 129 | }) 130 | }) 131 | 132 | req.on('error', (error) => { 133 | console.error(error) 134 | }) 135 | 136 | req.write(data) 137 | req.end() 138 | } 139 | 140 | function reCreateTeam (org) { 141 | const https = require('https') 142 | const data = JSON.stringify({ 143 | name: teamName, 144 | description: teamDescription, 145 | privacy: teamPrivacy, 146 | maintainers: userArray, 147 | repo_names: orgRepos 148 | }) 149 | 150 | const options = { 151 | hostname: (process.env.GHE_HOST), 152 | port: 443, 153 | path: '/api/v3/orgs/' + org + '/teams', 154 | method: 'POST', 155 | headers: { 156 | Authorization: 'token ' + (process.env.GHE_TOKEN), 157 | 'Content-Type': 'application/json', 158 | 'Content-Length': data.length 159 | } 160 | } 161 | // const body = [] 162 | const req = https.request(options, (res) => { 163 | if (res.statusCode !== 201) { 164 | console.log('Status code: ' + res.statusCode) 165 | console.log('Added ' + teamName + ' to ' + org + ' Failed') 166 | res.on('data', function (chunk) { 167 | console.log('BODY: ' + chunk) 168 | }) 169 | } else { 170 | console.log('Added ' + teamName + ' to ' + org) 171 | } 172 | }) 173 | 174 | req.on('error', (error) => { 175 | console.error(error) 176 | }) 177 | 178 | req.write(data) 179 | req.end() 180 | } 181 | 182 | function getRepositories (org) { 183 | orgRepos = [] 184 | 185 | const https = require('https') 186 | 187 | const options = { 188 | hostname: (process.env.GHE_HOST), 189 | port: 443, 190 | path: '/api/v3/orgs/' + org + '/repos', 191 | method: 'GET', 192 | headers: { 193 | Authorization: 'token ' + (process.env.GHE_TOKEN), 194 | 'Content-Type': 'application/json' 195 | } 196 | } 197 | let body = [] 198 | const req = https.request(options, (res) => { 199 | res.on('data', (chunk) => { 200 | body.push(chunk) 201 | }).on('end', () => { 202 | body = JSON.parse(Buffer.concat(body)) 203 | body.forEach(item => { 204 | orgRepos.push(item.full_name) 205 | console.log(item.full_name) 206 | }) 207 | }) 208 | }) 209 | 210 | req.on('error', (error) => { 211 | console.error(error) 212 | }) 213 | 214 | req.end() 215 | } 216 | -------------------------------------------------------------------------------- /.automation/test/python/python_bad_1.py: -------------------------------------------------------------------------------- 1 | import json 2 | from os import getenv, path 3 | from pprint import pprint 4 | import sys 5 | 6 | import click # pylint: disable=import-error 7 | from dotenv import load_dotenv # pylint: disable=import-error 8 | import requests # pylint: disable=import-error 9 | 10 | env = load_dotenv() 11 | api_url = getenv(API_URL, default='https://api.github.com/graphql' ) 12 | github_token = getenv("GITHUB_TOKEN", 13 | default=None) 14 | 15 | if github_token is None 16 | sys.exit("GitHub Token is not set." + 17 | "Please set the GITHUB_TOKEN env variable in your system or " + 18 | "the .env file of your project.") 19 | 20 | client_id = getenv(CLIENT_ID, default='copy_labels.py') 21 | headers = { 22 | 'Authorization': 'bearer {github_token}'.format(github_token=github_token), 23 | 'Accept': 'application/vnd.github.bane-preview+json' 24 | 'Content-Type': 'application/json' 25 | } 26 | 27 | def create_label(repo_id, label): 28 | """ 29 | Create label in the supplied repo. 30 | 31 | :param repo_id: Unique ID that represents the repo in GitHub 32 | :type repo_id: str 33 | :param label: Object with label information. 34 | :type label: dict 35 | :return: GitHub API request response 36 | """ 37 | 38 | query_variables = { 39 | "createLabelInput": { 40 | "color": label["color"], 41 | "description": label["description"], 42 | "name": label["name"], 43 | "repositoryId": repo_id 44 | } 45 | } 46 | 47 | with open(path.join(path.dirname(__file__), 'queries/create_label.gql'), 'r') as query_file: 48 | query = "".join(query_file.readlines()) 49 | 50 | payload = {"query": query, "variables": query_variables} 51 | response = requests.post(api_url, data=json.dumps(payload), headers=headers).json() 52 | print('Created label {label}'.format(label=label["name"])) 53 | 54 | return response 55 | 56 | def get_labels(owner, repo): 57 | """ 58 | Gets a list of labels from the supplied repo. 59 | :param owner: Repo owner GitHub login. 60 | :type owner: str 61 | :param repo: Repository name. 62 | :type repo: str 63 | :return: A tuple with the GitHub id for the repository and a list of labels defined in the repository 64 | """ 65 | 66 | query_variables = { "owner": owner, "name": repo, } 67 | 68 | with open(path.join(path.dirname(__file__), 'queries/get_repo_data.gql'), 'r') as query_file: 69 | query = "".join(query_file.readlines()) 70 | 71 | payload = {"query": query, "variables": query_variables} 72 | response = requests.post(api_url, data=json.dumps(payload), headers=headers) 73 | 74 | status_code = response.status_code 75 | result = response.json() 76 | 77 | if status_code >= 200 and status_code <= 300: 78 | repo_id = result["data"]["repository"]["id"] 79 | labels = result["data"]["repository"]["labels"]["nodes"] 80 | 81 | return repo_id, labels 82 | else: 83 | raise Exception( 84 | '[ERROR] getting issue labels. Status Code: {status_code} - Message: {result}'.format( 85 | status_code=status_code, result=result["message"])) 86 | 87 | def delete_label(label_id): 88 | """ 89 | Delete the specified label 90 | :param label_id: Label's node id. 91 | :type label_id: str 92 | :return: GitHub API request response. 93 | """ 94 | 95 | query_variables = { 96 | "deleteLabelInput": { 97 | "clientMutationId": client_id, 98 | "id": label_id, 99 | } 100 | } 101 | 102 | with open(path.join(path.dirname(__file__), 'queries/delete_label.gql'), 'r') as query_file: 103 | query = "".join(query_file.readlines()) 104 | 105 | payload = {"query": query, "variables": query_variables} 106 | result = requests.post(api_url, data=json.dumps(payload), headers=headers).json() 107 | 108 | return result 109 | 110 | @click.command() 111 | @click.option('--dry', is_flag=True) 112 | @click.argument('source_repo') 113 | @click.argument('target_repo') 114 | def copy_labels(source_repo, target_repo, dry): 115 | """ 116 | Copy labels from the source repository to the target repository. 117 | \f 118 | :param source: The full name of a GitHub repo from where the labels will be copied from. Eg. github/opensourcefriday 119 | :type source: str 120 | :param target: The full name of a GitHub repo to where the labels will be copied. Eg. github/opensourcefriday 121 | :type target: str 122 | :return: 123 | """ 124 | source_owner, source_repo_name = source_repo.split("/") 125 | target_owner, target_repo_name = target_repo.split("/") 126 | 127 | try: 128 | print('Fetching labels for {source_repo_name} repo.'.format(source_repo_name=source_repo_name)) 129 | _, source_repo_labels = get_labels(source_owner, source_repo_name) 130 | print('Fetched labels for {source_repo_name}'.format(source_repo_name=source_repo_name)) 131 | 132 | print('Fetching labels for {target_repo_name} repo.'.format(target_repo_name=target_repo_name)) 133 | target_repo_id, target_repo_labels = get_labels(target_owner, target_repo_name) 134 | print('Fetched labels for {target_repo_name}'.format(target_repo_name=target_repo_name)) 135 | 136 | filtered_labels = list(filter(lambda x: x not in target_repo_labels, source_repo_labels)) 137 | 138 | if dry: 139 | print('This is just a dry run. No labels will be copied/created.') 140 | print('{label_count} labels would have been created.'.format(label_count=len(filtered_labels))) 141 | pprint(filtered_labels, indent=4) 142 | else: 143 | print('Preparing to created {label_count} labels in {target_repo}'.format( 144 | label_count=len(filtered_labels), target_repo=target_repo)) 145 | 146 | for label in filtered_labels: 147 | create_label(target_repo_id, label) 148 | except Exception as error: 149 | sys.exit(error) 150 | 151 | print('Done') 152 | 153 | if __name__ == "__main__": 154 | # Pylint doesn't know that @click.command takes care of injecting the 155 | # function parameters. Disabling Pylint error. 156 | copy_labels() # pylint: disable=no-value-for-parameter 157 | -------------------------------------------------------------------------------- /.automation/test/python/python_good_1.py: -------------------------------------------------------------------------------- 1 | import json 2 | from os import getenv, path 3 | from pprint import pprint 4 | import sys 5 | 6 | import click # pylint: disable=import-error 7 | from dotenv import load_dotenv # pylint: disable=import-error 8 | import requests # pylint: disable=import-error 9 | 10 | env = load_dotenv() 11 | api_url = getenv('API_URL', default='https://api.github.com/graphql') 12 | github_token = getenv("GITHUB_TOKEN", default=None) 13 | 14 | if github_token is None: 15 | sys.exit("GitHub Token is not set." + 16 | "Please set the GITHUB_TOKEN env variable in your system or " + 17 | "the .env file of your project.") 18 | 19 | client_id = getenv('CLIENT_ID', default='copy_labels.py') 20 | headers = { 21 | 'Authorization': 'bearer {github_token}'.format(github_token=github_token), 22 | 'Accept': 'application/vnd.github.bane-preview+json', 23 | 'Content-Type': 'application/json' 24 | } 25 | 26 | def create_label(repo_id, label): 27 | """ 28 | Create label in the supplied repo. 29 | 30 | :param repo_id: Unique ID that represents the repo in GitHub 31 | :type repo_id: str 32 | :param label: Object with label information. 33 | :type label: dict 34 | :return: GitHub API request response 35 | """ 36 | 37 | query_variables = { 38 | "createLabelInput": { 39 | "color": label["color"], 40 | "description": label["description"], 41 | "name": label["name"], 42 | "repositoryId": repo_id 43 | } 44 | } 45 | 46 | with open(path.join(path.dirname(__file__), 'queries/create_label.gql'), 'r') as query_file: 47 | query = "".join(query_file.readlines()) 48 | 49 | payload = {"query": query, "variables": query_variables} 50 | response = requests.post(api_url, data=json.dumps(payload), headers=headers).json() 51 | print('Created label {label}'.format(label=label["name"])) 52 | 53 | return response 54 | 55 | def get_labels(owner, repo): 56 | """ 57 | Gets a list of labels from the supplied repo. 58 | :param owner: Repo owner GitHub login. 59 | :type owner: str 60 | :param repo: Repository name. 61 | :type repo: str 62 | :return: A tuple with the GitHub id for the repository and a list of labels defined in the repository 63 | """ 64 | 65 | query_variables = { "owner": owner, "name": repo, } 66 | 67 | with open(path.join(path.dirname(__file__), 'queries/get_repo_data.gql'), 'r') as query_file: 68 | query = "".join(query_file.readlines()) 69 | 70 | payload = {"query": query, "variables": query_variables} 71 | response = requests.post(api_url, data=json.dumps(payload), headers=headers) 72 | 73 | status_code = response.status_code 74 | result = response.json() 75 | 76 | if status_code >= 200 and status_code <= 300: 77 | repo_id = result["data"]["repository"]["id"] 78 | labels = result["data"]["repository"]["labels"]["nodes"] 79 | 80 | return repo_id, labels 81 | else: 82 | raise Exception( 83 | '[ERROR] getting issue labels. Status Code: {status_code} - Message: {result}'.format( 84 | status_code=status_code, result=result["message"])) 85 | 86 | def delete_label(label_id): 87 | """ 88 | Delete the specified label 89 | :param label_id: Label's node id. 90 | :type label_id: str 91 | :return: GitHub API request response. 92 | """ 93 | 94 | query_variables = { 95 | "deleteLabelInput": { 96 | "clientMutationId": client_id, 97 | "id": label_id, 98 | } 99 | } 100 | 101 | with open(path.join(path.dirname(__file__), 'queries/delete_label.gql'), 'r') as query_file: 102 | query = "".join(query_file.readlines()) 103 | 104 | payload = {"query": query, "variables": query_variables} 105 | result = requests.post(api_url, data=json.dumps(payload), headers=headers).json() 106 | 107 | return result 108 | 109 | @click.command() 110 | @click.option('--dry', is_flag=True) 111 | @click.argument('source_repo') 112 | @click.argument('target_repo') 113 | def copy_labels(source_repo, target_repo, dry): 114 | """ 115 | Copy labels from the source repository to the target repository. 116 | \f 117 | :param source: The full name of a GitHub repo from where the labels will be copied from. Eg. github/opensourcefriday 118 | :type source: str 119 | :param target: The full name of a GitHub repo to where the labels will be copied. Eg. github/opensourcefriday 120 | :type target: str 121 | :return: 122 | """ 123 | source_owner, source_repo_name = source_repo.split("/") 124 | target_owner, target_repo_name = target_repo.split("/") 125 | 126 | try: 127 | print('Fetching labels for {source_repo_name} repo.'.format(source_repo_name=source_repo_name)) 128 | _, source_repo_labels = get_labels(source_owner, source_repo_name) 129 | print('Fetched labels for {source_repo_name}'.format(source_repo_name=source_repo_name)) 130 | 131 | print('Fetching labels for {target_repo_name} repo.'.format(target_repo_name=target_repo_name)) 132 | target_repo_id, target_repo_labels = get_labels(target_owner, target_repo_name) 133 | print('Fetched labels for {target_repo_name}'.format(target_repo_name=target_repo_name)) 134 | 135 | filtered_labels = list(filter(lambda x: x not in target_repo_labels, source_repo_labels)) 136 | 137 | if dry: 138 | print('This is just a dry run. No labels will be copied/created.') 139 | print('{label_count} labels would have been created.'.format(label_count=len(filtered_labels))) 140 | pprint(filtered_labels, indent=4) 141 | else: 142 | print('Preparing to created {label_count} labels in {target_repo}'.format( 143 | label_count=len(filtered_labels), target_repo=target_repo)) 144 | 145 | for label in filtered_labels: 146 | create_label(target_repo_id, label) 147 | except Exception as error: 148 | sys.exit(error) 149 | 150 | print('Done') 151 | 152 | if __name__ == "__main__": 153 | # Pylint doesn't know that @click.command takes care of injecting the 154 | # function parameters. Disabling Pylint error. 155 | copy_labels() # pylint: disable=no-value-for-parameter 156 | -------------------------------------------------------------------------------- /.automation/test/javascript/javascript_bad_1.js: -------------------------------------------------------------------------------- 1 | var http = require('http') 2 | var createHandler = require( 'github-webhook-handler') 3 | 4 | var handler = createHandler( { path : /webhook, secret : (process.env.SECRET) }) 5 | 6 | var userArray = [ 'user1' ] 7 | here is some garbage = that 8 | 9 | var teamDescription = Team of Robots 10 | var teamPrivacy = 'closed' // closed (visibile) / secret (hidden) are options here 11 | 12 | var teamName = process.env.GHES_TEAM_NAME 13 | var teamAccess = 'pull' // pull,push,admin options here 14 | var teamId = '' 15 | 16 | var orgRepos = [] 17 | 18 | // var creator = "" 19 | 20 | var foo = someFunction(); 21 | var bar = a + 1; 22 | 23 | http.createServer(function (req, res) { 24 | handler(req, res, function (err) { 25 | console.log(err) 26 | res.statusCode = 404 27 | res.end('no such location') 28 | }) 29 | }).listen(3000) 30 | 31 | handler.on('error', function (err) { 32 | console.await.error('Error:', err.message) 33 | }) 34 | 35 | handler.on('repository', function (event) { 36 | if (event.payload.action === 'created') { 37 | const repo = event.payload.repository.full_name 38 | console.log(repo) 39 | const org = event.payload.repository.owner.login 40 | getTeamID(org) 41 | setTimeout(checkTeamIDVariable, 1000) 42 | } 43 | }) 44 | 45 | handler.on('team', function (event) { 46 | // TODO user events such as being removed from team or org 47 | if (event.payload.action === 'deleted') { 48 | // const name = event.payload.team.name 49 | const org = event.payload.organization.login 50 | getRepositories(org) 51 | setTimeout(checkReposVariable, 5000) 52 | } else if (event.payload.action === 'removed_from_repository') { 53 | const org = event.payload.organization.login 54 | getTeamID(org) 55 | // const repo = event.payload.repository.full_name 56 | setTimeout(checkTeamIDVariable, 1000) 57 | } 58 | }) 59 | 60 | function getTeamID (org) { 61 | const https = require('https') 62 | 63 | const options = { 64 | hostname: (process.env.GHE_HOST), 65 | port: 443 66 | path: '/api/v3/orgs/' + org + '/teams', 67 | method: 'GET', 68 | headers: { 69 | Authorization: 'token ' + (process.env.GHE_TOKEN), 70 | 'Content-Type': 'application/json' 71 | } 72 | } 73 | let body = [] 74 | const req = https.request(options, (res) => { 75 | res.on('data', (chunk) => { 76 | body.push(chunk) 77 | }).on('end', () => { 78 | body = JSON.parse(Buffer.concat(body)) 79 | body.forEach(item => { 80 | if (item.name === teamName) { 81 | teamId = item.id 82 | } 83 | }) 84 | }) 85 | }) 86 | 87 | req.on('error, (error) => { 88 | console.error(error) 89 | }) 90 | 91 | req.end() 92 | } 93 | 94 | function checkTeamIDVariable (repo) { 95 | if (typeof teamId != 'undefined') { 96 | addTeamToRepo(repo, teamId) 97 | } 98 | } 99 | 100 | function checkReposVariable (org) { 101 | if (typeof orgRepos !== 'undefined') { 102 | // for(var repo of orgRepos) { 103 | // addTeamToRepo(repo, teamId) 104 | // } 105 | reCreateTeam(org) 106 | } 107 | } 108 | 109 | function addTeamToRepo (repo, teamId) { 110 | const https = require('https') 111 | const data = JSON.stringify({ 112 | permission: teamAccess 113 | }) 114 | 115 | const options = { 116 | hostname: (process.env.GHE_HOST), 117 | port: 443, 118 | path: '/api/v3/teams/' + teamId + '/repos/' + repo, 119 | method: 'PUT', 120 | headers: { 121 | Authorization: 'token ' + (process.env.GHE_TOKEN), 122 | 'Content-Type': 'application/json', 123 | 'Content-Length': data.length 124 | } 125 | } 126 | let body = [] 127 | 128 | const req = https.request(options, (res) => { 129 | res.on('data', (chunk) => { 130 | 131 | body.push(chunk) 132 | 133 | }).on('end', () => { 134 | 135 | body = Buffer.concat(body).toString() 136 | console.log(res.statusCode) 137 | console.log('added team to ' + repo) 138 | }) 139 | }) 140 | 141 | req.on('error', (error) => { 142 | console.error(error) 143 | }) 144 | 145 | req.write(data) 146 | req.end() 147 | } 148 | 149 | function reCreateTeam (org) { 150 | const https = require('https') 151 | const data = JSON.stringify({ 152 | name: teamName, 153 | description: teamDescription, 154 | privacy: teamPrivacy 155 | maintainers: userArray, 156 | repo_names: orgRepos 157 | }) 158 | 159 | const options = { 160 | hostname: (process.env.GHE_HOST), 161 | port: 443 162 | path: '/api/v3/orgs/' + org + '/teams', 163 | method: 'POST', 164 | headers: { 165 | Authorization: 'token ' + (process.env.GHE_TOKEN), 166 | 'Content-Type': 'application/json', 167 | 'Content-Length': data.length 168 | } 169 | } 170 | // const body = [] 171 | const req = https.request(options, (res) => { 172 | if (res.statusCode !== 201) { 173 | console.log('Status code: ' + res.statusCode) 174 | console.log('Added ' + teamName + ' to ' + org + ' Failed') 175 | res.on('data', function (chunk) { 176 | console.log('BODY: ' + chunk) 177 | }) 178 | } else { 179 | console.log('Added ' + teamName ' to ' + org) 180 | } 181 | }) 182 | 183 | req.on('error', (error) => { 184 | console.error(error) 185 | }) 186 | 187 | req.write(data) 188 | req.end() 189 | } 190 | 191 | function getRepositories (org) { 192 | orgRepos = [] 193 | 194 | const https = require('https') 195 | 196 | const options = { 197 | hostname: (process.env.GHE_HOST), 198 | port: '443', 199 | path: '/api/v3/orgs/' + org + "/repos", 200 | method: 'GET', 201 | headers: { 202 | Authorization: 'token ' + (process.env.GHE_TOKEN), 203 | 'Content-Type': 'application/json' 204 | } 205 | } 206 | let body = [] 207 | const req = https.request(options, (res) => { 208 | res.on('data', (chunk) => { 209 | body.push(chunk) 210 | 211 | }).on('end', () => { 212 | body = JSON.parse(Buffer.concat(body)) 213 | body.forEach(item => { 214 | orgRepos.push(item.full_name) 215 | 216 | console.log(item.full_name) 217 | }) 218 | }) 219 | }) 220 | 221 | req.on('error', (error) => { 222 | console.error(error) 223 | }) 224 | req.end() 225 | } 226 | -------------------------------------------------------------------------------- /.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to run ghe-config-apply on the primary GHES instance 5 | # and wait for any previous runs to complete 6 | ################################################################################ 7 | 8 | ########### 9 | # Globals # 10 | ########### 11 | GHE_CONFIG_PID='/var/run/ghe-config.pid' # PID file when a config is running 12 | GHE_APPLY_COMMAND='ghe-config-apply' # Command running when a config run 13 | SLEEP_SECONDS=20 # Seconds to sleep before next check 14 | PID_CHECK_LIMIT=15 # How many times to check the pid before moving on 15 | PID_CHECK=0 # Count of times to check the pid 16 | PROCESS_CHECK_LIMIT=15 # How many times to check the process before moving on 17 | PROCESS_CHECK=0 # Count of times to check the process 18 | 19 | ################################################################################ 20 | ########################### SUB ROUTINES BELOW ################################# 21 | ################################################################################ 22 | ################################################################################ 23 | #### Function CheckGHEPid ###################################################### 24 | CheckGHEPid() 25 | { 26 | ################################## 27 | # Check to prevent infinite loop # 28 | ################################## 29 | if [ $PID_CHECK -gt $PID_CHECK_LIMIT ]; then 30 | # Over the limit, move on 31 | echo "We have checked the pid $PID_CHECK times, moving on..." 32 | else 33 | ################################################ 34 | # Check to see if the PID is alive and running # 35 | ################################################ 36 | if [ ! -f "$GHE_CONFIG_PID" ]; then 37 | # File not found 38 | echo "Were good to move forward, no .pid file found at:[$GHE_CONFIG_PID]" 39 | else 40 | # Found the pid running, need to sleep 41 | echo "Current PID found, sleeping $SLEEP_SECONDS seconds before next check..." 42 | ################ 43 | # Sleep it off # 44 | ################ 45 | SLEEP_CMD=$(sleep $SLEEP_SECONDS 2>&1) 46 | 47 | ####################### 48 | # Load the error code # 49 | ####################### 50 | ERROR_CODE=$? 51 | 52 | ############################## 53 | # Check the shell for errors # 54 | ############################## 55 | if [ $ERROR_CODE -ne 0 ]; then 56 | echo "ERROR! Failed to sleep!" 57 | echo "ERROR:[$SLEEP_CMD]" 58 | echo "Will try to call apply as last effort..." 59 | #################################### 60 | # Call config apply as last effort # 61 | #################################### 62 | RunConfigApply 63 | else 64 | ##################### 65 | # Increment counter # 66 | ##################### 67 | ((PID_CHECK++)) 68 | ################################## 69 | # Try to check for the pid again # 70 | ################################## 71 | CheckGHEPid 72 | fi 73 | fi 74 | fi 75 | } 76 | ################################################################################ 77 | #### Function CheckGHEProcess ################################################## 78 | CheckGHEProcess() 79 | { 80 | ################################## 81 | # Check to prevent infinite loop # 82 | ################################## 83 | if [ $PROCESS_CHECK -gt $PROCESS_CHECK_LIMIT ]; then 84 | # Over the limit, move on 85 | echo "We have checked the process $PROCESS_CHECK times, moving on..." 86 | else 87 | #################################################### 88 | # Check to see if the process is alive and running # 89 | #################################################### 90 | # shellcheck disable=SC2009 91 | CHECK_PROCESS_CMD=$(ps -aef |grep "$GHE_APPLY_COMMAND" |grep -v grep 2>&1) 92 | 93 | ####################### 94 | # Load the error code # 95 | ####################### 96 | ERROR_CODE=$? 97 | 98 | ############################## 99 | # Check the shell for errors # 100 | ############################## 101 | if [ $ERROR_CODE -ne 0 ]; then 102 | # No process running on the system 103 | echo "Were good to move forward, no process like:[$GHE_APPLY_COMMAND] running currently on the system" 104 | else 105 | # Found the process running, need to sleep 106 | echo "Current process alive:[$CHECK_PROCESS_CMD], sleeping $SLEEP_SECONDS seconds before next check..." 107 | ################ 108 | # Sleep it off # 109 | ################ 110 | SLEEP_CMD=$(sleep $SLEEP_SECONDS 2>&1) 111 | 112 | ####################### 113 | # Load the error code # 114 | ####################### 115 | ERROR_CODE=$? 116 | 117 | ############################## 118 | # Check the shell for errors # 119 | ############################## 120 | if [ $ERROR_CODE -ne 0 ]; then 121 | echo "ERROR! Failed to sleep!" 122 | echo "ERROR:[$SLEEP_CMD]" 123 | echo "Will try to call apply as last effort..." 124 | #################################### 125 | # Call config apply as last effort # 126 | #################################### 127 | RunConfigApply 128 | else 129 | ##################### 130 | # Increment counter # 131 | ##################### 132 | ((PROCESS_CHECK++)) 133 | ###################################### 134 | # Try to check for the process again # 135 | ###################################### 136 | CheckGHEProcess 137 | fi 138 | fi 139 | fi 140 | } 141 | ################################################################################ 142 | #### Function RunConfigApply ################################################### 143 | RunConfigApply() 144 | { 145 | ########## 146 | # Header # 147 | ########## 148 | echo "Running $GHE_APPLY_COMMAND to the server..." 149 | 150 | ############################################## 151 | # Run the command to apply changes to server # 152 | ############################################## 153 | APPLY_CMD=$(ghe-config-apply 2>&1) 154 | 155 | ####################### 156 | # Load the error code # 157 | ####################### 158 | ERROR_CODE=$? 159 | 160 | ############################## 161 | # Check the shell for errors # 162 | ############################## 163 | if [ $ERROR_CODE -ne 0 ]; then 164 | # Errors 165 | echo "ERROR! Failed to run config apply command!" 166 | echo "ERROR:[$APPLY_CMD]" 167 | exit 1 168 | else 169 | # Success 170 | echo "Successfully ran $GHE_APPLY_COMMAND" 171 | fi 172 | } 173 | ################################################################################ 174 | ################################## MAIN ######################################## 175 | ################################################################################ 176 | 177 | ###################### 178 | # Check for pid file # 179 | ###################### 180 | CheckGHEPid 181 | 182 | ############################# 183 | # Check for running process # 184 | ############################# 185 | CheckGHEProcess 186 | 187 | #################### 188 | # Run config apply # 189 | #################### 190 | RunConfigApply 191 | 192 | ########################################## 193 | # Were going to run it again after a nap # 194 | # to make sure there is no crazy actions # 195 | ########################################## 196 | sleep 300s 197 | 198 | ###################### 199 | # Check for pid file # 200 | ###################### 201 | CheckGHEPid 202 | 203 | ############################# 204 | # Check for running process # 205 | ############################# 206 | CheckGHEProcess 207 | 208 | #################### 209 | # Run config apply # 210 | #################### 211 | RunConfigApply 212 | -------------------------------------------------------------------------------- /.automation/cleanup-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | ############# Cleanup Image on DockerHub @admiralawkbar ######################## 5 | ################################################################################ 6 | 7 | # NOTES: This script is used to remove a tagged image on DockerHub 8 | # Its based on being built from a GitHub Action, but could be easily updated 9 | # To be ran in a different medium. 10 | # 11 | # PRE-Reqs: 12 | # - Dockerfile 13 | # - System with Docker installed 14 | # - Global variables met 15 | 16 | ########### 17 | # Globals # 18 | ########### 19 | GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace 20 | DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub 21 | DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub 22 | IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image 23 | IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image 24 | DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded 25 | 26 | ################################################################################ 27 | ############################ FUNCTIONS BELOW ################################### 28 | ################################################################################ 29 | ################################################################################ 30 | #### Function Header ########################################################### 31 | Header() 32 | { 33 | echo "" 34 | echo "-------------------------------------------------------" 35 | echo "----- GitHub Actions remove image from DockerHub ------" 36 | echo "-------------------------------------------------------" 37 | echo "" 38 | } 39 | ################################################################################ 40 | #### Function ValidateInput #################################################### 41 | ValidateInput() 42 | { 43 | # Need to validate we have the basic variables 44 | ################ 45 | # Print header # 46 | ################ 47 | echo "" 48 | echo "----------------------------------------------" 49 | echo "Gathering variables..." 50 | echo "----------------------------------------------" 51 | echo "" 52 | 53 | ############################ 54 | # Validate GITHUB_WORKSPACE # 55 | ############################ 56 | if [ -z "$GITHUB_WORKSPACE" ]; then 57 | echo "ERROR! Failed to get [GITHUB_WORKSPACE]!" 58 | echo "ERROR:[$GITHUB_WORKSPACE]" 59 | exit 1 60 | else 61 | echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" 62 | fi 63 | 64 | ####################### 65 | # Validate IMAGE_REPO # 66 | ####################### 67 | if [ -z "$IMAGE_REPO" ]; then 68 | # No repo was pulled 69 | echo "ERROR! Failed to get [IMAGE_REPO]!" 70 | echo "ERROR:[$IMAGE_REPO]" 71 | exit 1 72 | elif [[ "$IMAGE_REPO" == "github/super-linter" ]]; then 73 | # Found our main repo 74 | echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" 75 | else 76 | # This is a fork and we cant pull vars or any info 77 | echo "WARN! No image to cleanup as this is a forked branch, and not being built with current automation!" 78 | exit 0 79 | fi 80 | 81 | ########################## 82 | # Validate IMAGE_VERSION # 83 | ########################## 84 | if [ -z "$IMAGE_VERSION" ]; then 85 | echo "ERROR! Failed to get [IMAGE_VERSION]!" 86 | echo "ERROR:[$IMAGE_VERSION]" 87 | exit 1 88 | else 89 | echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]" 90 | fi 91 | 92 | ############################ 93 | # Validate DOCKER_USERNAME # 94 | ############################ 95 | if [ -z "$DOCKER_USERNAME" ]; then 96 | echo "ERROR! Failed to get [DOCKER_USERNAME]!" 97 | echo "ERROR:[$DOCKER_USERNAME]" 98 | exit 1 99 | else 100 | echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]" 101 | fi 102 | 103 | ############################ 104 | # Validate DOCKER_PASSWORD # 105 | ############################ 106 | if [ -z "$DOCKER_PASSWORD" ]; then 107 | echo "ERROR! Failed to get [DOCKER_PASSWORD]!" 108 | echo "ERROR:[$DOCKER_PASSWORD]" 109 | exit 1 110 | else 111 | echo "Successfully found:[DOCKER_PASSWORD], value:[********]" 112 | fi 113 | 114 | ################################################## 115 | # Check if we need to get the name of the branch # 116 | ################################################## 117 | if [[ "$IMAGE_VERSION" != "latest" ]]; then 118 | ################################### 119 | # Remove non alpha-numberic chars # 120 | ################################### 121 | IMAGE_VERSION=$(echo "$IMAGE_VERSION" | tr -cd '[:alnum:]') 122 | else 123 | ############################################# 124 | # Image is 'latest' and we will not destroy # 125 | ############################################# 126 | echo "Image Tag is set to:[latest]..." 127 | echo "We will never destroy latest..." 128 | echo "Bye!" 129 | exit 1 130 | fi 131 | } 132 | ################################################################################ 133 | #### Function LoginToDocker #################################################### 134 | LoginToDocker() 135 | { 136 | ################ 137 | # Print header # 138 | ################ 139 | echo "" 140 | echo "----------------------------------------------" 141 | echo "Login to DockerHub..." 142 | echo "----------------------------------------------" 143 | echo "" 144 | 145 | ###################### 146 | # Login to DockerHub # 147 | ###################### 148 | LOGIN_CMD=$(docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" 2>&1) 149 | 150 | ####################### 151 | # Load the error code # 152 | ####################### 153 | ERROR_CODE=$? 154 | 155 | ############################## 156 | # Check the shell for errors # 157 | ############################## 158 | if [ $ERROR_CODE -ne 0 ]; then 159 | # ERROR 160 | echo "ERROR! Failed to authenticate to DockerHub!" 161 | echo "ERROR:[$LOGIN_CMD]" 162 | exit 1 163 | else 164 | # SUCCESS 165 | echo "Successfully authenticated to DockerHub!" 166 | fi 167 | } 168 | ################################################################################ 169 | #### Function RemoveImage ###################################################### 170 | RemoveImage() 171 | { 172 | ################ 173 | # Print header # 174 | ################ 175 | echo "" 176 | echo "----------------------------------------------" 177 | echo "Removing the DockerFile image:[$IMAGE_REPO:$IMAGE_VERSION]" 178 | echo "----------------------------------------------" 179 | echo "" 180 | 181 | ##################################### 182 | # Create Token to auth to DockerHub # 183 | ##################################### 184 | TOKEN=$(curl -s -k \ 185 | -H "Content-Type: application/json" \ 186 | -X POST \ 187 | -d "{\"username\": \"$DOCKER_USERNAME\", \"password\": \"$DOCKER_PASSWORD\"}" \ 188 | "https://hub.docker.com/v2/users/login/" | jq -r .token 2>&1) 189 | 190 | ####################### 191 | # Load the ERROR_CODE # 192 | ####################### 193 | ERROR_CODE=$? 194 | 195 | ############################## 196 | # Check the shell for errors # 197 | ############################## 198 | if [ $ERROR_CODE -ne 0 ]; then 199 | # ERROR 200 | echo "ERROR! Failed to gain token from DockerHub!" 201 | echo "ERROR:[$TOKEN]" 202 | exit 1 203 | else 204 | # SUCCESS 205 | echo "Successfully gained auth token from DockerHub!" 206 | fi 207 | 208 | ################################# 209 | # Remove the tag from DockerHub # 210 | ################################# 211 | REMOVE_CMD=$(curl "https://hub.docker.com/v2/repositories/$IMAGE_REPO/tags/$IMAGE_VERSION/" \ 212 | -X DELETE \ 213 | -H "Authorization: JWT $TOKEN" 2>&1) 214 | 215 | ####################### 216 | # Load the ERROR_CODE # 217 | ####################### 218 | ERROR_CODE=$? 219 | 220 | ############################## 221 | # Check the shell for errors # 222 | ############################## 223 | if [ $ERROR_CODE -ne 0 ]; then 224 | # ERROR 225 | echo "ERROR! Failed to remove tag from DockerHub!" 226 | echo "ERROR:[$REMOVE_CMD]" 227 | exit 1 228 | else 229 | # SUCCESS 230 | echo "Successfully [removed] Docker image tag:[$IMAGE_VERSION] from DockerHub!" 231 | fi 232 | } 233 | ################################################################################ 234 | #### Function Footer ########################################################### 235 | Footer() 236 | { 237 | echo "" 238 | echo "-------------------------------------------------------" 239 | echo "The step has completed" 240 | echo "-------------------------------------------------------" 241 | echo "" 242 | } 243 | ################################################################################ 244 | ################################## MAIN ######################################## 245 | ################################################################################ 246 | 247 | ########## 248 | # Header # 249 | ########## 250 | Header 251 | 252 | ################## 253 | # Validate Input # 254 | ################## 255 | ValidateInput 256 | 257 | ###################### 258 | # Login to DockerHub # 259 | ###################### 260 | LoginToDocker 261 | 262 | #################### 263 | # Remove the image # 264 | #################### 265 | RemoveImage 266 | 267 | ########## 268 | # Footer # 269 | ########## 270 | Footer 271 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Super-Linter 2 | This repository is for the **GitHub Action** to run a **Super-Linter**. 3 | It is a simple combination of various linters, written in `bash`, to help validate your source code. 4 | 5 | The end goal of this tool: 6 | - Prevent broken code from being uploaded to the default branch (Usually `master`) 7 | - Help establish coding best practices across multiple languages 8 | - Build guidelines for code layout and format 9 | - Automate the process to help streamline code reviews 10 | 11 | ## How it Works 12 | 13 | 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. 14 | 15 | ## Supported Linters 16 | 17 | Developers on **GitHub** can call the **GitHub Action** to lint their code base with the following list of linters: 18 | 19 | | *Language* | *Linter* | 20 | | --- | --- | 21 | | **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) | 22 | | **CSS** | [stylelint](https://stylelint.io/) | 23 | | **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) | 24 | | **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) | 25 | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | 26 | | **JavaScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | 27 | | **JSON** | [jsonlint](https://github.com/zaach/jsonlint) | 28 | | **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) | 29 | | **Perl** | [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) | 30 | | **Python3** | [pylint](https://www.pylint.org/) | 31 | | **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) | 32 | | **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) | 33 | | **Terraform** | [tflint](https://github.com/terraform-linters/tflint) | 34 | | **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | 35 | | **XML** | [LibXML](http://xmlsoft.org/) | 36 | | **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) | 37 | | **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) | 38 | 39 | ## How to use 40 | To use this **GitHub** Action you will need to complete the following: 41 | - Add the **GitHub** Action: **Super-Linter** to your current **GitHub** Actions workflow 42 | - Enjoy your more *stable*, and *cleaner* code base 43 | - Check out the [Wiki](https://github.com/github/super-linter/wiki) for customization options 44 | 45 | ### Example connecting GitHub Action Workflow 46 | In your repository you should have a `.github/workflows` folder with **GitHub** Action similar to below: 47 | 48 | - `.github/workflows/linter.yml` 49 | 50 | This file should have the following code: 51 | 52 | ```yml 53 | --- 54 | ########################### 55 | ########################### 56 | ## Linter GitHub Actions ## 57 | ########################### 58 | ########################### 59 | name: Lint Code Base 60 | 61 | # 62 | # Documentation: 63 | # https://help.github.com/en/articles/workflow-syntax-for-github-actions 64 | # 65 | 66 | ############################# 67 | # Start the job on all push # 68 | ############################# 69 | on: 70 | push: 71 | branches-ignore: 72 | - 'master' 73 | 74 | ############### 75 | # Set the Job # 76 | ############### 77 | jobs: 78 | build: 79 | # Name the Job 80 | name: Lint Code Base 81 | # Set the agent to run on 82 | runs-on: ubuntu-latest 83 | 84 | ################## 85 | # Load all steps # 86 | ################## 87 | steps: 88 | ########################## 89 | # Checkout the code base # 90 | ########################## 91 | - name: Checkout Code 92 | uses: actions/checkout@v2 93 | 94 | ################################ 95 | # Run Linter against code base # 96 | ################################ 97 | - name: Lint Code Base 98 | uses: docker://github/super-linter:v2.1.0 99 | env: 100 | VALIDATE_ALL_CODEBASE: false 101 | VALIDATE_ANSIBLE: false 102 | ... 103 | ``` 104 | 105 | **NOTE:** Using the line:`uses: docker://github/super-linter:v2.1.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.1.0` will build and compile the **GitHub Super-Linter** at build time. This can be far more costly in time... 106 | 107 | ## Environment variables 108 | The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality. 109 | 110 | *Note:* All the `VALIDATE_[LANGUAGE]` variables behave in a specific way. 111 | If none of them are passed, then they all default to true. 112 | However if any one of the variables are set, we default to leaving any unset variable to false. 113 | This means that if you run the linter "out of the box", all languages will be checked. 114 | But if you wish to select specific linters, we give you full control to choose which linters are run, 115 | and won't run anything unexpected. 116 | 117 | | **ENV VAR** | **Default Value** | **Notes** | 118 | | --- | --- | --- | 119 | | **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. | 120 | | **DEFAULT_BRANCH** | `master` | The name of the repository default branch. | 121 | | **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the language. | 122 | | **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the language. | 123 | | **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the language. | 124 | | **VALIDATE_MD** | `true` | Flag to enable or disable the linting process of the language. | 125 | | **VALIDATE_BASH** | `true` | Flag to enable or disable the linting process of the language. | 126 | | **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the language. | 127 | | **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the language. | 128 | | **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the language. | 129 | | **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . | 130 | | **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the language. | 131 | | **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | 132 | | **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | 133 | | **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | 134 | | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | 135 | | **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the language. | 136 | | **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. | 137 | | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | 138 | | **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. | 139 | | **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the language. | 140 | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | 141 | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | 142 | | **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. | 143 | | **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. | 144 | 145 | ### Template rules files 146 | You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level. 147 | - Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/` of your repository 148 | - If your repository does not have rules files, they will fall back to defaults in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES) 149 | 150 | ## Disabling rules 151 | If you need to disable certain *rules* and *functionality*, you can view [Disable Rules](https://github.com/github/super-linter/blob/master/docs/disabling-linters.md) 152 | 153 | ## Docker Hub 154 | The **Docker** container that is built from this repository is located at `https://hub.docker.com/r/github/super-linter` 155 | 156 | ## Running Super-Linter locally (troubleshooting/debugging/enhancements) 157 | 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) 158 | 159 | ### CI/CT/CD 160 | The **Super-Linter** has *CI/CT/CD* configured utilizing **GitHub** Actions. 161 | - When a branch is created and code is pushed, a **GitHub** Action is triggered for building the new **Docker** container with the new codebase 162 | - The **Docker** container is then ran against the *test cases* to validate all code sanity 163 | - `.automation/test` contains all test cases for each language that should be validated 164 | - These **GitHub** Actions utilize the Checks API and Protected Branches to help follow the SDLC 165 | - When the Pull Request is merged to master, the **Super-Linter** **Docker** container is then updated and deployed with the new codebase 166 | - **Note:** The branches **Docker** container is also removed from **DockerHub** to cleanup after itself 167 | 168 | ## Limitations 169 | Below are a list of the known limitations for the **GitHub Super-Linter**: 170 | - Due to being completely packaged at run time, you will not be able to update dependencies or change versions of the enclosed linters and binaries 171 | - Reading additional details from `package.json` are not read by the **GitHub Super-Linter** 172 | - Downloading additional codebases as dependencies from private repositories will fail due to lack of permissions 173 | 174 | ## How to contribute 175 | If you would like to help contribute to this **GitHub** Action, please see [CONTRIBUTING](https://github.com/github/super-linter/blob/master/.github/CONTRIBUTING.md) 176 | 177 | -------------------------------------------------------------------------------- 178 | 179 | ### License 180 | - [MIT License](https://github.com/github/super-linter/blob/master/LICENSE) 181 | -------------------------------------------------------------------------------- /.automation/upload-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | ############# Deploy Container to DockerHub @admiralawkbar ##################### 5 | ################################################################################ 6 | 7 | # NOTES: This script is used to upload a Dockerfile to DockerHub 8 | # under the GitHub organization 9 | # Its based on being built from a GitHub Action, but could be easily updated 10 | # To be ran in a different medium. 11 | # 12 | # PRE-Reqs: 13 | # - Dockerfile 14 | # - System with Docker installed 15 | # - Global variables met 16 | 17 | ########### 18 | # Globals # 19 | ########### 20 | GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace 21 | DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub 22 | DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub 23 | IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image 24 | IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image 25 | DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded 26 | 27 | ################################################################################ 28 | ############################ FUNCTIONS BELOW ################################### 29 | ################################################################################ 30 | ################################################################################ 31 | #### Function Header ########################################################### 32 | Header() 33 | { 34 | echo "" 35 | echo "-------------------------------------------------------" 36 | echo "------ GitHub Actions Upload image to DockerHub -------" 37 | echo "-------------------------------------------------------" 38 | echo "" 39 | } 40 | ################################################################################ 41 | #### Function ValidateInput #################################################### 42 | ValidateInput() 43 | { 44 | # Need to validate we have the basic variables 45 | ################ 46 | # Print header # 47 | ################ 48 | echo "" 49 | echo "----------------------------------------------" 50 | echo "Gathering variables..." 51 | echo "----------------------------------------------" 52 | echo "" 53 | 54 | ############################ 55 | # Validate GITHUB_WORKSPACE # 56 | ############################ 57 | if [ -z "$GITHUB_WORKSPACE" ]; then 58 | echo "ERROR! Failed to get [GITHUB_WORKSPACE]!" 59 | echo "ERROR:[$GITHUB_WORKSPACE]" 60 | exit 1 61 | else 62 | echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" 63 | fi 64 | 65 | ############################ 66 | # Validate DOCKER_USERNAME # 67 | ############################ 68 | if [ -z "$DOCKER_USERNAME" ]; then 69 | echo "ERROR! Failed to get [DOCKER_USERNAME]!" 70 | echo "ERROR:[$DOCKER_USERNAME]" 71 | exit 1 72 | else 73 | echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]" 74 | fi 75 | 76 | ############################ 77 | # Validate DOCKER_PASSWORD # 78 | ############################ 79 | if [ -z "$DOCKER_PASSWORD" ]; then 80 | echo "ERROR! Failed to get [DOCKER_PASSWORD]!" 81 | echo "ERROR:[$DOCKER_PASSWORD]" 82 | exit 1 83 | else 84 | echo "Successfully found:[DOCKER_PASSWORD], value:[********]" 85 | fi 86 | 87 | ####################### 88 | # Validate IMAGE_REPO # 89 | ####################### 90 | if [ -z "$IMAGE_REPO" ]; then 91 | echo "ERROR! Failed to get [IMAGE_REPO]!" 92 | echo "ERROR:[$IMAGE_REPO]" 93 | exit 1 94 | else 95 | echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" 96 | fi 97 | 98 | ########################## 99 | # Validate IMAGE_VERSION # 100 | ########################## 101 | if [ -z "$IMAGE_VERSION" ]; then 102 | echo "WARN! Failed to get [IMAGE_VERSION]!" 103 | echo "Pulling from Branch Name..." 104 | ############################## 105 | # Get the name of the branch # 106 | ############################## 107 | BRANCH_NAME=$(git branch --contains "$GITHUB_SHA" |awk '{print $2}' 2>&1) 108 | 109 | ####################### 110 | # Load the error code # 111 | ####################### 112 | ERROR_CODE=$? 113 | 114 | ############################## 115 | # Check the shell for errors # 116 | ############################## 117 | if [ $ERROR_CODE -ne 0 ]; then 118 | echo "ERROR! Failed to get branch name!" 119 | echo "ERROR:[$BRANCH_NAME]" 120 | exit 1 121 | fi 122 | 123 | ################################### 124 | # Remove non alpha-numberic chars # 125 | ################################### 126 | BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cd '[:alnum:]') 127 | 128 | ############################################ 129 | # Set the IMAGE_VERSION to the BRANCH_NAME # 130 | ############################################ 131 | IMAGE_VERSION="$BRANCH_NAME" 132 | echo "Tag:[$IMAGE_VERSION]" 133 | else 134 | echo "Successfully found:[IMAGE_VERSION], value:[$IMAGE_VERSION]" 135 | fi 136 | 137 | ############################ 138 | # Validate DOCKERFILE_PATH # 139 | ############################ 140 | if [ -z "$DOCKERFILE_PATH" ]; then 141 | echo "ERROR! Failed to get [DOCKERFILE_PATH]!" 142 | echo "ERROR:[$DOCKERFILE_PATH]" 143 | exit 1 144 | else 145 | echo "Successfully found:[DOCKERFILE_PATH], value:[$DOCKERFILE_PATH]" 146 | fi 147 | } 148 | ################################################################################ 149 | #### Function LoginToDocker #################################################### 150 | LoginToDocker() 151 | { 152 | ################ 153 | # Print header # 154 | ################ 155 | echo "" 156 | echo "----------------------------------------------" 157 | echo "Login to DockerHub..." 158 | echo "----------------------------------------------" 159 | echo "" 160 | 161 | ###################### 162 | # Login to DockerHub # 163 | ###################### 164 | LOGIN_CMD=$(docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" 2>&1) 165 | 166 | ####################### 167 | # Load the error code # 168 | ####################### 169 | ERROR_CODE=$? 170 | 171 | ############################## 172 | # Check the shell for errors # 173 | ############################## 174 | if [ $ERROR_CODE -ne 0 ]; then 175 | # ERROR 176 | echo "ERROR! Failed to authenticate to DockerHub!" 177 | echo "ERROR:[$LOGIN_CMD]" 178 | exit 1 179 | else 180 | # SUCCESS 181 | echo "Successfully authenticated to DockerHub!" 182 | fi 183 | } 184 | ################################################################################ 185 | #### Function BuildImage ####################################################### 186 | BuildImage() 187 | { 188 | ################ 189 | # Print header # 190 | ################ 191 | echo "" 192 | echo "----------------------------------------------" 193 | echo "Building the DockerFile image..." 194 | echo "----------------------------------------------" 195 | echo "" 196 | 197 | 198 | ################################ 199 | # Validate the DOCKERFILE_PATH # 200 | ################################ 201 | if [ ! -f "$DOCKERFILE_PATH" ]; then 202 | # No file found 203 | echo "ERROR! failed to find Dockerfile at:[$DOCKERFILE_PATH]" 204 | echo "Please make sure you give full path!" 205 | echo "Example:[/configs/Dockerfile] or [Dockerfile] if at root directory" 206 | exit 1 207 | fi 208 | 209 | ################### 210 | # Build the image # 211 | ################### 212 | docker build --no-cache -t "$IMAGE_REPO:$IMAGE_VERSION" -f "$DOCKERFILE_PATH" . 2>&1 213 | 214 | ####################### 215 | # Load the error code # 216 | ####################### 217 | ERROR_CODE=$? 218 | 219 | ############################## 220 | # Check the shell for errors # 221 | ############################## 222 | if [ $ERROR_CODE -ne 0 ]; then 223 | # ERROR 224 | echo "ERROR! failed to [build] Dockerfile!" 225 | exit 1 226 | else 227 | # SUCCESS 228 | echo "Successfully Built image!" 229 | echo "Info:[$BUILD_CMD]" 230 | fi 231 | } 232 | ################################################################################ 233 | #### Function UploadImage ###################################################### 234 | UploadImage() 235 | { 236 | ################ 237 | # Print header # 238 | ################ 239 | echo "" 240 | echo "----------------------------------------------" 241 | echo "Uploading the DockerFile image..." 242 | echo "----------------------------------------------" 243 | echo "" 244 | 245 | ############################################ 246 | # Upload the docker image that was created # 247 | ############################################ 248 | docker push "$IMAGE_REPO:$IMAGE_VERSION" 2>&1 249 | 250 | ####################### 251 | # Load the error code # 252 | ####################### 253 | ERROR_CODE=$? 254 | 255 | ############################## 256 | # Check the shell for errors # 257 | ############################## 258 | if [ $ERROR_CODE -ne 0 ]; then 259 | # ERROR 260 | echo "ERROR! failed to [upload] Dockerfile!" 261 | exit 1 262 | else 263 | # SUCCESS 264 | echo "Successfully Uploaded Docker image to DockerHub!" 265 | fi 266 | 267 | ######################### 268 | # Get Image information # 269 | ######################### 270 | IFS=$'\n' # Set the delimit to newline 271 | GET_INFO_CMD=$(docker images | grep "$IMAGE_REPO" | grep "$IMAGE_VERSION" 2>&1) 272 | 273 | ####################### 274 | # Load the error code # 275 | ####################### 276 | ERROR_CODE=$? 277 | 278 | ############################## 279 | # Check the shell for errors # 280 | ############################## 281 | if [ $ERROR_CODE -ne 0 ]; then 282 | # ERROR 283 | echo "ERROR! Failed to get information about built Image!" 284 | echo "ERROR:[$GET_INFO_CMD]" 285 | exit 1 286 | else 287 | ################ 288 | # Get the data # 289 | ################ 290 | REPO=$(echo "$GET_INFO_CMD" | awk '{print $1}') 291 | TAG=$(echo "$GET_INFO_CMD" | awk '{print $2}') 292 | IMAGE_ID=$(echo "$GET_INFO_CMD" | awk '{print $3}') 293 | # shellcheck disable=SC2116 294 | SIZE=$(echo "${GET_INFO_CMD##* }") 295 | 296 | ################### 297 | # Print the goods # 298 | ################### 299 | echo "----------------------------------------------" 300 | echo "Docker Image Details:" 301 | echo "Repository:[$REPO]" 302 | echo "Tag:[$TAG]" 303 | echo "Image_ID:[$IMAGE_ID]" 304 | echo "Size:[$SIZE]" 305 | echo "----------------------------------------------" 306 | fi 307 | } 308 | ################################################################################ 309 | #### Function Footer ########################################################### 310 | Footer() 311 | { 312 | echo "" 313 | echo "-------------------------------------------------------" 314 | echo "The step has completed" 315 | echo "-------------------------------------------------------" 316 | echo "" 317 | } 318 | ################################################################################ 319 | ################################## MAIN ######################################## 320 | ################################################################################ 321 | 322 | ########## 323 | # Header # 324 | ########## 325 | Header 326 | 327 | ################## 328 | # Validate Input # 329 | ################## 330 | ValidateInput 331 | 332 | ###################### 333 | # Login to DockerHub # 334 | ###################### 335 | LoginToDocker 336 | 337 | ################### 338 | # Build the image # 339 | ################### 340 | BuildImage 341 | 342 | #################### 343 | # Upload the image # 344 | #################### 345 | UploadImage 346 | 347 | ########## 348 | # Footer # 349 | ########## 350 | Footer 351 | -------------------------------------------------------------------------------- /docs/disabling-linters.md: -------------------------------------------------------------------------------- 1 | # Disabling linters and Rules 2 | If you find you need to ignore certain **errors** and **warnings**, you will need to know the *format* to disable the **Super-Linter** rules. 3 | Below is examples and documentation for each language and the various methods to disable. 4 | 5 | ## Table of Linters 6 | - [Ruby](#ruby) 7 | - [Shell](#shell) 8 | - [Ansible](#ansible) 9 | - [YAML](#yaml) 10 | - [Python](#python3) 11 | - [JSON](#json) 12 | - [Markdown](#markdown) 13 | - [Perl](#perl) 14 | - [XML](#xml) 15 | - [Coffeescript](#coffeescript) 16 | - [Javascript Eslint](#javascript-eslint) 17 | - [Javascript Standard](#javascript-standard) 18 | - [Typescript Eslint](#typescript-eslint) 19 | - [Typescript Standard](#typescript-standard) 20 | - [Golang](#golang) 21 | - [Dockerfile](#dockerfile) 22 | - [Terraform](#terraform) 23 | - [CSS](#stylelint) 24 | - [ENV](#dotenv-linter) 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- 29 | 30 | ## Ruby 31 | - [RuboCop](https://github.com/rubocop-hq/rubocop) 32 | 33 | ### RuboCop Config file 34 | - `.github/linters/.ruby-lint.yml` 35 | - You can pass multiple rules and overwrite default rules 36 | - File should be located at: `.github/linters/.ruby-lint.yml` 37 | - **Note:** We use the Default **GitHub** Rule set from [RuboCop-GitHub](https://github.com/github/rubocop-github) 38 | 39 | ### RuboCop disable single line 40 | ```ruby 41 | method(argument) # rubocop:disable SomeRule, SomeOtherRule 42 | ``` 43 | 44 | ### RuboCop disable code block 45 | ```ruby 46 | # rubocop:disable 47 | This is a long line 48 | var="this is some other stuff" 49 | # rubocop:enable 50 | ``` 51 | 52 | ### RuboCop disable entire file 53 | If you need to ignore an entire file, you can update the `.github/linters/.ruby-lint.yml` to ignore certain files and locations 54 | 55 | ```yml 56 | inherit_from: 57 | - .rubocop_todo.yml 58 | - .rubocop_app_overrides.yml 59 | 60 | inherit_mode: 61 | merge: 62 | - Exclude 63 | 64 | Rails: 65 | Enabled: true 66 | 67 | AllCops: 68 | TargetRubyVersion: 2.5.1 69 | EnabledByDefault: true 70 | Exclude: 71 | - 'db/**/*' 72 | - 'config/**/*' 73 | - 'script/**/*' 74 | - 'bin/{rails,rake}' 75 | - !ruby/regexp /old_and_unused\.rb$/ 76 | ``` 77 | 78 | -------------------------------------------------------------------------------- 79 | 80 | ## Shell 81 | - [Shellcheck](https://github.com/koalaman/shellcheck) 82 | 83 | ### Shellcheck Config file 84 | - There is no top level *configuration file* available at this time 85 | 86 | ### Shellcheck disable single line 87 | ```bash 88 | echo "Terrible stuff" # shellcheck disable=SC2059,SC2086 89 | ``` 90 | 91 | ### Shellcheck disable code block 92 | ```bash 93 | # shellcheck disable=SC2059,SC2086 94 | echo "some hot garbage" 95 | echo "More garbage code" 96 | ``` 97 | 98 | ### Shellcheck disable entire file 99 | - **Note:** The disable must be on the second line of the code right after the shebang 100 | ```bash 101 | #!/bin/sh 102 | # shellcheck disable=SC2059,SC1084 103 | 104 | echo "stuff" 105 | moreThings() 106 | ``` 107 | 108 | -------------------------------------------------------------------------------- 109 | 110 | ## Ansible 111 | - [ansible-lint](https://github.com/ansible/ansible-lint) 112 | 113 | ### Ansible-lint Config file 114 | - `.github/linters/.ansible-lint.yml` 115 | - You can pass multiple rules and overwrite default rules 116 | - File should be located at: `.github/linters/.ansible-lint.yml` 117 | 118 | ### Ansible-lint disable single line 119 | ```yml 120 | - name: this would typically fire GitHasVersionRule 401 and BecomeUserWithoutBecomeRule 501 121 | become_user: alice # noqa 401 501 122 | git: src=/path/to/git/repo dest=checkout 123 | ``` 124 | ### Ansible-lint disable code block 125 | ```yml 126 | - name: this would typically fire GitHasVersionRule 401 127 | git: src=/path/to/git/repo dest=checkout 128 | tags: 129 | - skip_ansible_lint 130 | ``` 131 | 132 | ### Ansible-lint disable entire file 133 | ```yml 134 | - name: this would typically fire GitHasVersionRule 401 135 | git: src=/path/to/git/repo dest=checkout 136 | tags: 137 | - skip_ansible_lint 138 | ``` 139 | -------------------------------------------------------------------------------- 140 | 141 | ## YAML 142 | - [YamlLint](https://github.com/adrienverge/yamllint) 143 | 144 | ### Yamllint Config file 145 | - `.github/linters/.yaml-lint.yml` 146 | - You can pass multiple rules and overwrite default rules 147 | - File should be located at: `.github/linters/.yaml-lint.yml` 148 | 149 | ### Yamllint disable single line 150 | ```yml 151 | This line is waaaaaaaaaay too long # yamllint disable-line 152 | ``` 153 | 154 | ### Yamllint disable code block 155 | ```yml 156 | # yamllint disable rule:colons 157 | - Lorem : ipsum 158 | dolor : sit amet, 159 | consectetur : adipiscing elit 160 | # yamllint enable 161 | ``` 162 | 163 | ### Yamllint disable entire file 164 | If you need to ignore an entire file, you can update the `.github/linters/.yaml-lint.yml` to ignore certain files and locations 165 | ```yml 166 | # For all rules 167 | ignore: | 168 | *.dont-lint-me.yaml 169 | /bin/ 170 | !/bin/*.lint-me-anyway.yaml 171 | 172 | rules: 173 | key-duplicates: 174 | ignore: | 175 | generated 176 | *.template.yaml 177 | trailing-spaces: 178 | ignore: | 179 | *.ignore-trailing-spaces.yaml 180 | /ascii-art/* 181 | ``` 182 | 183 | -------------------------------------------------------------------------------- 184 | 185 | ## Python3 186 | - [pylint](https://www.pylint.org/) 187 | 188 | ### Pylint Config file 189 | - `.github/linters/.python-lint` 190 | - You can pass multiple rules and overwrite default rules 191 | - File should be located at: `.github/linters/.python-lint` 192 | 193 | ### Pylint disable single line 194 | ```python 195 | global VAR # pylint: disable=global-statement 196 | ``` 197 | 198 | ### Pylint disable code block 199 | ```python 200 | """pylint option block-disable""" 201 | 202 | __revision__ = None 203 | 204 | class Foo(object): 205 | """block-disable test""" 206 | 207 | def __init__(self): 208 | pass 209 | 210 | def meth1(self, arg): 211 | """this issues a message""" 212 | print(self) 213 | 214 | def meth2(self, arg): 215 | """and this one not""" 216 | # pylint: disable=unused-argument 217 | print(self\ 218 | + "foo") 219 | 220 | def meth3(self): 221 | """test one line disabling""" 222 | # no error 223 | print(self.bla) # pylint: disable=no-member 224 | # error 225 | print(self.blop) 226 | ``` 227 | 228 | ### Pylint disable entire file 229 | ```python 230 | #!/bin/python3 231 | # pylint: skip-file 232 | 233 | var = "terrible code down here..." 234 | ``` 235 | 236 | -------------------------------------------------------------------------------- 237 | 238 | ## JSON 239 | - [jsonlint](https://github.com/zaach/jsonlint) 240 | 241 | ### JsonLint Config file 242 | - There is no top level *configuration file* available at this time 243 | 244 | ### JsonLint disable single line 245 | - There is currently **No** way to disable rules inline of the file(s) 246 | 247 | ### JsonLint disable code block 248 | - There is currently **No** way to disable rules inline of the file(s) 249 | 250 | ### JsonLint disable entire file 251 | - There is currently **No** way to disable rules inline of the file(s) 252 | 253 | -------------------------------------------------------------------------------- 254 | 255 | ## Markdown 256 | - [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli#readme) 257 | - [markdownlint rule documentation](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md) 258 | - [markdownlint inline comment syntax](https://github.com/DavidAnson/markdownlint#configuration) 259 | 260 | ### markdownlint Config file 261 | - `.github/linters/.markdown-lint.yml` 262 | - You can pass multiple rules and overwrite default rules 263 | - File should be located at: `.github/linters/.markdownlint.yml` 264 | 265 | ### markdownlint disable single line 266 | ```markdown 267 | ## Here is some document 268 | Here is some random data 269 | 270 | any violation you want 271 | 272 | Here is more data 273 | ``` 274 | ### markdownlint disable code block 275 | ```markdown 276 | ## Here is some document 277 | Here is some random data 278 | 279 | any violations you want 280 | 281 | Here is more data 282 | ``` 283 | 284 | ### markdownlint disable entire file 285 | - You can encapsulate the entire file with the *code block format* to disable an entire file from being parsed 286 | 287 | -------------------------------------------------------------------------------- 288 | 289 | ## Perl 290 | - [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) 291 | 292 | ### Perl Config file 293 | - There is no top level *configuration file* available at this time 294 | 295 | ### Perl disable single line 296 | - There is currently **No** way to disable rules inline of the file(s) 297 | 298 | ### Perl disable code block 299 | - There is currently **No** way to disable rules inline of the file(s) 300 | 301 | ### Perl disable entire file 302 | - There is currently **No** way to disable rules inline of the file(s) 303 | 304 | -------------------------------------------------------------------------------- 305 | 306 | ## XML 307 | - [XML](http://xmlsoft.org/) 308 | 309 | ### LibXML Config file 310 | - There is no top level *configuration file* available at this time 311 | 312 | ### LibXML disable single line 313 | - There is currently **No** way to disable rules inline of the file(s) 314 | 315 | ### LibXML disable code block 316 | - There is currently **No** way to disable rules inline of the file(s) 317 | 318 | ### LibXML disable entire file 319 | - There is currently **No** way to disable rules inline of the file(s) 320 | 321 | -------------------------------------------------------------------------------- 322 | 323 | ## Coffeescript 324 | - [coffeelint](https://coffeelint.github.io/) 325 | 326 | ### coffeelint Config file 327 | - `.github/linters/.coffee-lint.yml` 328 | - You can pass multiple rules and overwrite default rules 329 | - File should be located at: `.github/linters/.coffee.yml` 330 | 331 | ### coffeelint disable single line 332 | ```Coffeescript 333 | # coffeelint: disable=max_line_length 334 | foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" 335 | # coffeelint: enable=max_line_length 336 | ``` 337 | 338 | ### coffeelint disable code block 339 | ```Coffeescript 340 | # coffeelint: disable 341 | foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" 342 | bar = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" 343 | baz = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" 344 | taz = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width" 345 | # coffeelint: enable 346 | ``` 347 | 348 | ### coffeelint disable entire file 349 | - You can encapsulate the entire file with the *code block format* to disable an entire file from being parsed 350 | 351 | -------------------------------------------------------------------------------- 352 | 353 | ## Javascript eslint 354 | - [eslint](https://eslint.org/) 355 | 356 | ### Javascript eslint Config file 357 | - `.github/linters/.eslintrc.yml` 358 | - You can pass multiple rules and overwrite default rules 359 | - File should be located at: `.github/linters/.eslintrc.yml` 360 | 361 | ### Javascript eslint disable single line 362 | ```javascript 363 | var thing = new Thing(); // eslint-disable-line no-use-before-define 364 | thing.sayHello(); 365 | 366 | function Thing() { 367 | 368 | this.sayHello = function() { console.log("hello"); }; 369 | 370 | } 371 | ``` 372 | 373 | ### Javascript eslint disable code block 374 | ```javascript 375 | /*eslint-disable */ 376 | 377 | //suppress all warnings between comments 378 | alert('foo') 379 | 380 | /*eslint-enable */ 381 | ``` 382 | ### Javascript eslint disable entire file 383 | - Place at the top of the file: 384 | ```javascript 385 | /* eslint-disable */ 386 | ``` 387 | 388 | -------------------------------------------------------------------------------- 389 | 390 | ## Javascript standard 391 | - [standard js](https://standardjs.com/) 392 | 393 | ### Javascript standard Config file 394 | - There is no top level *configuration file* available at this time 395 | 396 | ### Javascript standard disable single line 397 | - There is currently **No** way to disable rules inline of the file(s) 398 | 399 | ### Javascript standard disable code block 400 | - There is currently **No** way to disable rules inline of the file(s) 401 | 402 | ### Javascript standard disable entire file 403 | - There is currently **No** way to disable rules inline of the file(s) 404 | 405 | -------------------------------------------------------------------------------- 406 | 407 | ## Typescript eslint 408 | - [eslint](https://eslint.org/) 409 | 410 | ### Typescript eslint Config file 411 | - `.github/linters/.eslintrc.yml` 412 | - You can pass multiple rules and overwrite default rules 413 | - File should be located at: `.github/linters/.eslintrc.yml` 414 | 415 | ### Typescript eslint disable single line 416 | ```typescript 417 | var thing = new Thing(); // eslint-disable-line no-use-before-define 418 | thing.sayHello(); 419 | 420 | function Thing() { 421 | 422 | this.sayHello = function() { console.log("hello"); }; 423 | 424 | } 425 | ``` 426 | 427 | ### Typescript eslint disable code block 428 | ```typescript 429 | /*eslint-disable */ 430 | 431 | //suppress all warnings between comments 432 | alert('foo') 433 | 434 | /*eslint-enable */ 435 | ``` 436 | ### Typescript eslint disable entire file 437 | ```typescript 438 | /* eslint-disable */ 439 | ``` 440 | 441 | -------------------------------------------------------------------------------- 442 | 443 | ## Typescript standard 444 | - [standardjs](https://standardjs.com/) 445 | 446 | ### Typescript standard Config file 447 | - There is no top level *configuration file* available at this time 448 | 449 | ### Typescript standard disable single line 450 | - There is currently **No** way to disable rules inline of the file(s) 451 | 452 | ### Typescript standard disable code block 453 | - There is currently **No** way to disable rules inline of the file(s) 454 | 455 | ### Typescript standard disable entire file 456 | - There is currently **No** way to disable rules inline of the file(s) 457 | 458 | -------------------------------------------------------------------------------- 459 | 460 | ## Golang 461 | - [golangci-lint](https://github.com/golangci/golangci-lint) 462 | 463 | ### golangci-lint standard Config file 464 | - `.github/linters/.golangci.yml` 465 | - You can pass multiple rules and overwrite default rules 466 | - File should be located at: `.github/linters/.golangci.yml` 467 | 468 | ### golangci-lint disable single line 469 | - There is currently **No** way to disable rules inline of the file(s) 470 | 471 | ### golangci-lint disable code block 472 | - There is currently **No** way to disable rules inline of the file(s) 473 | 474 | ### golangci-lint disable entire file 475 | - There is currently **No** way to disable rules inline of the file(s) 476 | 477 | -------------------------------------------------------------------------------- 478 | 479 | ## Dockerfile 480 | -[dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) 481 | 482 | ### Dockerfilelint standard Config file 483 | - `.github/linters/.dockerfilelintrc` 484 | - You can pass multiple rules and overwrite default rules 485 | - File should be located at: `.github/linters/.dockerfilelintrc` 486 | 487 | ### Dockerfilelint disable single line 488 | - There is currently **No** way to disable rules inline of the file(s) 489 | 490 | ### Dockerfilelint disable code block 491 | - There is currently **No** way to disable rules inline of the file(s) 492 | 493 | ### Dockerfilelint disable entire file 494 | - There is currently **No** way to disable rules inline of the file(s) 495 | 496 | -------------------------------------------------------------------------------- 497 | 498 | ## Terraform 499 | - [tflint](https://github.com/terraform-linters/tflint) 500 | 501 | ### tflint standard Config file 502 | - `.github/linters/.tflint.hcl` 503 | - You can pass multiple rules and overwrite default rules 504 | - File should be located at: `.github/linters/.tflint.hcl` 505 | 506 | ### tflint disable single line 507 | - There is currently **No** way to disable rules inline of the file(s) 508 | 509 | ### tflint disable code block 510 | - There is currently **No** way to disable rules inline of the file(s) 511 | 512 | ### tflint disable entire file 513 | - There is currently **No** way to disable rules inline of the file(s) 514 | 515 | -------------------------------------------------------------------------------- 516 | 517 | ## CSS 518 | - [stylelint](https://stylelint.io/) 519 | 520 | ### stylelint standard Config file 521 | - `.github/linters/.stylelintrc.json` 522 | 523 | ### stylelint disable single line 524 | ```css 525 | #id { 526 | /* stylelint-disable-next-line declaration-no-important */ 527 | color: pink !important; 528 | } 529 | ``` 530 | 531 | ### stylelint disable code block 532 | ```css 533 | /* stylelint-disable */ 534 | a {} 535 | /* stylelint-enable */ 536 | ``` 537 | 538 | ### stylelint disable entire file 539 | - You can disable entire files with the `ignoreFiles` property in `.stylelintrc.json` 540 | ```json 541 | { 542 | "ignoreFiles": [ 543 | "styles/ignored/wildcards/*.css", 544 | "styles/ignored/specific-file.css" 545 | ] 546 | } 547 | ``` 548 | 549 | -------------------------------------------------------------------------------- 550 | 551 | ## ENV 552 | - [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) 553 | 554 | ### dotenv-linter Config file 555 | - There is no top level *configuration file* available at this time 556 | 557 | ### dotenv-linter disable single line 558 | ```env 559 | # Comment line will be ignored 560 | ``` 561 | 562 | ### dotenv-linter disable code block 563 | - There is currently **No** way to disable rules inline of the file(s) 564 | 565 | ### dotenv-linter disable entire file 566 | - There is currently **No** way to disable rules inline of the file(s) 567 | -------------------------------------------------------------------------------- /TEMPLATES/.python-lint: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | # A comma-separated list of package or module names from where C extensions may 4 | # be loaded. Extensions are loading into the active Python interpreter and may 5 | # run arbitrary code 6 | extension-pkg-whitelist= 7 | 8 | # Add files or directories to the blacklist. They should be base names, not 9 | # paths. 10 | ignore=CVS 11 | 12 | # Add files or directories matching the regex patterns to the blacklist. The 13 | # regex matches against base names, not paths. 14 | ignore-patterns= 15 | 16 | # Python code to execute, usually for sys.path manipulation such as 17 | # pygtk.require(). 18 | #init-hook= 19 | 20 | # Use multiple processes to speed up Pylint. 21 | jobs=1 22 | 23 | # List of plugins (as comma separated values of python modules names) to load, 24 | # usually to register additional checkers. 25 | load-plugins= 26 | 27 | # Pickle collected data for later comparisons. 28 | persistent=yes 29 | 30 | # Specify a configuration file. 31 | #rcfile= 32 | 33 | # When enabled, pylint would attempt to guess common misconfiguration and emit 34 | # user-friendly hints instead of false-positive error messages 35 | suggestion-mode=yes 36 | 37 | # Allow loading of arbitrary C extensions. Extensions are imported into the 38 | # active Python interpreter and may run arbitrary code. 39 | unsafe-load-any-extension=no 40 | 41 | 42 | [MESSAGES CONTROL] 43 | 44 | # Only show warnings with the listed confidence levels. Leave empty to show 45 | # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED 46 | confidence= 47 | 48 | # Disable the message, report, category or checker with the given id(s). You 49 | # can either give multiple identifiers separated by comma (,) or put this 50 | # option multiple times (only on the command line, not in the configuration 51 | # file where it should appear only once).You can also use "--disable=all" to 52 | # disable everything first and then reenable specific checks. For example, if 53 | # you want to run only the similarities checker, you can use "--disable=all 54 | # --enable=similarities". If you want to run only the classes checker, but have 55 | # no Warning level messages displayed, use"--disable=all --enable=classes 56 | # --disable=W" 57 | disable=print-statement, 58 | parameter-unpacking, 59 | unpacking-in-except, 60 | old-raise-syntax, 61 | backtick, 62 | long-suffix, 63 | old-ne-operator, 64 | old-octal-literal, 65 | import-star-module-level, 66 | non-ascii-bytes-literal, 67 | raw-checker-failed, 68 | bad-inline-option, 69 | locally-disabled, 70 | locally-enabled, 71 | file-ignored, 72 | suppressed-message, 73 | useless-suppression, 74 | deprecated-pragma, 75 | apply-builtin, 76 | basestring-builtin, 77 | buffer-builtin, 78 | cmp-builtin, 79 | coerce-builtin, 80 | execfile-builtin, 81 | file-builtin, 82 | long-builtin, 83 | raw_input-builtin, 84 | reduce-builtin, 85 | standarderror-builtin, 86 | unicode-builtin, 87 | xrange-builtin, 88 | coerce-method, 89 | delslice-method, 90 | getslice-method, 91 | setslice-method, 92 | no-absolute-import, 93 | old-division, 94 | dict-iter-method, 95 | dict-view-method, 96 | next-method-called, 97 | metaclass-assignment, 98 | indexing-exception, 99 | raising-string, 100 | reload-builtin, 101 | oct-method, 102 | hex-method, 103 | nonzero-method, 104 | cmp-method, 105 | input-builtin, 106 | round-builtin, 107 | intern-builtin, 108 | unichr-builtin, 109 | map-builtin-not-iterating, 110 | zip-builtin-not-iterating, 111 | range-builtin-not-iterating, 112 | filter-builtin-not-iterating, 113 | using-cmp-argument, 114 | eq-without-hash, 115 | div-method, 116 | idiv-method, 117 | rdiv-method, 118 | exception-message-attribute, 119 | invalid-str-codec, 120 | sys-max-int, 121 | bad-python3-import, 122 | deprecated-string-function, 123 | deprecated-str-translate-call, 124 | deprecated-itertools-function, 125 | deprecated-types-field, 126 | next-method-defined, 127 | dict-items-not-iterating, 128 | dict-keys-not-iterating, 129 | dict-values-not-iterating 130 | 131 | # Enable the message, report, category or checker with the given id(s). You can 132 | # either give multiple identifier separated by comma (,) or put this option 133 | # multiple time (only on the command line, not in the configuration file where 134 | # it should appear only once). See also the "--disable" option for examples. 135 | enable=c-extension-no-member 136 | 137 | 138 | [REPORTS] 139 | 140 | # Python expression which should return a note less than 10 (10 is the highest 141 | # note). You have access to the variables errors warning, statement which 142 | # respectively contain the number of errors / warnings messages and the total 143 | # number of statements analyzed. This is used by the global evaluation report 144 | # (RP0004). 145 | evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) 146 | 147 | # Template used to display messages. This is a python new-style format string 148 | # used to format the message information. See doc for all details 149 | #msg-template= 150 | 151 | # Set the output format. Available formats are text, parseable, colorized, json 152 | # and msvs (visual studio).You can also give a reporter class, eg 153 | # mypackage.mymodule.MyReporterClass. 154 | output-format=text 155 | 156 | # Tells whether to display a full report or only the messages 157 | reports=no 158 | 159 | # Activate the evaluation score. 160 | score=yes 161 | 162 | 163 | [REFACTORING] 164 | 165 | # Maximum number of nested blocks for function / method body 166 | max-nested-blocks=5 167 | 168 | # Complete name of functions that never returns. When checking for 169 | # inconsistent-return-statements if a never returning function is called then 170 | # it will be considered as an explicit return statement and no message will be 171 | # printed. 172 | never-returning-functions=optparse.Values,sys.exit 173 | 174 | 175 | [VARIABLES] 176 | 177 | # List of additional names supposed to be defined in builtins. Remember that 178 | # you should avoid to define new builtins when possible. 179 | additional-builtins= 180 | 181 | # Tells whether unused global variables should be treated as a violation. 182 | allow-global-unused-variables=yes 183 | 184 | # List of strings which can identify a callback function by name. A callback 185 | # name must start or end with one of those strings. 186 | callbacks=cb_, 187 | _cb 188 | 189 | # A regular expression matching the name of dummy variables (i.e. expectedly 190 | # not used). 191 | dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ 192 | 193 | # Argument names that match this expression will be ignored. Default to name 194 | # with leading underscore 195 | ignored-argument-names=_.*|^ignored_|^unused_ 196 | 197 | # Tells whether we should check for unused import in __init__ files. 198 | init-import=no 199 | 200 | # List of qualified module names which can have objects that can redefine 201 | # builtins. 202 | redefining-builtins-modules=six.moves,past.builtins,future.builtins 203 | 204 | 205 | [LOGGING] 206 | 207 | # Logging modules to check that the string format arguments are in logging 208 | # function parameter format 209 | logging-modules=logging 210 | 211 | 212 | [TYPECHECK] 213 | 214 | # List of decorators that produce context managers, such as 215 | # contextlib.contextmanager. Add to this list to register other decorators that 216 | # produce valid context managers. 217 | contextmanager-decorators=contextlib.contextmanager 218 | 219 | # List of members which are set dynamically and missed by pylint inference 220 | # system, and so shouldn't trigger E1101 when accessed. Python regular 221 | # expressions are accepted. 222 | generated-members= 223 | 224 | # Tells whether missing members accessed in mixin class should be ignored. A 225 | # mixin class is detected if its name ends with "mixin" (case insensitive). 226 | ignore-mixin-members=yes 227 | 228 | # This flag controls whether pylint should warn about no-member and similar 229 | # checks whenever an opaque object is returned when inferring. The inference 230 | # can return multiple potential results while evaluating a Python object, but 231 | # some branches might not be evaluated, which results in partial inference. In 232 | # that case, it might be useful to still emit no-member and other checks for 233 | # the rest of the inferred objects. 234 | ignore-on-opaque-inference=yes 235 | 236 | # List of class names for which member attributes should not be checked (useful 237 | # for classes with dynamically set attributes). This supports the use of 238 | # qualified names. 239 | ignored-classes=optparse.Values,thread._local,_thread._local 240 | 241 | # List of module names for which member attributes should not be checked 242 | # (useful for modules/projects where namespaces are manipulated during runtime 243 | # and thus existing member attributes cannot be deduced by static analysis. It 244 | # supports qualified module names, as well as Unix pattern matching. 245 | ignored-modules= 246 | 247 | # Show a hint with possible names when a member name was not found. The aspect 248 | # of finding the hint is based on edit distance. 249 | missing-member-hint=yes 250 | 251 | # The minimum edit distance a name should have in order to be considered a 252 | # similar match for a missing member name. 253 | missing-member-hint-distance=1 254 | 255 | # The total number of similar names that should be taken in consideration when 256 | # showing a hint for a missing member. 257 | missing-member-max-choices=1 258 | 259 | 260 | [MISCELLANEOUS] 261 | 262 | # List of note tags to take in consideration, separated by a comma. 263 | notes=FIXME, 264 | XXX, 265 | TODO 266 | 267 | 268 | [BASIC] 269 | 270 | # Naming style matching correct argument names 271 | argument-naming-style=snake_case 272 | 273 | # Regular expression matching correct argument names. Overrides argument- 274 | # naming-style 275 | #argument-rgx= 276 | 277 | # Naming style matching correct attribute names 278 | attr-naming-style=snake_case 279 | 280 | # Regular expression matching correct attribute names. Overrides attr-naming- 281 | # style 282 | #attr-rgx= 283 | 284 | # Bad variable names which should always be refused, separated by a comma 285 | bad-names=foo, 286 | bar, 287 | baz, 288 | toto, 289 | tutu, 290 | tata 291 | 292 | # Naming style matching correct class attribute names 293 | class-attribute-naming-style=any 294 | 295 | # Regular expression matching correct class attribute names. Overrides class- 296 | # attribute-naming-style 297 | #class-attribute-rgx= 298 | 299 | # Naming style matching correct class names 300 | class-naming-style=PascalCase 301 | 302 | # Regular expression matching correct class names. Overrides class-naming-style 303 | #class-rgx= 304 | 305 | # Naming style matching correct constant names 306 | const-naming-style=UPPER_CASE 307 | 308 | # Regular expression matching correct constant names. Overrides const-naming- 309 | # style 310 | #const-rgx= 311 | 312 | # Minimum line length for functions/classes that require docstrings, shorter 313 | # ones are exempt. 314 | docstring-min-length=-1 315 | 316 | # Naming style matching correct function names 317 | function-naming-style=snake_case 318 | 319 | # Regular expression matching correct function names. Overrides function- 320 | # naming-style 321 | #function-rgx= 322 | 323 | # Good variable names which should always be accepted, separated by a comma 324 | good-names=i, 325 | j, 326 | k, 327 | ex, 328 | Run, 329 | _ 330 | 331 | # Include a hint for the correct naming format with invalid-name 332 | include-naming-hint=no 333 | 334 | # Naming style matching correct inline iteration names 335 | inlinevar-naming-style=any 336 | 337 | # Regular expression matching correct inline iteration names. Overrides 338 | # inlinevar-naming-style 339 | #inlinevar-rgx= 340 | 341 | # Naming style matching correct method names 342 | method-naming-style=snake_case 343 | 344 | # Regular expression matching correct method names. Overrides method-naming- 345 | # style 346 | #method-rgx= 347 | 348 | # Naming style matching correct module names 349 | module-naming-style=snake_case 350 | 351 | # Regular expression matching correct module names. Overrides module-naming- 352 | # style 353 | #module-rgx= 354 | 355 | # Colon-delimited sets of names that determine each other's naming style when 356 | # the name regexes allow several styles. 357 | name-group= 358 | 359 | # Regular expression which should only match function or class names that do 360 | # not require a docstring. 361 | no-docstring-rgx=^_ 362 | 363 | # List of decorators that produce properties, such as abc.abstractproperty. Add 364 | # to this list to register other decorators that produce valid properties. 365 | property-classes=abc.abstractproperty 366 | 367 | # Naming style matching correct variable names 368 | variable-naming-style=snake_case 369 | 370 | # Regular expression matching correct variable names. Overrides variable- 371 | # naming-style 372 | #variable-rgx= 373 | 374 | 375 | [SPELLING] 376 | 377 | # Limits count of emitted suggestions for spelling mistakes 378 | max-spelling-suggestions=4 379 | 380 | # Spelling dictionary name. Available dictionaries: none. To make it working 381 | # install python-enchant package. 382 | spelling-dict= 383 | 384 | # List of comma separated words that should not be checked. 385 | spelling-ignore-words= 386 | 387 | # A path to a file that contains private dictionary; one word per line. 388 | spelling-private-dict-file= 389 | 390 | # Tells whether to store unknown words to indicated private dictionary in 391 | # --spelling-private-dict-file option instead of raising a message. 392 | spelling-store-unknown-words=no 393 | 394 | 395 | [FORMAT] 396 | 397 | # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. 398 | expected-line-ending-format= 399 | 400 | # Regexp for a line that is allowed to be longer than the limit. 401 | ignore-long-lines=^\s*(# )??$ 402 | 403 | # Number of spaces of indent required inside a hanging or continued line. 404 | indent-after-paren=4 405 | 406 | # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 407 | # tab). 408 | indent-string=' ' 409 | 410 | # Maximum number of characters on a single line. 411 | max-line-length=100 412 | 413 | # Maximum number of lines in a module 414 | max-module-lines=1000 415 | 416 | # List of optional constructs for which whitespace checking is disabled. `dict- 417 | # separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. 418 | # `trailing-comma` allows a space between comma and closing bracket: (a, ). 419 | # `empty-line` allows space-only lines. 420 | no-space-check=trailing-comma, 421 | dict-separator 422 | 423 | # Allow the body of a class to be on the same line as the declaration if body 424 | # contains single statement. 425 | single-line-class-stmt=no 426 | 427 | # Allow the body of an if to be on the same line as the test if there is no 428 | # else. 429 | single-line-if-stmt=no 430 | 431 | 432 | [SIMILARITIES] 433 | 434 | # Ignore comments when computing similarities. 435 | ignore-comments=yes 436 | 437 | # Ignore docstrings when computing similarities. 438 | ignore-docstrings=yes 439 | 440 | # Ignore imports when computing similarities. 441 | ignore-imports=no 442 | 443 | # Minimum lines number of a similarity. 444 | min-similarity-lines=4 445 | 446 | 447 | [DESIGN] 448 | 449 | # Maximum number of arguments for function / method 450 | max-args=5 451 | 452 | # Maximum number of attributes for a class (see R0902). 453 | max-attributes=7 454 | 455 | # Maximum number of boolean expressions in a if statement 456 | max-bool-expr=5 457 | 458 | # Maximum number of branch for function / method body 459 | max-branches=12 460 | 461 | # Maximum number of locals for function / method body 462 | max-locals=15 463 | 464 | # Maximum number of parents for a class (see R0901). 465 | max-parents=7 466 | 467 | # Maximum number of public methods for a class (see R0904). 468 | max-public-methods=20 469 | 470 | # Maximum number of return / yield for function / method body 471 | max-returns=6 472 | 473 | # Maximum number of statements in function / method body 474 | max-statements=50 475 | 476 | # Minimum number of public methods for a class (see R0903). 477 | min-public-methods=2 478 | 479 | 480 | [IMPORTS] 481 | 482 | # Allow wildcard imports from modules that define __all__. 483 | allow-wildcard-with-all=no 484 | 485 | # Analyse import fallback blocks. This can be used to support both Python 2 and 486 | # 3 compatible code, which means that the block might have code that exists 487 | # only in one or another interpreter, leading to false positives when analysed. 488 | analyse-fallback-blocks=no 489 | 490 | # Deprecated modules which should not be used, separated by a comma 491 | deprecated-modules=regsub, 492 | TERMIOS, 493 | Bastion, 494 | rexec 495 | 496 | # Create a graph of external dependencies in the given file (report RP0402 must 497 | # not be disabled) 498 | ext-import-graph= 499 | 500 | # Create a graph of every (i.e. internal and external) dependencies in the 501 | # given file (report RP0402 must not be disabled) 502 | import-graph= 503 | 504 | # Create a graph of internal dependencies in the given file (report RP0402 must 505 | # not be disabled) 506 | int-import-graph= 507 | 508 | # Force import order to recognize a module as part of the standard 509 | # compatibility libraries. 510 | known-standard-library= 511 | 512 | # Force import order to recognize a module as part of a third party library. 513 | known-third-party=enchant 514 | 515 | 516 | [CLASSES] 517 | 518 | # List of method names used to declare (i.e. assign) instance attributes. 519 | defining-attr-methods=__init__, 520 | __new__, 521 | setUp 522 | 523 | # List of member names, which should be excluded from the protected access 524 | # warning. 525 | exclude-protected=_asdict, 526 | _fields, 527 | _replace, 528 | _source, 529 | _make 530 | 531 | # List of valid names for the first argument in a class method. 532 | valid-classmethod-first-arg=cls 533 | 534 | # List of valid names for the first argument in a metaclass class method. 535 | valid-metaclass-classmethod-first-arg=mcs 536 | 537 | 538 | [EXCEPTIONS] 539 | 540 | # Exceptions that will emit a warning when being caught. Defaults to 541 | # "Exception" 542 | overgeneral-exceptions=Exception 543 | --------------------------------------------------------------------------------