-
Notifications
You must be signed in to change notification settings - Fork 31
chore(ci): add pathconcat custom linter plugin #3266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| version: v2.8.0 | ||
| name: custom-gcl | ||
| plugins: | ||
| - module: github.com/jakedoublev/pathconcat | ||
| version: v0.3.0 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,6 +48,7 @@ linters: | |||||||||||||||||||||||||||||||||||||||
| - nolintlint | ||||||||||||||||||||||||||||||||||||||||
| - nonamedreturns | ||||||||||||||||||||||||||||||||||||||||
| - nosprintfhostport | ||||||||||||||||||||||||||||||||||||||||
| - pathconcat | ||||||||||||||||||||||||||||||||||||||||
| - perfsprint | ||||||||||||||||||||||||||||||||||||||||
| - predeclared | ||||||||||||||||||||||||||||||||||||||||
| - promlinter | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -73,6 +74,15 @@ linters: | |||||||||||||||||||||||||||||||||||||||
| - wastedassign | ||||||||||||||||||||||||||||||||||||||||
| - whitespace | ||||||||||||||||||||||||||||||||||||||||
| settings: | ||||||||||||||||||||||||||||||||||||||||
| custom: | ||||||||||||||||||||||||||||||||||||||||
| pathconcat: | ||||||||||||||||||||||||||||||||||||||||
| type: module | ||||||||||||||||||||||||||||||||||||||||
| description: "Detects string path/URL concatenation; suggests filepath.Join, path.Join, or url.JoinPath" | ||||||||||||||||||||||||||||||||||||||||
| settings: | ||||||||||||||||||||||||||||||||||||||||
| ignore-strings: | ||||||||||||||||||||||||||||||||||||||||
| - "/attr/" | ||||||||||||||||||||||||||||||||||||||||
| - "/value/" | ||||||||||||||||||||||||||||||||||||||||
| - "/obl/" | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+77
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Add rationale comments for broad Line 82–85 uses substring suppressions that are intentionally broad; a short inline note will reduce future accidental edits/regressions. 📝 Suggested clarity update custom:
pathconcat:
type: module
description: "Detects string path/URL concatenation; suggests filepath.Join, path.Join, or url.JoinPath"
settings:
+ # Suppress known FQN token patterns that are not filesystem/URL path construction.
ignore-strings:
- "/attr/"
- "/value/"
- "/obl/"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
| errcheck: | ||||||||||||||||||||||||||||||||||||||||
| check-type-assertions: true | ||||||||||||||||||||||||||||||||||||||||
| exhaustive: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| # make | ||
| # To run all lint checks: `LINT_OPTIONS= make lint` | ||
|
|
||
| .PHONY: all build clean connect-wrapper-generate docker-build fix fmt go-lint license lint proto-generate proto-lint sdk/sdk test tidy toolcheck | ||
| .PHONY: all build clean connect-wrapper-generate custom-gcl docker-build fix fmt go-lint license lint proto-generate proto-lint sdk/sdk test tidy toolcheck | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| MODS=protocol/go lib/ocrypto lib/fixtures lib/flattening lib/identifier sdk service examples | ||
| HAND_MODS=lib/ocrypto lib/fixtures lib/flattening lib/identifier sdk service examples | ||
|
|
@@ -56,11 +56,14 @@ proto-lint: | |
| exit $$exit_code; \ | ||
| fi) | ||
|
|
||
| go-lint: | ||
| custom-gcl: | ||
| golangci-lint custom | ||
|
Comment on lines
+59
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To ensure the custom linter binary is rebuilt when its configuration changes, add |
||
|
|
||
| go-lint: custom-gcl | ||
| status=0; \ | ||
| for m in $(HAND_MODS); do \ | ||
| echo "Linting module: $$m"; \ | ||
| (cd "$$m" && golangci-lint run $(LINT_OPTIONS) ) || status=1; \ | ||
| (cd "$$m" && $(ROOT_DIR)/custom-gcl run $(LINT_OPTIONS) ) || status=1; \ | ||
| done; \ | ||
| exit $$status | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Build
custom-gclonce per workflow and reuse across matrix jobs.Compiling the custom binary in every matrix leg adds avoidable CI time. Consider a dedicated prep job that builds
custom-gclonce and shares it via artifact/cache.🤖 Prompt for AI Agents