-
Notifications
You must be signed in to change notification settings - Fork 73
Expand and rename FavourNestedFunctions rule #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Expand and rename FavourNestedFunctions rule #844
Conversation
Greptile OverviewConfidence Score: 2/5
|
| Filename | Overview |
|---|---|
| src/FSharpLint.Core/Rules/Conventions/FavourLocalOverPrivate.fs | Renamed from FavourNestedFunctions, expanded to handle non-function values. CRITICAL BUG: rule Name field still says "FavourNestedFunctions" instead of matching the new module/identifier name |
| tests/FSharpLint.Core.Tests/Rules/Conventions/FavourLocalOverPrivate.fs | Renamed test file with new tests added for private values (not just functions), comprehensive test coverage |
| src/FSharpLint.Core/Application/Configuration.fs | Updated configuration field names from favourNestedFunctions to favourLocalOverPrivate consistently |
| src/FSharpLint.Core/Text.resx | Updated resource string key and message to reflect expanded rule scope |
| docs/content/how-tos/rules/FL0091.md | Updated documentation for renamed rule. Minor typo: "functions/value" should be "functions/values" (plural) |
Sequence Diagram
sequenceDiagram
participant User
participant Linter
participant Config
participant FavourLocalOverPrivate
participant CheckInfo
User->>Linter: Run lint on F# file
Linter->>Config: Load configuration
Config->>Config: Read favourLocalOverPrivate setting
Config-->>Linter: Return enabled rules
Linter->>FavourLocalOverPrivate: Execute rule on AST nodes
FavourLocalOverPrivate->>FavourLocalOverPrivate: Collect module-level bindings
FavourLocalOverPrivate->>FavourLocalOverPrivate: Filter private bindings (functions + values)
FavourLocalOverPrivate->>CheckInfo: Get symbol usage info
CheckInfo-->>FavourLocalOverPrivate: Return usage locations
FavourLocalOverPrivate->>FavourLocalOverPrivate: Count usage in distinct functions
alt Used in exactly 1 function
FavourLocalOverPrivate-->>Linter: Return warning
Linter-->>User: Display "Prefer local over private"
else Used in 0 or 2+ functions
FavourLocalOverPrivate-->>Linter: No warning
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
31 files reviewed, 2 comments
| @@ -149,7 +151,7 @@ let runner (args: AstNodeRuleParams) = | |||
|
|
|||
| let rule = | |||
| { Name = "FavourNestedFunctions" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rule Name field still references old name "FavourNestedFunctions" instead of "FavourLocalOverPrivate"
| { Name = "FavourNestedFunctions" | |
| { Name = "FavourLocalOverPrivate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
docs/content/how-tos/rules/FL0091.md
Outdated
| ## Cause | ||
|
|
||
| Prefer using local (nested) functions over private module-level functions. | ||
| Prefer using local (nested) functions and values over private module-level functions/value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"functions/value" should be "functions/values" (plural)
| Prefer using local (nested) functions and values over private module-level functions/value. | |
| Prefer using local (nested) functions and values over private module-level functions/values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
720744a to
4516de6
Compare
For non-function values.
To fire for non-function values as well.
6a1b2e1 to
7e0face
Compare
Renamed to FavourLocalOverPrivate and expanded to include non-function private values as well.
Fixed selfCheck violations resulting from these changes.