Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,56 @@ linters:
deny:
- pkg: "github.com/databricks/cli/experimental"
desc: "must not import experimental/ packages; use an interface or move the dependency"
# aitools layers: cmd/aitools (cobra commands) -> libs/aitools -> shared
# libs. Lower layers must not reach up. The aitools rules anchor their
# files patterns at ${config-path} (the repository root) so that a
# libs or cmd directory above the checkout does not match.
aitools-libs-no-commands:
files:
- "${config-path}/libs/aitools/**"
deny:
- pkg: "github.com/databricks/cli/cmd$"
desc: "libs/aitools must not import command packages; pass what it needs in from cmd/aitools"
- pkg: "github.com/databricks/cli/cmd/"
desc: "libs/aitools must not import command packages; pass what it needs in from cmd/aitools"
aitools-commands-only-root:
# lax: allow everything except cmd and cmd/*; the longer allow entries
# win over the cmd/ deny.
list-mode: lax
Comment thread
anton-107 marked this conversation as resolved.
Resolved
files:
- "${config-path}/cmd/aitools/**"
allow:
- "github.com/databricks/cli/cmd/root$"
- "github.com/databricks/cli/cmd/root/"
- "github.com/databricks/cli/cmd/aitools$"
- "github.com/databricks/cli/cmd/aitools/"
deny:
- pkg: "github.com/databricks/cli/cmd$"
desc: "cmd/aitools may import only cmd/root and itself; share code through libs/aitools instead of another command group"
- pkg: "github.com/databricks/cli/cmd/"
Comment thread
anton-107 marked this conversation as resolved.
Resolved
desc: "cmd/aitools may import only cmd/root and itself; share code through libs/aitools instead of another command group"
libs-no-aitools:
files:
- "${config-path}/libs/**"
- "!${config-path}/libs/aitools/**"
deny:
- pkg: "github.com/databricks/cli/libs/aitools$"
desc: "shared libs must not depend on the aitools feature packages"
- pkg: "github.com/databricks/cli/libs/aitools/"
desc: "shared libs must not depend on the aitools feature packages"
# cmd/root/root.go calls the aitools user-agent and hint hooks from the
# root pre-run and the auto-install hook from the root post-run; keep
# those calls in that one file. Tests may import aitools to stub them.
root-aitools-hooks-in-root-go:
files:
- "${config-path}/cmd/root/**"
- "!${config-path}/cmd/root/root.go"
- "!$test"
deny:
- pkg: "github.com/databricks/cli/libs/aitools$"
desc: "aitools hooks belong in cmd/root/root.go only"
- pkg: "github.com/databricks/cli/libs/aitools/"
desc: "aitools hooks belong in cmd/root/root.go only"
no-legacy-rand:
deny:
- pkg: "math/rand$"
Expand Down
Loading