Skip to content

Commit

Permalink
Merge pull request #435 from swrlab/dev/prettier-upgrade
Browse files Browse the repository at this point in the history
chore: update `super-linter` with new config
  • Loading branch information
frytg committed Aug 10, 2022
2 parents 15e37b9 + 7a82685 commit 417cff1
Show file tree
Hide file tree
Showing 19 changed files with 711 additions and 528 deletions.
42 changes: 42 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# docs: https://editorconfig.org
# please make sure to keep this file in sync between repositories
# to main file should be edited in `swr-prettier-config` and copied where needed

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 8
print_width = 120
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[*.{yml,yaml}]
indent_style = space
indent_size = 2

# LiquidSoap config files
[*.liq]
indent_style = space
indent_size = 2

# Terraform config files
[*.tf]
indent_style = space
indent_size = 2

# Linting toml config files
[*.toml]
indent_style = space
indent_size = 2

# Auto-generated CSV Files
[*.csv]
insert_final_newline = false
24 changes: 12 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "github-actions"
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: 'npm'
directory: '/'
open-pull-requests-limit: 10
schedule:
interval: 'weekly'
day: 'sunday'
- package-ecosystem: 'github-actions'
directory: '/'
open-pull-requests-limit: 10
schedule:
interval: 'weekly'
day: 'sunday'
10 changes: 10 additions & 0 deletions .github/linters/gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# example see https://github.com/github/super-linter/blob/main/TEMPLATES/.gitleaks.toml
# configuration see https://github.com/zricethezav/gitleaks#configuration

title = "gitleaks config"

useDefault = true

[allowlist]
description = "Allowlisted files"
paths = ['''(default_host.key)$''']
11 changes: 11 additions & 0 deletions .github/linters/hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Dockerfile linter https://github.com/hadolint/hadolint

failure-threshold: error

ignored:
# Using latest is prone to errors if the image will ever update
- DL3007
# Pin versions in apk add
- DL3018
# Use absolute WORKDIR
- DL3000
6 changes: 6 additions & 0 deletions .github/linters/jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"threshold": 8,
"reporters": ["consoleFull"],
"ignore": ["**/models/*.json"],
"absolute": true
}
13 changes: 13 additions & 0 deletions .github/linters/terrascan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# terrascan configuration file https://github.com/accurics/terrascan/blob/master/config/terrascan.toml
# list of policies https://runterrascan.io/docs/policies/

severity:
level: 'medium'

# scan and skip rules configuration
rules:
# skip rules (list of rules to skip)
skip-rules:
# skip service account at project-level check https://runterrascan.io/docs/policies/gcp/#google_project_iam_member
# https://github.com/tenable/terrascan/blob/8ae13452f91b9040038166c1b10e0f4191966ddd/pkg/policies/opa/rego/gcp/google_project_iam_member/accurics.gcp.IAM.137.json
- 'AC_GCP_0006'
7 changes: 7 additions & 0 deletions .github/linters/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
extends: default

rules:
document-start: disable
line-length:
max: 120
170 changes: 170 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
---
name: Linter

on:
pull_request:
workflow_call:
inputs:
install-all:
description: 'Install dependencies using `install-all`'
required: false
type: boolean
default: false
generate-keys:
description: 'Whether to run command for dummy key generation'
required: false
type: boolean
default: false
log-level:
description: 'Which log level to use for `super-linter`'
required: false
type: string
default: 'VERBOSE'
validate-all-codebase:
description: 'Whether to run validation on all files'
required: false
type: boolean
default: true

