-
Notifications
You must be signed in to change notification settings - Fork 7.8k
PSScriptAnalyzer fixes by category #4261
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
Changes from 2 commits
7dd62e8
9d6e3aa
b3f8123
2615beb
cb6cc12
f07469c
02abf17
3302a02
ceb9286
de488ed
7985744
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ Import-Module $PSScriptRoot/Apache/Apache.psm1 | |
|
||
#list Apache Modules | ||
Write-Host -Foreground Blue "Get installed Apache Modules like *proxy* and Sort by name" | ||
Get-ApacheModule |Where {$_.ModuleName -like "*proxy*"}|Sort-Object ModuleName | Out-Host | ||
Get-ApacheModule | Where-Object {$_.ModuleName -like "*proxy*"}|Sort-Object ModuleName | Out-Host | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add spaces in |
||
|
||
#Graceful restart of Apache | ||
Write-host -Foreground Blue "Restart Apache Server gracefully" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ Removing the aliases exposes the native command experience to the PowerShell use | |
|
||
Currently, PowerShell only does wildcard expansion (globbing) for built-in cmdlets on Windows, and for external commands or binaries as well as cmdlets on Linux. | ||
This means that a command like `ls *.txt` will fail because the asterisk will not be expanded to match file names. | ||
You can work around this by doing `ls (gci *.txt | % name)` or, more simply, `gci *.txt` using the PowerShell built-in equivalent to `ls`. | ||
You can work around this by doing `ls (gci *.txt | ForEach-Object name)` or, more simply, `gci *.txt` using the PowerShell built-in equivalent to `ls`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we discussed, this change is not necessary. This is a one-line script to be used interactively. It's OK to use aliases to keep it concise. |
||
|
||
See [#954](https://github.com/PowerShell/PowerShell/issues/954) to give us feedback on how to improve the globbing experience on Linux/macOS. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2138,9 +2138,9 @@ private static ConcurrentDictionary<string, string> InitializeStrongNameDictiona | |
// 10,000 iterations of this method takes ~800 ms for a string array, and ~ 200ms for the dictionary | ||
// | ||
// $dlls = ((dir c:\windows\Microsoft.NET\Framework\ -fi *.dll -rec) + (dir c:\windows\assembly -fi *.dll -rec)) + (dir C:\Windows\Microsoft.NET\assembly) | | ||
// % { [Reflection.Assembly]::LoadFrom($_.FullName) } | ||
// ForEach-Object { [Reflection.Assembly]::LoadFrom($_.FullName) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes probably should be reverted, as |
||
// "var strongNames = new ConcurrentDictionary<string, string>(4, $($dlls.Count), StringComparer.OrdinalIgnoreCase);" > c:\temp\strongnames.txt | ||
// $dlls | Sort-Object -u { $_.GetName().Name} | % { 'strongNames["{0}"] = "{1}";' -f $_.FullName.Split(",", 2)[0], $_.FullName >> c:\temp\strongnames.txt } | ||
// $dlls | Sort-Object -u { $_.GetName().Name} | ForEach-Object { 'strongNames["{0}"] = "{1}";' -f $_.FullName.Split(",", 2)[0], $_.FullName >> c:\temp\strongnames.txt } | ||
|
||
// The default concurrent level is 4. We use the default level. | ||
var strongNames = new ConcurrentDictionary<string, string>(4, 744, StringComparer.OrdinalIgnoreCase); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1646,7 +1646,7 @@ internal static char SetDelimiter(PSCmdlet Cmdlet, string ParameterSetName, char | |
if (UseCulture == true) | ||
{ | ||
// ListSeparator is apparently always a character even though the property returns a string, checked via: | ||
// [CultureInfo]::GetCultures("AllCultures") | % { ([CultureInfo]($_.Name)).TextInfo.ListSeparator } | ? Length -ne 1 | ||
// [CultureInfo]::GetCultures("AllCultures") | ForEach-Object { ([CultureInfo]($_.Name)).TextInfo.ListSeparator } | Where-Object Length -ne 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
Delimiter = CultureInfo.CurrentCulture.TextInfo.ListSeparator[0]; | ||
} | ||
break; A3D6 | ||
|
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.
Please add a space before Where-Object and after
"tests.ps1"}