Skip to content

Partial configuration#811

Open
webwarrior-ws wants to merge 12 commits into
fsprojects:masterfrom
webwarrior-ws:partial-config
Open

Partial configuration#811
webwarrior-ws wants to merge 12 commits into
fsprojects:masterfrom
webwarrior-ws:partial-config

Conversation

@webwarrior-ws

@webwarrior-ws webwarrior-ws commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Treat config file specified using "--lint-config" as partial config (contains only configs that should be overridden; rules not specified in it use default values).

Supersedes #711

Closes #488

Comment thread src/FSharpLint.Console/Program.fs Outdated
@knocte

knocte commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

CI is red.

Also, this PR should change docs: docs/content/how-tos/rule-configuration.md (see the part added in PR489)

Comment thread docs/content/how-tos/rule-configuration.md Outdated
@knocte

knocte commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Let's add one last commit to this PR: a config file that will just contain the typePrefixing rule with mode=Strict. This will be in a directory where SelfCheck runs. The rule will of course also removed from excludedRules var in this same commit.

@knocte

knocte commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

mode=Strict

Sorry, mode=Always

@knocte

knocte commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Ensure ignoring a hint from config works
Add regression test for deeper issue

Wrong order of commits, test should be added first before making it pass.

@webwarrior-ws

Copy link
Copy Markdown
Contributor Author

Ensure ignoring a hint from config works
Add regression test for deeper issue

Wrong order of commits, test should be added first before making it pass.

Reordered the commits. Put tests first.

@knocte

knocte commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

And remove --partial-config flag. Configs will now be always partial.

Given this commit, then I guess PR title needs to be updated.

@webwarrior-ws webwarrior-ws force-pushed the partial-config branch 2 times, most recently from 18c029c to 5360bb6 Compare January 5, 2026 12:29
@webwarrior-ws webwarrior-ws changed the title Added option to use partial config Use partial config Jan 5, 2026
Comment thread fsharplint.json Outdated
Comment thread src/FSharpLint.Console/fsharplint.json Outdated
@webwarrior-ws webwarrior-ws force-pushed the partial-config branch 2 times, most recently from d3cfd45 to c470525 Compare January 5, 2026 13:20
Configuration.combineConfigs defaultConfig partialConfig |> Ok
| Error(_) as err -> err
with
| ex -> Error (string ex)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@webwarrior-ws why are you swallowing the exception here? (BTW, is string ex the same as ex.ToString()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@webwarrior-ws why are you swallowing the exception here? (BTW, is string ex the same as ex.ToString()?

That is what original code was doing (catching exception and putting it into Error). I assume it was done because Configuration.loadConfig can throw an exception but getConfig returns Result, and so is not expected to throw.

string ex is the same as ex.ToString().

@knocte knocte changed the title Use partial config Partial configuration Jan 5, 2026
Implemented partial configs and added tests for combining
configs.
Added command line option "--partial-config" that when
used, treats config file specified using "--lint-config"
as partial config (contains only configs that should be
overriden; rules not specified in it use default values).
Matt Mcveigh and others added 4 commits June 22, 2026 12:03
Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
And remove --partial-config flag. Configs will now be always
partial.
By using camelCase rule name name in config instead of
PascalCase (camelCase is proper rule naming scheme in
fsharplint.json).
To reflect change in how config is applied.
Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
@webwarrior-ws webwarrior-ws force-pushed the partial-config branch 2 times, most recently from c67358a to 6bd7201 Compare June 22, 2026 10:49
webwarrior-ws and others added 4 commits June 22, 2026 13:08
When combining configs, if both base and overriding configs
have Hints config, combine `add` and `ignore` arrays in
HintConfig objects instead of totally overriding base hint
config by overriding one.

Also actually use `ignore` array to filter out available hints
when flattening config. Before, `ignore` was not used at all.

Fixes fsprojects#466
Pass fsharplint.json at solution's root to fsharplint in
selfCheck using --lint-config parameter.
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.

Documentation says nothing about fsharplint.json file

2 participants