-
Notifications
You must be signed in to change notification settings - Fork 395
Added Chocolatey Install help #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
README.md
Outdated
@@ -87,6 +87,17 @@ Exit | |||
|
|||
```docker run -it microsoft/powershell:latest pwsh -c "Install-Module PSScriptAnalyzer -Force; Invoke-ScriptAnalyzer -ScriptDefinition 'gci'"``` | |||
|
|||
### From Chocolatey | |||
|
|||
If you prefer to manage PSScritpAnalyzer as a Windows package, you can use [Chocolatey](https://chocolatey.org) to install it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: PSScritpAnalyzer
should be PSScriptAnalyzer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thank you very much for adding chocolatey support, this should come in very handy for pre-releases (which can be a lot of work on the MS side due to internal processes).
Maybe we should add a remark that chocolatey packages are only supported by the community (because MS has a formal support agreement for the version that is published on the PSGallery). Also, a direct link to the PSSA choco page here could be useful.
I am happy with it but would like to inform and get approval from the MS side before merging the PR. cc @SteveL-MSFT @JamesWTruher
When I tried to install it locally, it required admin privileges (because it installs in the system scope in C:\Program Files\WindowsPowerShell\Modules
), the error message was not 100% clear and could potentially be improved in the future (otherwise should be documented here):
choco install psscriptanalyzer
This is try 1/3. Retrying after 300 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
This is try 2/3. Retrying after 400 milliseconds.
Error converted to warning:
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
Maximum tries of 3 reached. Throwing error.
Cannot create directory "C:\ProgramData\chocolatey\config". Error was:
System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\chocolatey\config' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass64.<create_directory>b__63()
at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0()
at chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurationMilliseconds, Int32 increaseRetryByMilliseconds, Boolean isSilent)
at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory(String directoryPath)
at chocolatey.infrastructure.filesystem.DotNetFileSystem.create_directory_if_not_exists(String directoryPath, Boolean ignoreError)
Access to the path 'C:\ProgramData\chocolatey\config' is denied.
p.s. PSSA 1.17.0 is going to release soon the next days.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bergmeister I agree it's important to differentiate the packages published by Msft and the ones by the community. I think adding a note should be sufficient. cc @joeyaiello
```powershell | ||
choco install psscriptanalyzer | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note like:
Note: the PSScriptAnalyzer Chocolatey package is provided and supported by the community
@bergmeister Chocolatey needs to run in an elevated session. Its just how it operates. The error you see is what happens when you don't run it elevated and is an error direct from Chocolatey and not the package. Because Chocolatey runs in an elevated session the best place to put the module is in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK since it is clear now that choco is only community supported. Thanks for your patience and edits.
PR Summary
Added help to install PSScriptAnalyzer from Chocolatey - https://chocolatey.org/packages/psscriptanalyzer
PR Checklist
WIP:
to the beginning of the title and remove the prefix when the PR is ready