feat(cli): mops lint honors [migrations].check-limit#525
Merged
Conversation
Trims frozen chain migration files from the lint pass to match what `moc` already sees during `mops check`. Without this, projects with hundreds of frozen migrations couldn't get fast lint feedback even with `check-limit = 1`. Explicit filters (`mops lint <name>`) and explicit file paths bypass the trim so users can lint a trimmed migration on demand. Made-with: Cursor
Extract `resolveMigrationChain` from `prepareMigrationArgs`. It validates config, discovers files, and applies `*-limit` once, returning both the post-trim entries to stage for moc and the absolute paths excluded from lint. Eliminates the duplicated `chainFiles.length - limit + (hasNext ? 1 : 0)` formula in `getTrimmedMigrationFiles` — the trim semantics now live in exactly one place. `prepareMigrationArgs` consumes `included` directly, avoiding the split-then-merge that made the prior abstraction attempt worse than what it replaced. No behavior change: all migrate / check / build snapshot tests pass byte-for-byte. Made-with: Cursor
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mops lintnow skips chain migrations excluded by[canisters.<name>.migrations].check-limit, so projects with hundreds of frozen migrations lint as fast as they type-check. Previously lint walked all**/*.moregardless of the limit, defeating the speed knobmops checkalready had.Pass an explicit filter (
mops lint <name>) or a file path to lint a trimmed migration on demand.Caveat:
mops lintnow reads[canisters.*.migrations]to compute the trim, so misconfig (invalidcheck-limit, missing chain dir, etc.) now fails here with the same errormops checkproduces.