fsprojects / fsprojects/FSharpLint
New rule proposal: Avoid commented-out lines of code
Nobody has claimed this yet.
- 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:
- Robert C. Martin's Clean Code Tip of the Week #7: Clean up Old Commented Out Code
- Can commented-out code be valuable documentation?
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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