Skip to content

Commit c14339a

Browse files
authored
Merge branch 'main' into cian/issue#2896-use-new-errors
2 parents ba2b75f + 25e2c45 commit c14339a

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ lint:
295295

296296
lint-fix:
297297
golangci-lint run --fix --out-format=tab --issues-exit-code=0
298-
.PHONY: lint lint-fix
298+
299+
lint-fix-changed:
300+
./scripts/linting/lint-changed-go-files.sh
299301

300302
format:
301303
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./docs/client/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' -not -name '*.pb.gw.go' | xargs gofumpt -w
@@ -305,6 +307,11 @@ format:
305307
docs-lint:
306308
markdownlint . --fix
307309

310+
docs-lint-changed:
311+
./scripts/linting/lint-changed-md-files.sh
312+
313+
.PHONY: lint lint-fix lint-fix-changed docs-lint docs-lint-changed
314+
308315
###############################################################################
309316
### Protobuf ###
310317
###############################################################################
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# lint_modified_go_files runs the linter only if changes have been made to any go files.
6+
function lint_modified_go_files() {
7+
local go_files="$(git diff --name-only | grep \.go$)"
8+
for f in $go_files; do
9+
local dir_name="$(dirname $f)"
10+
golangci-lint run "${dir_name}" --fix --out-format=tab --issues-exit-code=0
11+
done
12+
}
13+
14+
lint_modified_go_files
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# lint_modified_markdown_files runs the linter only if changes have been made to any md files.
6+
function lint_modified_markdown_files() {
7+
local markdown_files="$(git diff --name-only | grep \.md$)"
8+
for f in $markdown_files; do
9+
markdownlint "${f}" --fix
10+
done
11+
}
12+
13+
lint_modified_markdown_files

0 commit comments

Comments
 (0)