Skip to content

Provide quickfix functionality - #304

Merged
David Wilson (daviwil) merged 4 commits into
developfrom
kapilmb/code-actions
Dec 5, 2016
Merged

David Wilson (daviwil) merged 4 commits into
developfrom
kapilmb/code-actions

Conversation

@kapilmb

Copy link
Copy Markdown

No description provided.

@msftclas

Hi Kapil Borle (@kapilmb), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Kapil Borle). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

@rkeithhill Keith Hill (rkeithhill) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool! See the one comment below about the rules. Otherwise, I look forward to seeing this in action!

"PSAvoidDefaultValueSwitchParameter",
"PSUseDeclaredVarsMoreThanAssigments",
"PSMisleadingBacktick",
"PSUseDeclaredVarsMoreThanAssigments"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should test the new rule additions. We got a lot of blow-back from the community early on because of lots of green squiggles in folks' scripts. Also, we should add a note in the comments for this section, that any updates here should be also made in the https://github.com/PowerShell/vscode-powershell/blob/master/examples/PSScriptAnalyzerSettings.psd1 file as well.

BTW it is more palatable for folks when the green squiggles underline just the bare minimum of the script as opposed to say entire functions. :-) BTW that also helps with not having "overlapping" script extents for multiple rule violations.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I was testing PSUseDeclaredVarsMoreThanAssigments so I added it there and forgot to remove it. The rule is still a bit noisy and I would rather remove it. Thanks for catching it.

@rkeithhill

Copy link
Copy Markdown
Contributor

Kapil Borle (@kapilmb) Sorry, I wasn't reffering to PSUseDeclaredVarsMoreThanAssigments as that rule has been in there for a while. It was the other rules you added. I'm not saying they need to come out - just that we need to verify they don't cause mass green squiggles. :-) Specifically referring to PSAvoidUsingPlainTextForPassword and PSUseToExportFieldsInManifest. If the green squiggle impact isn't too bad then I say leave them in.

@kapilmb

Copy link
Copy Markdown
Author

Keith Hill (@rkeithhill) Yes, you are right. PSUseDeclaredVarsMoreThanAssignments has been there for a while.

The extents of PSAvoidUsingPlainTextForPassword and PSUseToExportFieldsInManifest do not cause mass green squiggles. However, the extent of PSAvoidUsingCmdletAliases spills over to the entire command. I will fix the extent in the next PSSA release. So, I guess I will just revert the previous commit and after reverting the rule list will look like this:

            "PSUseToExportFieldsInManifest", # provides quickfix
            "PSMisleadingBacktick", # provides quickfix
            "PSAvoidUsingCmdletAliases", # provides quickfix
            "PSUseApprovedVerbs",
            "PSAvoidUsingPlainTextForPassword", # provides quickfix
            "PSReservedCmdletChar",
            "PSReservedParams",
            "PSShouldProcess",
            "PSMissingModuleManifestField",
            "PSAvoidDefaultValueSwitchParameter",
            "PSUseDeclaredVarsMoreThanAssigments"

One thing I would like to note is that the quickfix scenario will not work until the next release of PSSA (which should be soon.)

@kapilmb

Copy link
Copy Markdown
Author

Keith Hill (@rkeithhill) I have reverted the "rule removal" changes.

@rkeithhill

Copy link
Copy Markdown
Contributor

I didn't notice the addition of PSAvoidUsingCmdletAliases before - sorry. You might want to run that by David Wilson (@daviwil). That rule is likely to light up a lot in scripts. :-)

@kapilmb

Copy link
Copy Markdown
Author

David Wilson (@daviwil) rebased on develop branch.

@daviwil
David Wilson (daviwil) merged commit a2bb4ad into develop Dec 5, 2016
@daviwil
David Wilson (daviwil) deleted the kapilmb/code-actions branch December 5, 2016 14:25
@daviwil

Copy link
Copy Markdown
Contributor

Thanks a lot Kapil!

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.

4 participants