Skip to content

Commit

Permalink
Fix pre-commit and action linter (#1172)
Browse files Browse the repository at this point in the history
Problem: Linting errors were not being caught before being merged to main.

Solution: Ensure that the pre commit hook runs on the full repo and not just the diff. Also disabled a the "only-new-issues" check in the pipeline to ensure everything is caught.
  • Loading branch information
sjberman authored Oct 20, 2023
1 parent 66fbaa7 commit ee0c491
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
args: --timeout 10m0s
only-new-issues: true

njs-lint:
name: NJS Lint
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ linters-settings:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-block
- name: error-naming
- name: error-return
Expand Down
16 changes: 3 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,10 @@ repos:
types:
- javascript

- 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.54.2
rev: v1.55.0
hooks:
- id: golangci-lint
args: [--new-from-patch=/tmp/diff.patch]
- id: golangci-lint-full

# Rules are in .markdownlint-cli2.yaml file
# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for rule descriptions
Expand All @@ -64,5 +54,5 @@ repos:
- id: yamllint

ci:
skip: [golang-diff, golangci-lint, prettier, markdownlint-cli2-fix, yamllint]
skip: [golangci-lint-full, prettier, markdownlint-cli2-fix, yamllint]
autofix_prs: false

0 comments on commit ee0c491

Please sign in to comment.