melos icon indicating copy to clipboard operation
melos copied to clipboard

fix: ERROR: Could not find a command named "analyze"

Open mockturtl opened this issue 4 months ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues.

Version

7.0.0

Description

After upgrading to 7.0.0, melos analyze gives

Could not find a command named "analyze".

Was analyze removed? https://melos.invertase.dev/~melos-latest/commands/analyze

It doesn't appear in the command list (melos --help), but there's no mention in the CHANGELOG.

Steps to reproduce

melos analyze

Expected behavior

It should run flutter analyze in each package (they may have different analysis_options.yaml config files).

Screenshots

No response

Additional context and comments

No response

Other

  • [ ] I'm interested in working on a PR for this.

mockturtl avatar Aug 19 '25 18:08 mockturtl

Ah, it seems like we forgot to update the docs regarding melos analyze. When running dart analyze or flutter analyze in a pub workspace it runs it in the whole monorepo, so melos analyze is no longer needed.

spydon avatar Aug 19 '25 18:08 spydon

When running dart analyze or flutter analyze in a pub workspace it runs it in the whole monorepo, so melos analyze is no longer needed.

@spydon from my testing, I believe this is not entirely correct, or at least it does not address the issue. dart analyze runs the analysis in the current directory, not the whole workspace.

Switching to the root directory is trivial, but then comes the real issue: now dart analyze runs in the whole monorepo, regardless if it is part of the workspace. In my case our monorepo includes a large amount of non-Dart sources, and an experimental directory with packages not included in the workspace (with many analysis errors).

I can exclude experimental in analysis_options.yaml, but I don't want to maintain the list of non-Dart excludes. The analysis options file does not seem to support path includes, but even if it did, it would just be a repeat of the workspaces list.

xaethos avatar Sep 09 '25 20:09 xaethos

Ah, if that is the case I'll reopen this issue.

I thought since the analyzer doesn't fork itself when running in a pub workspace I assumed that it always ran on the whole workspace, but that might not be the case then. If that's true I'm open to bringing melos analyze back. I won't have much bandwidth doing that in the coming weeks, but PRs are welcome and I can review and publish a new version.

spydon avatar Sep 09 '25 20:09 spydon