Skip to content
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

Enforce linter to not cross packages #12987

Open
lahabana opened this issue Mar 3, 2025 · 0 comments
Open

Enforce linter to not cross packages #12987

lahabana opened this issue Mar 3, 2025 · 0 comments
Labels
area/ci-cd kind/improvement Improvement on an existing feature triage/accepted The issue was reviewed and is complete enough to start working on it

Comments

@lahabana
Copy link
Contributor

lahabana commented Mar 3, 2025

Description

While working on: #12982

I've noticed an import from test/ into pkg/ this should never happen even for tests there's a pkg/test package already designed for these kind of things.
Same thing for app/ or api/ they should have strong linter rules to provide good logic separation.

golangci-lint has ways to restrict imports. We should add this:

kuma/.golangci.yml

Lines 92 to 101 in b1c0b13

depguard:
rules:
pkg-import:
list-mode: lax # only disallow some imports
files:
- "!**/app/**/*.go"
- "!**/pkg/api-server/gui_handler.go"
deny:
- pkg: "github.com/kumahq/kuma/app"
desc: "pkg can't import app"

@lahabana lahabana added area/ci-cd kind/improvement Improvement on an existing feature triage/pending This issue will be looked at on the next triage meeting labels Mar 3, 2025
@bartsmykla bartsmykla added triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci-cd kind/improvement Improvement on an existing feature triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

No branches or pull requests

2 participants