Skip to content
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

Merge Branches #407

Merged
merged 4 commits into from
Dec 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Engine/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ public bool PositionalParameterUsed(CommandAst cmdAst, bool moreThanThreePositio
arguments += 1;
}

if (moreThanThreePositional && arguments < 3)
// if we are only checking for 3 or more positional parameters, check that arguments < parameters + 3
if (moreThanThreePositional && (arguments - parameters) < 3)
{
return false;
}
Expand Down
9 changes: 7 additions & 2 deletions Engine/ScriptAnalyzerEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
<None Include="PSScriptAnalyzer.psd1" />
<None Include="ScriptAnalyzer.format.ps1xml" />
<None Include="ScriptAnalyzer.types.ps1xml" />
<None Include="Settings\CmdletDesign.psd1" />
<None Include="Settings\DSC.psd1" />
<None Include="Settings\ScriptFunctions.psd1" />
<None Include="Settings\ScriptingStyle.psd1" />
<None Include="Settings\ScriptSecurity.psd1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Strings.resx">
Expand All @@ -105,8 +110,8 @@
if not exist "$(SolutionDir)$(SolutionName)" mkdir "$(SolutionDir)$(SolutionName)"
copy /y "$(ProjectDir)*.ps1xml" "$(SolutionDir)$(SolutionName)"
copy /y "$(ProjectDir)*.psd1" "$(SolutionDir)$(SolutionName)"
if not exist "$(SolutionDir)$(SolutionName)\Configurations" mkdir "$(SolutionDir)$(SolutionName)\Configurations"
copy /y "$(ProjectDir)Configurations\*.psd1" "$(SolutionDir)$(SolutionName)\Configurations"
if not exist "$(SolutionDir)$(SolutionName)\Settings" mkdir "$(SolutionDir)$(SolutionName)\Settings"
copy /y "$(ProjectDir)Settings\*.psd1" "$(SolutionDir)$(SolutionName)\Settings"
copy /y "$(TargetPath)" "$(SolutionDir)$(SolutionName)"
if not exist "$(SolutionDir)$(SolutionName)\en-US" mkdir "$(SolutionDir)$(SolutionName)\en-US"
copy /y "$(ProjectDir)about_*.help.txt" "$(SolutionDir)$(SolutionName)\en-US"
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Announcements
##### ISE Add-On for ScriptAnalyzer is available in PowerShell Gallery!
(https://www.powershellgallery.com/packages/ISEScriptAnalyzerAddOn/)

##### Visual Studio Code now has PowerShell language support with ScriptAnalyzer integration
(http://blogs.msdn.com/b/powershell/archive/2015/11/17/announcing-windows-powershell-for-visual-studio-code-and-more.aspx)

=============

##### ScriptAnalyzer community meeting schedule:
Expand Down
4 changes: 3 additions & 1 deletion Tests/Rules/AvoidPositionalParametersNoViolations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Get-Content Test
Get-ChildItem Tests
Write-Output "I don't want to use positional parameters"
Split-Path "RandomPath" -Leaf
Get-Process | ForEach-Object {Write-Host $_.name -foregroundcolor cyan}
Get-Process | ForEach-Object {Write-Host $_.name -foregroundcolor cyan}

$srvc = Get-WmiObject Win32_Service -ComputerName $computername -Filter "name=""$service""" -Credential $credential