Expand and rename FavourNestedFunctions rule#844
Open
webwarrior-ws wants to merge 4 commits intofsprojects:masterfrom
Open
Expand and rename FavourNestedFunctions rule#844webwarrior-ws wants to merge 4 commits intofsprojects:masterfrom
webwarrior-ws wants to merge 4 commits intofsprojects:masterfrom
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
| @@ -149,7 +151,7 @@ let runner (args: AstNodeRuleParams) = | |||
|
|
|||
| let rule = | |||
| { Name = "FavourNestedFunctions" | |||
There was a problem hiding this comment.
rule Name field still references old name "FavourNestedFunctions" instead of "FavourLocalOverPrivate"
Suggested change
| { Name = "FavourNestedFunctions" | |
| { Name = "FavourLocalOverPrivate" |
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.
"functions/value" should be "functions/values" (plural)
Suggested change
| 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. |
720744a to
4516de6
Compare
For non-function values.
To fire for non-function values as well.
6a1b2e1 to
7e0face
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renamed to FavourLocalOverPrivate and expanded to include non-function private values as well.
Fixed selfCheck violations resulting from these changes.