Skip to content

Conversation

@webwarrior-ws
Copy link
Contributor

@webwarrior-ws webwarrior-ws commented Jul 28, 2025

Also removed FromText property of SuggestedFix as it duplicates FromRange functionality and is not actually used anywhere.

@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch from a583792 to 3924085 Compare July 28, 2025 12:03
@webwarrior-ws webwarrior-ws reopened this Jul 28, 2025
@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch 3 times, most recently from 3c64772 to 7880339 Compare July 28, 2025 13:22
@webwarrior-ws webwarrior-ws changed the title Core(Framework,Rules): SuggestedFix refactoring Add fix command-line to apply quickfixes and unit test Jul 28, 2025
@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch 3 times, most recently from 14a265e to 27342d3 Compare July 29, 2025 08:43
@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch 2 times, most recently from df6e26c to bc9e328 Compare July 29, 2025 10:06

let handleFixResult (ruleName: string) = function
| LintResult.Success warnings ->
String.Format(Resources.GetString "ConsoleApplyingSuggestedFixFile", ruleName) |> output.WriteInfo
Copy link
Collaborator

Choose a reason for hiding this comment

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

@webwarrior-ws ruleName? this is wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What should the parameter be then?

Copy link
Collaborator

@knocte knocte Jul 29, 2025

Choose a reason for hiding this comment

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

Same as what happens when printing "Linting {0}", obviously

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to print notification for every warning, with file name as parameter. There may be several warnings per file though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There may be several warnings per file though.

Then this was wrong, it should only print once per file. (And it was also wrong even if not adding the $0 element.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Because I guess that "Linting {0}" only gets printed once per file/project/solution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The function is not called once per file, but once per rule.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not talking about what the code does now, but what the code should do. And it should do the same as Linting{0}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the logic. Now it is what you meant @knocte ?

@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch 2 times, most recently from a82fe7c to 8beb004 Compare July 29, 2025 11:16
@knocte knocte changed the title Add fix command-line to apply quickfixes and unit test Add 'fix' command to apply fixes (and unit test) Jul 30, 2025
@knocte
Copy link
Collaborator

knocte commented Aug 13, 2025

@webwarrior-ws let's rebase this PR when you have time (but beware of recent push from me, to include the last commit; so git pull --rebase first please)

@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch from 2e3a715 to 918d878 Compare August 13, 2025 10:35
@knocte
Copy link
Collaborator

knocte commented Aug 13, 2025

@webwarrior-ws sorry this needs another rebase

@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch 3 times, most recently from 6efbad1 to 7a893d9 Compare August 14, 2025 10:10
@webwarrior-ws
Copy link
Contributor Author

@webwarrior-ws sorry this needs another rebase

Rebased

@knocte
Copy link
Collaborator

knocte commented Jan 6, 2026

I'm going to remove commit c0a3ab1 from this PR because I moved that change to PR793.

@knocte knocte force-pushed the remove-suggestedfix-fromtext branch from c0a3ab1 to 7a893d9 Compare January 6, 2026 04:41
else
FileType.Source

// can't extract inner functions because they modify exitCode variable
Copy link
Collaborator

Choose a reason for hiding this comment

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

@webwarrior-ws this reason shouldn't apply anymore after I merged PR813 in master, so let's rebase and double check

Copy link
Collaborator

@knocte knocte Jan 6, 2026

Choose a reason for hiding this comment

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

(this PR should now introduce a new function that doesn't use a mutable exitCode var, AFAIU)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored code to not use mutable exitCode and extracted inner functions.

Copy link
Collaborator

@knocte knocte Jan 6, 2026

Choose a reason for hiding this comment

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

I didn't ask you to remove mutable var from existing lint() function; what I said is that the new function that should be implemented (in this case, applySuggestedFix), should not use a mutable exitCode. Also:

  • why did you rename lint() to applyLint()? doesn't seem necessary at all
  • a function named "linting()"? function names should use infinitive, not gerund

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These names are probably not from me. But I changed applyLint back to lint and linting to performlinting.

Copy link
Collaborator

Choose a reason for hiding this comment

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

performlinting? man, that's neither PascalCase nor camelCase, what notation is that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actual name in the source is performLinting.

@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch from 7a893d9 to 396295a Compare January 6, 2026 11:33
@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch from 85b512e to 1dc6bf2 Compare January 6, 2026 12:20
output.WriteError $"Lint failed while analysing %s{target}.{Environment.NewLine}Failed with: %s{exn.Message}{Environment.NewLine}Stack trace: {exn.StackTrace}"
ExitCode.Failure

let private lint (lintArgs: ParseResults<LintArgs>) (output: Output.IOutput) (toolsPath:Ionide.ProjInfo.Types.ToolsPath) : ExitCode =
Copy link
Collaborator

Choose a reason for hiding this comment

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

@webwarrior-ws the previous version of this func had each param in its own line, why break that formatting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made each pram be on its own line.

@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch 2 times, most recently from d05f6e8 to aa35ca9 Compare January 7, 2026 09:15
webwarrior-ws and others added 2 commits January 7, 2026 10:15
Removed FromText property of SuggestedFix as it duplicates
FromRange functionality and is not actually used anywhere.
Co-authored-by: Parham Saremi <parhaamsaremi@gmail.com>
Co-authored-by: webwarrior-ws <reg@webwarrior.ws>
@webwarrior-ws webwarrior-ws force-pushed the remove-suggestedfix-fromtext branch from aa35ca9 to c3b0b9a Compare January 7, 2026 09:23
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.

3 participants