fsprojects / fsprojects/FSharpLint

New rule proposal: Avoid commented-out lines of code

Open
#395 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Commented-out lines should be removed before release. It might already be broken.
If old code is later required again, it will be available in source code management system.

See also:

Expected behavior

Report any commented-out code.

  • Report multi-line commented code
let animal = "bird"

// Test the length of the string.
if (animal.Length = 1) then
    // Not reached.
    printfn "A"
(*
elif (animal.Length = 2) then
    // Not reached.
    printfn "B"
*)
else
    // This statement is reached.
    printfn "C"
  • Report single line commented code
assignment.
let result =
    if count >= 200 then 1
    // elif count <= 100 then 2
    else 3
Actual behavior

Rule not available today.

Known workarounds

One might configure a hint

Related information

Rule not listed at http://fsprojects.github.io/FSharpLint/Rules.html

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

Start with the two F# examples in the issue and review how existing rules are documented, including the linked rules page. Done means the linter reports both multi-line and single-line commented-out code, and the new rule is listed among the available rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.