Skip to content

Commit

Permalink
Add yamllint
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Feb 8, 2024
1 parent d8a91de commit 76069da
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 53 deletions.
21 changes: 11 additions & 10 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
change:
- head-branch: ['^change/']
- head-branch: ["^change/"]

enhancement:
- head-branch: ['^feature/', '^feat/', '^enhancement/', '^enh/']
- head-branch: ["^feature/", "^feat/", "^enhancement/", "^enh/"]

bug:
- head-branch: ['^fix/', '^bug/']
- head-branch: ["^fix/", "^bug/"]

chore:
- head-branch: ['^chore/']
- head-branch: ["^chore/"]

tests:
- head-branch: ['^tests/', '^test/']
- head-branch: ["^tests/", "^test/"]
- changed-files:
- any-glob-to-any-file: 'tests/**/*'
- any-glob-to-any-file: "tests/**/*"

documentation:
- head-branch: ['^docs/', '^doc/']
- head-branch: ["^docs/", "^doc/"]
- changed-files:
- any-glob-to-any-file: '**/*.md'
- any-glob-to-any-file: "**/*.md"

dependencies:
- head-branch: ['^deps/', '^dep/', '^dependabot/', 'pre-commit-ci-update-config']
- head-branch:
["^deps/", "^dep/", "^dependabot/", "pre-commit-ci-update-config"]
- changed-files:
- any-glob-to-any-file: ['go.mod', 'go.sum']
- any-glob-to-any-file: ["go.mod", "go.sum"]
19 changes: 16 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
pull_request:
branches:
- main
paths-ignore:
- "**.md"
- "LICENSE"

defaults:
run:
shell: bash

concurrency:
group: ${{ github.ref_name }}-lint
Expand Down Expand Up @@ -54,3 +55,15 @@ jobs:
config: .markdownlint-cli2.yaml
globs: "**/*.md"
fix: false

yaml-lint:
name: YAML lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install yamllint
run: pip install yamllint

- name: Lint YAML files
run: yamllint .
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: OpenSSF Scorecards
on:
branch_protection_rule:
branch_protection_rule: # yamllint disable-line rule:empty-values
schedule:
- cron: "42 15 * * 6" # run every Saturday at 15:42 UTC
push:
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ linters-settings:
- name: var-naming

linters:
enable:
enable:
- asciicheck
- errcheck
- errorlint
Expand All @@ -53,7 +53,7 @@ linters:
- unparam
- unused
- wastedassign
disable-all: true
disable-all: true
issues:
max-issues-per-linter: 0
max-same-issues: 0
Expand Down
74 changes: 37 additions & 37 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-case-conflict
- id: check-vcs-permalinks
- id: mixed-line-ending
args: [--fix=lf]
- id: no-commit-to-branch
- id: fix-byte-order-marker
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-case-conflict
- id: check-vcs-permalinks
- id: mixed-line-ending
args: [--fix=lf]
- id: no-commit-to-branch
- id: fix-byte-order-marker

- repo: local
hooks:
- id: golang-diff
name: create-go-diff
entry: bash -c 'git diff -p origin/main > /tmp/diff.patch'
language: system
types: [go]
pass_filenames: false
- repo: local
hooks:
- id: golang-diff
name: create-go-diff
entry: bash -c 'git diff -p origin/main > /tmp/diff.patch'
language: system
types: [go]
pass_filenames: false

- repo: https://github.com/golangci/golangci-lint
rev: v1.55.2
hooks:
- id: golangci-lint
args: [--new-from-patch=/tmp/diff.patch]
- repo: https://github.com/golangci/golangci-lint
rev: v1.55.2
hooks:
- id: golangci-lint
args: [--new-from-patch=/tmp/diff.patch]

- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleaks
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleaks

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
hooks:
- id: markdownlint-cli2
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
hooks:
- id: markdownlint-cli2

ci:
skip: [golang-diff, golangci-lint]
20 changes: 20 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
yaml-files:
- "*.yaml"
- "*.yml"

extends: default

rules:
comments:
min-spaces-from-content: 1
comments-indentation: enable
document-start: disable
empty-values: enable
line-length:
max: 120
ignore: |
.goreleaser.yml
.github/
truthy:
check-keys: false

0 comments on commit 76069da

Please sign in to comment.