fsprojects / fsprojects/FSharpLint

Lint suggests "not (isNull x)" over "x <> null"

Open
#439 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
327
Forks
74
PR merge metrics
No merged PRs in 30d

Description

Description

The linter suggests replacing a null check (x <> null) with the more complicated not (isNull x). I'm not coming up with any cases where I think a null check would be better as not (isNull x).

image

Repro steps

Please provide the steps required to reproduce the problem

  1. Add a <> null check to your F# code

  2. View linter error

Expected behavior

The linter doesn't warn on <> null checks.

Actual behavior

The linter warns on <> null checks.

Known workarounds

Disable the linter.

Related information
  • Operating system
  • Branch
  • .NET Runtime, CoreCLR or Mono Version
  • Performance information, links to performance testing scripts

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning by adding an x <> null check to F# code, then locate the lint rule that reports it. Done means the linter no longer warns for this check and the behavior is covered by the relevant rule tests, if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.