env:
CSS_FILE_NAME: /.stylelintrc.json
DEFAULT_BRANCH: main
DOCKERFILE_HADOLINT_FILE_NAME: /.utils/.github/linters/hadolint.yaml
EDITORCONFIG_FILE_NAME: /.editorconfig
FILTER_REGEX_EXCLUDE: .*(ati-smarttag.js|skycons.js|.github/workflows/*|docs/ARCHITECTURE/*|traffic/sftp-gcs/*|.mp3|.php|.drawio|demo.ejs)
IGNORE_GITIGNORED_FILES: true
JAVASCRIPT_DEFAULT_STYLE: prettier
JAVASCRIPT_ES_CONFIG_FILE: /.eslintrc.json
JSCPD_CONFIG_FILE: /.utils/.github/linters/jscpd.json
KUBERNETES_KUBEVAL_OPTIONS: --ignore-missing-schemas
LINTER_RULES_PATH: /
# options: ERROR, WARN, NOTICE, VERBOSE, DEBUG or TRACE
LOG_LEVEL: ${{ inputs.log-level }}
MARKDOWN_CONFIG_FILE: /.markdownlint.yaml
NODE_VERSION: 18
TERRAFORM_TERRASCAN_CONFIG_FILE: /.utils/.github/linters/terrascan.yaml
VALIDATE_ALL_CODEBASE: ${{ inputs.validate-all-codebase }}
VALIDATE_ANSIBLE: false
VALIDATE_ARM: false
# VALIDATE_BASH: true
# VALIDATE_BASH_EXEC: true
VALIDATE_CPP: false
VALIDATE_CLANG_FORMAT: false
VALIDATE_CLOJURE: false
VALIDATE_CLOUDFORMATION: false
VALIDATE_COFFEESCRIPT: false
VALIDATE_CSHARP: false
VALIDATE_CSS: false
VALIDATE_DART: false
# VALIDATE_DOCKERFILE_HADOLINT: true
# VALIDATE_EDITORCONFIG: true
# VALIDATE_ENV: true
VALIDATE_GHERKIN: false
# VALIDATE_GITHUB_ACTIONS: true
# VALIDATE_GITLEAKS: true
VALIDATE_GO: false
VALIDATE_GOOGLE_JAVA_FORMAT: false
VALIDATE_GROOVY: false
# VALIDATE_HTML: true
VALIDATE_JAVA: false
# VALIDATE_JAVASCRIPT_ES: true
# VALIDATE_JAVASCRIPT_STANDARD: true
# VALIDATE_JSCPD: true
# VALIDATE_JSON: true
# VALIDATE_JSX: true
VALIDATE_KOTLIN: false
VALIDATE_KOTLIN_ANDROID: false
# VALIDATE_KUBERNETES_KUBEVAL: true
VALIDATE_LATEX: false
VALIDATE_LUA: false
# VALIDATE_MARKDOWN: true
# VALIDATE_NATURAL_LANGUAGE: true
VALIDATE_OPENAPI: false
VALIDATE_PERL: false
VALIDATE_PHP: false
VALIDATE_PHP_BUILTIN: false
VALIDATE_PHP_PHPCS: false
VALIDATE_PHP_PHPSTAN: false
VALIDATE_PHP_PSALM: false
# VALIDATE_POWERSHELL: true
VALIDATE_PROTOBUF: false
VALIDATE_PYTHON: false
VALIDATE_PYTHON_BLACK: false
VALIDATE_PYTHON_FLAKE8: false
VALIDATE_PYTHON_ISORT: false
VALIDATE_PYTHON_MYPY: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_R: false
VALIDATE_RAKU: false
VALIDATE_RUBY: false
VALIDATE_RUST_2015: false
VALIDATE_RUST_2018: false
VALIDATE_RUST_2021: false
VALIDATE_RUST_CLIPPY: false
VALIDATE_SCALAFMT: false
VALIDATE_SHELL_SHFMT: false
VALIDATE_SNAKEMAKE_LINT: false
VALIDATE_SNAKEMAKE_SNAKEFMT: false
VALIDATE_STATES: false
VALIDATE_SQL: false
VALIDATE_SQLFLUFF: false
VALIDATE_TEKTON: false
# VALIDATE_TERRAFORM_TERRASCAN: true
# VALIDATE_TERRAFORM_TFLINT: true
VALIDATE_TERRAGRUNT: false
# VALIDATE_TSX: true
# VALIDATE_TYPESCRIPT_ES: true
# VALIDATE_TYPESCRIPT_STANDARD: true
# VALIDATE_XML: true
# VALIDATE_YAML: true
YAML_CONFIG_FILE: /.utils/.github/linters/yamllint.yaml

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: read
statuses: write
steps:
- name: 👀 Checkout repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: 👀 Checkout utils into subfolder
uses: actions/checkout@v3
with:
persist-credentials: false
repository: swrlab/node-utils
ref: 'main'
path: '.utils'

- name: ⛺️ Install Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: 📦 Install Dependencies (if `install:all`)
if: inputs.install-all == true
run: yarn install:all

- name: 📦 Install Dependencies (if `install`)
if: inputs.install-all != true
run: yarn

- name: 🔑 Generate dummy keys
if: inputs.generate-keys == true
run: yarn keys:generate

- name: 📚 Lint Code Base
uses: docker://github/super-linter:v4
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 0 additions & 46 deletions .github/workflows/push.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ typings/
.next

tmp/*
!tmp/.gitkeep
!tmp/.gitkeep
35 changes: 35 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# see config https://github.com/DavidAnson/markdownlint#optionsconfig
# see example file https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
# see rules https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
# recommended VS Code plugin: https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint

# Default state for all rules
default: true

# Unordered list style
MD004: true

MD007:
# Unordered list indentation
indent: 2

# MD013/line-length - Line length
MD013:
# Number of characters
line_length: 808

MD026:
# List of not allowed
punctuation: '.,;:!。,;:'

# Ordered list item prefix
MD029: false

# Allow inline HTML
MD033: false

# Emphasis used instead of a heading
MD036: false

# Error on blank lines
blank_lines: false
13 changes: 13 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"defaultSeverity": "warning",
"extends": ["stylelint-config-standard-scss", "stylelint-config-recommended-vue/scss"],
"ignoreFiles": ["**/static-ui/dist/*", "**/ati-smarttag.js", "**/skycons.js"],
"rules": {
"declaration-empty-line-before": null,
"indentation": "tab",
"no-descending-specificity": null,
"property-no-vendor-prefix": null,
"selector-class-pattern": null,
"selector-not-notation": null
}
}
Loading

0 comments on commit 417cff1

Please sign in to comment.