Add local lint option#5876
Conversation
Signed-off-by: evieira <t01etvi@tryg.dk>
Signed-off-by: evieira <t01etvi@tryg.dk>
Signed-off-by: evieira <t01etvi@tryg.dk>
Signed-off-by: evieira <t01etvi@tryg.dk>
StuffbyYuki
left a comment
There was a problem hiding this comment.
@EthanVieira Thanks for this PR!
No blocker, but one thing -- The "--local" in sys.argv gate is understandable given Context is built in the parent callback before the subcommand runs, but it means Click can accept --local while behavior only changes when argv matches (hence the test monkeypatch). A brief comment at the gate (or a slightly cleaner early-parse / root-level wiring) would help future readers.
Once ci tests passed, I'll merge the PR (you prob just need to rebase)
Let me know what you think!
Agreed! Added some earlier parsing and comments. |
Description
As mentioned in #5182, the
lintcommand still requires the remote state to resolve references in the multi-repo case. These changes add an optional--localoption to thelintcommand so it is runnable without a reachable state backend. This is useful for faster lint iterations in repositories where all referenced models are available locally.In multi-repo setups, or when linting only a subset of projects,
--localmay produce additional linting errors because SQLMesh will not resolve references or schemas from models that exist only in remote state.Updated the linter guide and CLI reference to document the new flag and caveat.
Resolves: #5182
Test Plan
sqlmesh lint --localto verifyContextis constructed withload_state=Falseand state sync is not accessed.Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO