Skip to content

Commit

Permalink
test: add linters
Browse files Browse the repository at this point in the history
Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS committed Sep 14, 2024
1 parent 04cc2df commit 4484739
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [0, 'always', 72],
'body-max-line-length': [2, 'always', 120],
'footer-max-line-length': [2, 'always', 120],
},
}
30 changes: 30 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"ignorePaths": [
"**/.git/**",
".cspell.json",
".editorconfig",
".github/dependabot.yml",
".github/labeler.yml",
".gitignore",
".goreleaser.yaml",
".mega-linter.yml",
"CHANGELOG.md",
"Taskfile.yml",
"go.mod",
"go.sum",
"megalinter",
],
"language": "en",
"noConfigSearch": true,
"words": [
"GOARCH",
"GOARM",
"armv",
"commitlint",
"golangci",
"libc",
"wagoid",
],
"ignoreWords": [],
"version": "0.2"
}
28 changes: 28 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# EditorConfig: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8
indent_style = tab

[*.py]
indent_style = space
indent_size = 4

[*.{json,yml,yaml,js,mjs,css}]
indent_style = space
indent_size = 2

[Dockerfile]
indent_style = space
indent_size = 4

[{*.md,.pylintrc,index.hbs}]
indent_style = unset
indent_size = unset
generated_code = true

64 changes: 64 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# Run linters

name: lint
on:
pull_request:
pull_request_review:
types: ['submitted']
merge_group:
push:
branches: ['main']
tags: ['v*']

env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true

permissions:
contents: read

jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Commit-Lint
uses: wagoid/commitlint-github-action@v6
with:
configFile: .commitlint.config.mjs

megalinter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: MegaLinter
uses: oxsecurity/megalinter/flavors/cupcake@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: true

golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
7 changes: 7 additions & 0 deletions .markdown-link-check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ignorePatterns": [
{
"pattern": "^https://aur.archlinux.org/packages/.*"
}
]
}
17 changes: 17 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"default": true,
"MD004": false,
"MD007": false,
"MD010": false,
"MD013": false,
"MD014": false,
"MD026": {
"punctuation": ".,;:!。,;:"
},
"MD029": false,
"MD033": false,
"MD036": false,
"MD040": false,
"blank_lines": false,
"whitespace": false
}
16 changes: 16 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
APPLY_FIXES: all
DISABLE:
- COPYPASTE
DISABLE_LINTERS:
- CSS_STYLELINT
- GO_GOLANGCI_LINT
- REPOSITORY_KICS
- SPELL_LYCHEE
SHOW_ELAPSED_TIME: true
FILEIO_REPORTER: false

# Spelling
SPELL_CSPELL_ANALYZE_FILE_NAMES: false

# yaml v8r
YAML_V8R_DISABLE_ERRORS: true
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"useTabs": false,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
}

0 comments on commit 4484739

Please sign in to comment.