Skip to content

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

Merged
merged 3 commits into from
May 14, 2018
Merged

Added Chocolatey Install help #999

merged 3 commits into from
May 14, 2018

Conversation

pauby
Copy link
Contributor

@pauby pauby commented May 14, 2018

PR Summary

Added help to install PSScriptAnalyzer from Chocolatey - https://chocolatey.org/packages/psscriptanalyzer

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • User facing documentation needed
  • Change is not breaking
  • Make sure you've added a new test if existing tests do not effectively test the code changed
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

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.
Copy link
Collaborator

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

Copy link
Collaborator

@bergmeister bergmeister left a 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.

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a 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
```

Copy link
Member

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

@pauby
Copy link
Contributor Author

pauby commented May 14, 2018

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):

@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 Program Files.

Copy link
Collaborator

@bergmeister bergmeister left a 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.

@bergmeister bergmeister merged commit 7408fe2 into PowerShell:development May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants