question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PSAvoidUsingDoubleQuotesForConstantString doesn't work

See original GitHub issue

System Details

System Details Output

### VSCode version: 1.53.2 622cb03f7e070a9670c94bae1a45d78d7181fbd4 x64

### VSCode extensions:
bradlc.vscode-tailwindcss@0.5.9
dbaeumer.vscode-eslint@2.1.14
ecmel.vscode-html-css@1.10.2
esbenp.prettier-vscode@5.9.2
ms-azuretools.vscode-docker@1.10.0
ms-vscode-remote.remote-containers@0.158.0
ms-vscode.cpptools@1.2.1
ms-vscode.powershell@2020.6.0
ms-vscode.vscode-typescript-tslint-plugin@1.3.3
ms-vsliveshare.vsliveshare@1.0.3784
octref.vetur@0.32.0
platformio.platformio-ide@2.2.1


### PSES version: 2.2.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.1.2
PSEdition                      Core
GitCommitId                    7.1.2
OS                             Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

I am experiencing a problem with PSAvoidUsingDoubleQuotesForConstantString not working.

Expected Behaviour

It should print

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSAvoidUsingDoubleQuotesForConstant Information  Test.ps1   1     Use single quotes when a string is constant.
String

Actual Behaviour

No problem is reported.

Also, running:

Invoke-ScriptAnalyzer -Path Test.ps1 -Settings PSScriptAnalyzerSettings.psd1

or

Invoke-ScriptAnalyzer -Path Test.ps1 -Settings PSScriptAnalyzerSettings.psd1 -Severity Information

doesn’t print anything.

Attached Logs

Here are the files: 1614203961.zip.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

2reactions
rjmholtcommented, Feb 24, 2021

But I completely restarted Visual Studio Code before. Shouldn’t that have been enough?

After you installed the new module in iTerm, a reload of the Integrated Console will pick that up. That’s the difference.

Also, running gmo PSScriptAnalyzer doesn’t print anything now. Do you know why?

The module won’t be loaded until you import it or autoload it by running a command from it. Running Invoke-ScriptAnalyzer autoloaded it, so then gmo succeeded.

1reaction
revoltercommented, Feb 24, 2021

I ran the Invoke-ScriptAnalyzer and then gmo PSScriptAnalyzer again and now it does print

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     1.19.1                PSScriptAnalyzer                    {Get-ScriptAnalyzerRule, Invoke-Formatter, Invoke-ScriptAnalyzer}

And yes, the problem is now reported, thanks for the help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code - Useful Extensions : r/PowerShell - Reddit
VSCode Icons: This extension will add icons to the side navigation bar not only for file types but based on folder names as...
Read more >
Powershell - Gamedev Guide - ikrima.dev
can run commands stored in variables and represented by strings. does not parse or interpret command parameters. PowerShell
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found