-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding scripts to run linting on only modified files (#3192)
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# lint_modified_go_files runs the linter only if changes have been made to any go files. | ||
function lint_modified_go_files() { | ||
local go_files="$(git diff --name-only | grep \.go$)" | ||
for f in $go_files; do | ||
golangci-lint run "${f}" --fix --out-format=tab --issues-exit-code=0 | ||
done | ||
} | ||
|
||
lint_modified_go_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# lint_modified_markdown_files runs the linter only if changes have been made to any md files. | ||
function lint_modified_markdown_files() { | ||
local markdown_files="$(git diff --name-only | grep \.md$)" | ||
for f in $markdown_files; do | ||
markdownlint "${f}" --fix | ||
done | ||
} | ||
|
||
lint_modified_markdown_files |