Skip to content

Commit

Permalink
chore: ignore auto-generated files, yml fmt/lint, and fix CI linting (#…
Browse files Browse the repository at this point in the history
…66)

* bump dep

* add gitattributes

* fix ci

* add yamlfmt and yamllint

* add config files

* update

* add .golangci.yaml config
  • Loading branch information
ayoubfaouzi authored Jul 9, 2024
1 parent ea8886d commit 6456f50
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docs/*.json linguist-generated=true
docs/*.yaml linguist-generated=true
go.sum linguist-generated=true
12 changes: 3 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,10 @@ jobs:
with:
files: ./coverage

- name: Go vet
run: |
go vet ./...
- name: Staticcheck
uses: dominikh/[email protected]
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: "2022.1"
install-go: false
cache-key: ${{ matrix.go }}
version: v1.59

build-container:
runs-on: ubuntu-20.04
Expand Down
5 changes: 5 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Options for analysis running.
run:
# Exit code when at least one issue was found.
# Default: 1
issues-exit-code: 0
27 changes: 19 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: detect-aws-credentials
- id: check-json
- id: check-toml
- id: check-yaml
- id: detect-aws-credentials
args:
- "--allow-missing-credentials"
- id: detect-private-key
- id: end-of-file-fixer
- id: pretty-format-json
- id: detect-private-key
- id: end-of-file-fixer
- id: pretty-format-json
args:
- "--autofix"
- "--indent=4"
- "--no-sort-keys"
- id: trailing-whitespace
- id: trailing-whitespace
- repo: https://github.com/google/yamlfmt
rev: v0.13.0
hooks:
- id: yamlfmt
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint -c .yamllint.yaml
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
80,
120
],
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
],
"cSpell.words": [
"healthcheck",
"mpfd",
Expand Down
6 changes: 6 additions & 0 deletions .yamlfmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/google/yamlfmt/blob/main/docs/config-file.md
formatter:
type: basic
max_line_length: 100
retain_line_breaks: true
scan_folded_as_literal: true
14 changes: 14 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://yamllint.readthedocs.io/en/stable/rules.html
extends: default
rules:
# 120 chars should be enough, but don't fail if a line is longer
line-length:
max: 100
level: warning
document-start:
present: false
indentation: disable
comments:
require-starting-space: true
min-spaces-from-content: 1
key-duplicates: {}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SHELL := /bin/bash
.PHONY: help

help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z/_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z\/_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help

# Retrieve the root directory of the project.
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

# Use this docker-compose file to setup the test environment before running the
# tests.

Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/swaggo/swag v1.16.3
github.com/xhit/go-simple-mail/v2 v2.13.0
github.com/yeka/zip v0.0.0-20180914125537-d046722c6feb
go.uber.org/zap v1.21.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.24.0
)

Expand Down Expand Up @@ -64,8 +64,7 @@ require (
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
Expand Down
25 changes: 6 additions & 19 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6456f50

Please sign in to comment.