FSharpLint icon indicating copy to clipboard operation
FSharpLint copied to clipboard

DRAFT: add fix command line option and fix --check

Open parhamsaremi opened this issue 3 years ago • 9 comments

  • add fix command option
  • add fix --check option for not altering the code

parhamsaremi avatar Jul 28 '22 13:07 parhamsaremi

From the 3 commits existing in this PR, is there any reason to separate commit 1st and 2nd?

knocte avatar Aug 01 '22 08:08 knocte

Ummm I remember the first commit being only fixes to what janus wrote. the second commit is what you tasked me to do :thinking:

parhamsaremi avatar Aug 01 '22 08:08 parhamsaremi

the second commit is what you tasked me to do 🤔

Separation is not needed just because one commit is from one author and another commit from another. (Besides, did you keep his code in the end or you rewrote from scratch?). If there's a need to squash 2 commits from different authors, you just use the tag Co-authored-by: Jon Doe <[email protected]> at the end of the commit message.

knocte avatar Aug 01 '22 08:08 knocte

the second commit is what you tasked me to do thinking

Separation is not needed just because one commit is from one author and another commit from another. (Besides, did you keep his code in the end or you rewrote from scratch?). If there's a need to squash 2 commits from different authors, you just use the tag Co-authored-by: Jon Doe <[email protected]> at the end of the commit message.

In the end, I used his code. I think I should merge commits then :thinking:

parhamsaremi avatar Aug 01 '22 08:08 parhamsaremi

In the end, I used his code. I think I should merge commits then

Sure let's do it. BTW let's rather use the word "squash", not "merge", to not confuse with the "git merge" command (which we should almost never use btw) :)

knocte avatar Aug 01 '22 08:08 knocte

In the end, I used his code. I think I should merge commits then

Sure let's do it. BTW let's rather use the word "squash", not "merge", to not confuse with the "git merge" command (which we should almost never use btw) :)

yeah you are right :D

parhamsaremi avatar Aug 01 '22 08:08 parhamsaremi

Co-authored-by: parhamsaremi [email protected]

Nit, the bit before the e-mail address should be in Name Surname format, not username. Unless you have anything against that?

knocte avatar Aug 01 '22 09:08 knocte

Co-authored-by: parhamsaremi [email protected]

Nit, the bit before the e-mail address should be in Name Surname format, not username. Unless you have anything against that?

hmmmm OK sure thinking I don't have anything against it, I just preferred my username, but since my username is my Name and Surname I don't see any problem switching.

parhamsaremi avatar Aug 03 '22 09:08 parhamsaremi

I've looked closely at SuggestedFix type. And it has 2 fields that are supposed to serve the same purpose:

/// Text to be replaced.
FromText

and

/// Location of the text to be replaced.
FromRange

It's not stated anywhere how these fields are supposed to be used. In practice, TestRuleBase.ApplyQuickFix uses only FromRange. This PR uses only FromText (that's buggy because there might be other occurrences of FromText in source that are not meant to be replaced).

webwarrior-ws avatar Dec 28 '23 09:12 webwarrior-ws