Skip to content

Catching null-based expectations in test code. #59340

@bwilkerson

Description

@bwilkerson

I just saw this in some test code: expect(context.analysisOptions, isNotNull);. This seemed fine until I realized that context.analysisOptions returns a non-nullable value making it impossible for the condition to ever fail. I wonder whether it would be useful to have a lint to catch places where isNull, isNotNull, or null are used in expectations where they can never fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposaltype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions