fsprojects / fsprojects/FSharpLint
bug: Warning for `override` member names can lead to erroneous suggestions
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 327
- Forks
- 74
- PR merge metrics
- No merged PRs in 30d
Description
Description
Hello, there is probably a way to deal with this already, but searching through existing issues didn't turn anything up.
With the memberNames.config.naming = camelCase, fsharplint suggests:
Consider changing `ToString` to camelCase.
Error on line 39 starting at column 23
override z.ToString() =
which cannot be done because this method comes from System.Object and override z.toString() is a compilation error FS0855.
Repro steps
- Create a new type
- Override
ToString() - Lint the file
Expected behavior
I would expect that the linter understands that inherited members that are overridden cannot have their name changed.
Actual behavior
The linter suggests that I change the name of the method in such a way that the project will not compile due to a missing member.
Known workarounds
I will currently use rule suppression on every line where I override a member that doesn't match my project's naming conventions.
Related information
- Linux
0.24.2+143ae50e0e32d0842fa36c1bc22c735f2c72f114- dotnet
8.0.302
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
Reproduce the issue with memberNames.config.naming set to camelCase and a type overriding ToString(), then trace the linter's naming check for overridden members. Done means the linter no longer suggests renaming inherited members such as System.Object.ToString, while ordinary naming warnings still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100