Skip to content

Conversation

@webwarrior-ws
Copy link
Contributor

Renamed to FavourLocalOverPrivate and expanded to include non-function private values as well.

Fixed selfCheck violations resulting from these changes.

@greptile-apps
Copy link

greptile-apps bot commented Feb 12, 2026

Greptile Overview

Confidence Score: 2/5

  • This PR contains a critical naming inconsistency that must be fixed before merging
  • The rule's Name field still references "FavourNestedFunctions" instead of "FavourLocalOverPrivate", creating an inconsistency between the rule identifier and display name. This bug would cause confusion and potential issues in tooling that relies on the rule name. The rest of the PR is well-implemented with comprehensive tests and systematic self-check fixes across the codebase.
  • src/FSharpLint.Core/Rules/Conventions/FavourLocalOverPrivate.fs requires immediate attention to fix the rule name

Important Files Changed

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
Loading

Copy link

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

@@ -149,7 +151,7 @@ let runner (args: AstNodeRuleParams) =

let rule =
{ Name = "FavourNestedFunctions"
Copy link

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"

Suggested change
{ Name = "FavourNestedFunctions"
{ Name = "FavourLocalOverPrivate"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

## Cause

Prefer using local (nested) functions over private module-level functions.
Prefer using local (nested) functions and values over private module-level functions/value.
Copy link

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)

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@webwarrior-ws webwarrior-ws force-pushed the favour-nested-functions-rename branch from 720744a to 4516de6 Compare February 12, 2026 11:33
@webwarrior-ws webwarrior-ws force-pushed the favour-nested-functions-rename branch from 6a1b2e1 to 7e0face Compare February 12, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant