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

Duplicate ignore must_be_immutable #795

Open
putnokiabel opened this issue Jan 7, 2025 · 2 comments
Open

Duplicate ignore must_be_immutable #795

putnokiabel opened this issue Jan 7, 2025 · 2 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@putnokiabel
Copy link

putnokiabel commented Jan 7, 2025

At the start of the generated mock files, Mockito puts a // ignore_for_file: must_be_immutable directive.
For immutable classes Mockito additionally puts another // ignore: must_be_immutable.

This generates the following analyzer warning:

The diagnostic 'must_be_immutable' doesn't need to be ignored here because it's already being ignored.
Try removing the name from the list, or removing the whole comment if this is the only name in the list.
dart(duplicate_ignore)

Either the local ignore (for specific classes) or the global ignore (for the entire class) needs to be removed. It does not seem to matter which one, though keeping the global ignore for the entire file and removing the one specific to immutable classes seems to be the easier way that reduces complexity.

@putnokiabel
Copy link
Author

The issue is present on the latest version 5.4.5 but is not present on 5.4.4 or on earlier versions.

@srawlins
Copy link
Member

srawlins commented Jan 7, 2025

Thanks for the great report!

@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants