Skip to content

Commit 3a3ff48

Browse files
authored
Merge pull request #1018 from PowerShell/development
Merge changes of 1.17.1 (including 1.17.0) into Master
2 parents 521f41c + 617476b commit 3a3ff48

File tree

278 files changed

+24197
-9681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+24197
-9681
lines changed

.build.ps1

+14-44
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
param(
2-
[ValidateSet("net451", "netstandard1.6")]
2+
[ValidateSet("net451", "netstandard2.0")]
33
[string]$Framework = "net451",
44

5-
[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
5+
[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release", "PSv4Release")]
66
[string]$Configuration = "Debug"
77
)
88

99
# todo remove aliases
1010
# todo make each project have its own build script
1111

12-
$resourceScript = Join-Path $BuildRoot "New-StronglyTypedCsFileForResx.ps1"
1312
$outPath = "$BuildRoot/out"
1413
$modulePath = "$outPath/PSScriptAnalyzer"
1514

@@ -18,9 +17,9 @@ if ($BuildTask -eq "release") {
1817
$buildData = @{
1918
Frameworks = @{
2019
"net451" = @{
21-
Configuration = @('Release', "PSV3Release")
20+
Configuration = @('Release', "PSV3Release", "PSv4Release")
2221
}
23-
"netstandard1.6" = @{
22+
"netstandard2.0" = @{
2423
Configuration = @('Release')
2524
}
2625
}
@@ -39,20 +38,20 @@ function CreateIfNotExists([string] $folderPath) {
3938
}
4039

4140
function Get-BuildInputs($project) {
42-
pushd $buildRoot/$project
43-
gci -Filter *.cs
44-
gci -Directory -Exclude obj, bin | gci -Filter *.cs -Recurse
45-
popd
41+
Push-Location $buildRoot/$project
42+
Get-ChildItem -Filter *.cs
43+
Get-ChildItem -Directory -Exclude obj, bin | Get-ChildItem -Filter *.cs -Recurse
44+
Pop-Location
4645
}
4746

4847
function Get-BuildOutputs($project) {
4948
$bin = "$buildRoot/$project/bin/$Configuration/$Framework"
5049
$obj = "$buildRoot/$project/obj/$Configuration/$Framework"
5150
if (Test-Path $bin) {
52-
gci $bin -Recurse
51+
Get-ChildItem $bin -Recurse
5352
}
5453
if (Test-Path $obj) {
55-
gci $obj -Recurse
54+
Get-ChildItem $obj -Recurse
5655
}
5756
}
5857

@@ -79,14 +78,6 @@ function Get-BuildTaskParams($project) {
7978
$taskParams
8079
}
8180

82-
function Get-RestoreTaskParams($project) {
83-
@{
84-
Inputs = "$BuildRoot/$project/project.json"
85-
Outputs = "$BuildRoot/$project/project.lock.json"
86-
Jobs = {dotnet restore}
87-
}
88-
}
89-
9081
function Get-CleanTaskParams($project) {
9182
@{
9283
Jobs = {
@@ -109,20 +100,6 @@ function Get-TestTaskParam($project) {
109100
}
110101
}
111102

112-
function Get-ResourceTaskParam($project) {
113-
@{
114-
Inputs = "$project/Strings.resx"
115-
Outputs = "$project/Strings.cs"
116-
Data = $project
117-
Jobs = {
118-
Push-Location $BuildRoot
119-
& $resourceScript $Task.Data
120-
Pop-Location
121-
}
122-
Before = "$project/build"
123-
}
124-
}
125-
126103
function Add-ProjectTask([string]$project, [string]$taskName, [hashtable]$taskParams, [string]$pathPrefix = $buildRoot) {
127104
$jobs = [scriptblock]::Create(@"
128105
pushd $pathPrefix/$project
@@ -136,16 +113,12 @@ popd
136113

137114
$projects = @("engine", "rules")
138115
$projects | ForEach-Object {
139-
Add-ProjectTask $_ buildResource (Get-ResourceTaskParam $_)
140116
Add-ProjectTask $_ build (Get-BuildTaskParams $_)
141-
Add-ProjectTask $_ restore (Get-RestoreTaskParams $_)
142117
Add-ProjectTask $_ clean (Get-CleanTaskParams $_)
143118
Add-ProjectTask $_ test (Get-TestTaskParam $_) "$BuildRoot/tests"
144119
}
145120

146-
task buildResource -Before build "engine/buildResource", "rules/buildResource"
147121
task build "engine/build", "rules/build"
148-
task restore "engine/restore", "rules/restore"
149122
task clean "engine/clean", "rules/clean"
150123
task test "engine/test", "rules/test"
151124

@@ -172,7 +145,7 @@ task createModule {
172145
$itemsToCopyBinaries = @("$solutionDir\Engine\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll",
173146
"$solutionDir\Rules\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll")
174147

175-
if ($Framework -eq "netstandard1.6") {
148+
if ($Framework -eq "netstandard2.0") {
176149
$destinationDirBinaries = "$destinationDir\coreclr"
177150
}
178151
elseif ($Configuration -match 'PSv3') {
@@ -215,14 +188,11 @@ task buildDocs -Inputs $bdInputs -Outputs $bdOutputs {
215188
$markdownDocsPath = Join-Path $docsPath 'markdown'
216189
CreateIfNotExists($outputDocsPath)
217190

218-
# copy the about help file
219-
Copy-Item -Path $docsPath\about_PSScriptAnalyzer.help.txt -Destination $outputDocsPath -Force
220-
221191
# Build documentation using platyPS
222-
if ((Get-Module PlatyPS -ListAvailable) -eq $null) {
223-
throw "Cannot find PlatyPS. Please install it from https://www.powershellgallery.com."
192+
if ($null -eq (Get-Module platyPS -ListAvailable -Verbose:$verbosity | Where-Object { $_.Version -ge 0.9 })) {
193+
throw "Cannot find platyPS of version greater or equal to 0.9. Please install it from https://www.powershellgallery.com/packages/platyPS/ using e.g. the following command: Install-Module platyPS"
224194
}
225-
Import-Module PlatyPS
195+
Import-Module platyPS
226196
if (-not (Test-Path $markdownDocsPath -Verbose:$verbosity)) {
227197
throw "Cannot find markdown documentation folder."
228198
}

.github/ISSUE_TEMPLATE/Bug_report.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Bug report 🐛
3+
about: Report errors or unexpected behavior 🤔
4+
5+
---
6+
7+
Before submitting a bug report:
8+
9+
- Make sure you are able to repro it on the latest released version
10+
- Perform a quick search for existing issues to check if this bug has already been reported
11+
12+
Steps to reproduce
13+
------------------
14+
15+
```PowerShell
16+
17+
```
18+
19+
Expected behavior
20+
-----------------
21+
22+
```none
23+
24+
```
25+
26+
Actual behavior
27+
---------------
28+
29+
```none
30+
31+
```
32+
33+
If an unexpected error was thrown then please report the full error details using e.g. `$error[0] | Select-Object *`
34+
35+
Environment data
36+
----------------
37+
38+
<!-- Provide the output of the following 2 commands -->
39+
40+
```PowerShell
41+
> $PSVersionTable
42+
43+
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
44+
45+
```
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Feature request/idea 🚀
3+
about: Suggest a new feature or improvement (this does not mean you have to implement it)
4+
5+
---
6+
7+
**Summary of the new feature**
8+
9+
A clear and concise description of what the problem is that the new feature would solve.
10+
Try formulating it in user story style (if applicable):
11+
'As a user I want X so that Y.' with X being the being the action and Y being the value of the action.
12+
13+
**Proposed technical implementation details (optional)**
14+
15+
A clear and concise description of what you want to happen.
16+
17+
**What is the latest version of PSScriptAnalyzer at the point of writing**
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Support Question ❓
3+
about: If you have a question, you can try asking in the scriptanalyzer channel of the international PowerShell Slack channel first.
4+
5+
---
6+
7+
* Slack Community Chat: https://powershell.slack.com (you can sign-up at http://slack.poshcode.org/ for an invite)
8+
* Also have a look at the `RoleDocumentation` folder for more information on each rule:
9+
https://github.com/PowerShell/PSScriptAnalyzer/tree/development/RuleDocumentation

.github/PULL_REQUEST_TEMPLATE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## PR Summary
2+
3+
<!-- summarize your PR between here and the checklist -->
4+
5+
## PR Checklist
6+
7+
Note: Tick the boxes below that apply to this pull request by putting an `x` between the square brackets. Please mark anything not applicable to this PR `NA`.
8+
9+
- [ ] PR has a meaningful title
10+
- [ ] Use the present tense and imperative mood when describing your changes
11+
- [ ] Summarized changes
12+
- [ ] User facing documentation needed
13+
- [ ] Change is not breaking
14+
- [ ] Make sure you've added a new test if existing tests do not effectively test the code changed
15+
- [ ] This PR is ready to merge and is not work in progress
16+
- 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

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TestResult.xml
3838
[Rr]eleasePS/
3939
dlldata.c
4040

41-
# DNX
41+
# .Net Core CLI
4242
project.lock.json
4343
artifacts/
4444

.vscode/launch.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
5+
{
6+
"name": ".NET Core Launch (console)",
7+
"type": "coreclr",
8+
"request": "launch",
9+
"preLaunchTask": "build",
10+
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
11+
"args": [],
12+
"cwd": "${workspaceRoot}",
13+
"externalConsole": false,
14+
"stopAtEntry": false,
15+
"internalConsoleOptions": "openOnSessionStart"
16+
},
17+
{
18+
"name": ".NET Core Attach",
19+
"type": "coreclr",
20+
"request": "attach",
21+
"processId": "${command:pickProcess}"
22+
},
23+
{
24+
"name": ".NET Full Attach",
25+
"type": "clr",
26+
"request": "attach",
27+
"processId": "${command:pickProcess}"
28+
}
29+
]
30+
}

CHANGELOG.MD

+97-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,100 @@
1-
## [1.16.0](https://github.com/PowerShell/PSScriptAnalyzer/tree/1.16.0) - 2017-08-15
1+
## [1.17.1](https://github.com/PowerShell/PSScriptAnalyzer/tree/1.17.1) - 2018-06-06
2+
3+
### Fixes
4+
5+
- Fix signing so `PSScriptAnalyzer` can be installed without the `-SkipPublisherCheck` switch (#1014)
6+
- Issues with rule `PSAvoidAssignmentToAutomaticVariable` were fixed (#1007, #1013, #1014)
7+
- Rule documentation update and cleanup (#988)
8+
9+
## [1.17.0](https://github.com/PowerShell/PSScriptAnalyzer/tree/1.17.0) - 2018-06-02
10+
11+
### New Parameters
12+
13+
- Add `-ReportSummary` switch (#895) (Thanks @StingyJack! for the base work that got finalized by @bergmeister)
14+
- Add `-EnableExit` switch to Invoke-ScriptAnalyzer for exit and return exit code for CI purposes (#842) (by @bergmeister)
15+
- Add `-Fix` switch to `-Path` parameter set of `Invoke-ScriptAnalyzer` (#817, #852) (by @bergmeister)
16+
17+
### New Rules and Warnings
18+
19+
- Warn when 'Get-' prefix was omitted in `AvoidAlias` rule. (#927) (by @bergmeister)
20+
- `AvoidAssignmentToAutomaticVariable`. NB: Currently only warns against read-only automatic variables (#864, #917) (by @bergmeister)
21+
- `PossibleIncorrectUsageOfRedirectionOperator` and `PossibleIncorrectUsageOfAssignmentOperator`. (#859, #881) (by @bergmeister)
22+
- Add PSAvoidTrailingWhitespace rule (#820) (Thanks @dlwyatt!)
23+
24+
### Fixes and Improvements
25+
26+
- AvoidDefaultValueForMandatoryParameter triggers when the field has specification: Mandatory=value and value!=0 (#969) (by @kalgiz)
27+
- Do not trigger UseDeclaredVarsMoreThanAssignment for variables being used via Get-Variable (#925) (by @bergmeister)
28+
- Make UseDeclaredVarsMoreThanAssignments not flag drive qualified variables (#958) (by @bergmeister)
29+
- Fix PSUseDeclaredVarsMoreThanAssignments to not give false positives when using += operator (#935) (by @bergmeister)
30+
- Tweak UseConsistentWhiteSpace formatting rule to exclude first unary operator when being used in argument (#949) (by @bergmeister)
31+
- Allow -Setting parameter to resolve setting presets as well when object is still a PSObject in BeginProcessing (#928) (by @bergmeister)
32+
- Add macos detection to New-CommandDataFile (#947) (Thanks @GavinEke!)
33+
- Fix PlaceOpenBrace rule correction to take comment at the end of line into account (#929) (by @bergmeister)
34+
- Do not trigger UseShouldProcessForStateChangingFunctions rule for workflows (#923) (by @bergmeister)
35+
- Fix parsing the -Settings object as a path when the path object originates from an expression (#915) (by @bergmeister)
36+
- Allow relative settings path (#909) (by @bergmeister)
37+
- Fix AvoidDefaultValueForMandatoryParameter documentation, rule and tests (#907) (by @bergmeister)
38+
- Fix NullReferenceException in AlignAssignmentStatement rule when CheckHashtable is enabled (#838) (by @bergmeister)
39+
- Fix FixPSUseDeclaredVarsMoreThanAssignments to also detect variables that are strongly typed (#837) (by @bergmeister)
40+
- Fix PSUseDeclaredVarsMoreThanAssignments when variable is assigned more than once to still give a warning (#836) (by @bergmeister)
41+
42+
### Engine, Building and Testing
43+
44+
- Support `SuggestedCorrections` property on DiagnosticRecord for script based rules #1000 (by @bergmeister)
45+
- Add CommandData files of PowerShell Core 6.0.2 for Windows/Linux/macOS and WMF3/4 that are used by UseCompatibleCmdlets rule (#954) (by @bergmeister)
46+
- If no path is found or when using the -ScriptDefinition parameter set, default to the current location for the directory search of the implicit settings file (#979) (by @bergmeister)
47+
- Allow TypeNotFound parser errors (#957) (by @bergmeister)
48+
- Fix release script by building also for v3 and misc. improvements (#996) (by @bergmeister)
49+
- Scripts needed to build and sign PSSA via MS VSTS so it can be published in the gallery (#983) (by @JamesWTruher)
50+
- Move common test code into AppVeyor module (#961) (by @bergmeister)
51+
- Remove extraneous import-module commands in tests (#962) (by @JamesWTruher)
52+
- Upgrade 'System.Automation.Management' NuGet package of version 6.0.0-alpha13 to version 6.0.2 from powershell-core feed, which requires upgrade to netstandard2.0. NB: This highly improved behavior on WMF3 but also means that the latest patched version (6.0.2) of PowerShell Core should be used. (#919) by @bergmeister)
53+
- Add Ubuntu Build+Test to Appveyor CI (#940) (by @bergmeister)
54+
- Add PowerShell Core Build+Test to Appveyor CI (#939) (by @bergmeister)
55+
- Update Newtonsoft.Json NuGet package of Rules project from 9.0.1 to 10.0.3 (#937) (by @bergmeister)
56+
- Fix Pester v4 installation for `Visual Studio 2017` image and use Pester v4 assertion operator syntax (#892) (by @bergmeister)
57+
- Have a single point of reference for the .Net Core SDK version (#885) (by @bergmeister)
58+
- Fix regressions introduced by PR 882 (#891) (by @bergmeister)
59+
- Changes to allow tests to be run outside of CI (#882) (by @JamesWTruher)
60+
- Upgrade platyPS from Version 0.5 to 0.9 (#869) (by @bergmeister)
61+
- Build using .Net Core SDK 2.1.101 targeting `netstandard2.0` and `net451` (#853, #854, #870, #899, #912, #936) (by @bergmeister)
62+
- Add instructions to make a release (#843) (by @kapilmb)
63+
64+
### Documentation, Error Messages and miscellaneous Improvements
65+
66+
- Added Chocolatey Install help, which has community support (#999) (Thanks @pauby)
67+
- Finalize Release Logs and bump version to 1.17 (#1002) (by @bergmeister)
68+
- Docker examples: (#987, #990) (by @bergmeister)
69+
- Use multiple GitHub issue templates for bugs, feature requests and support questions (#986) (by @bergmeister
70+
- Fix table of contents (#980) (by @bergmeister)
71+
- Improve documentation, especially about parameter usage and the settings file (#968) (by @bergmeister)
72+
- Add base changelog for 1.17.0 (#967) (by @bergmeister)
73+
- Remove outdated about_scriptanalyzer help file (#951) (by @bergmeister)
74+
- Fixes a typo and enhances the documentation for the parameters required for script rules (#942) (Thanks @MWL88!)
75+
- Remove unused using statements and sort them (#931) (by @bergmeister)
76+
- Make licence headers consistent across all .cs files by using the recommended header of PsCore (#930) (by @bergmeister)
77+
- Update syntax in ReadMe to be the correct one from get-help (#932) by @bergmeister)
78+
- Remove redundant, out of date Readme of RuleDocumentation folder (#918) (by @bergmeister)
79+
- Shorten contribution section in ReadMe and make it more friendly (#911) (by @bergmeister)
80+
- Update from Pester 4.1.1 to 4.3.1 and use new -BeTrue and -BeFalse operators (#906) (by @bergmeister)
81+
- Fix Markdown in ScriptRuleDocumentation.md so it renders correctly on GitHub web site (#898) (Thanks @MWL88!)
82+
- Fix typo in .Description for Measure-RequiresModules (#888) (Thanks @TimCurwick!)
83+
- Use https links where possible (#873) (by @bergmeister)
84+
- Make documentation of AvoidUsingPositionalParameters match the implementation (#867) (by @bergmeister)
85+
- Fix PSAvoidUsingCmdletAliases warnings of internal build/release scripts in root and Utils folder (#872) (by @bergmeister)
86+
- Add simple GitHub Pull Request template based off the one for PowerShell Core (#866) (by @bergmeister)
87+
- Add a simple GitHub issue template based on the one of PowerShell Core. (#865, #884) (by @bergmeister)
88+
- Fix Example 7 in Invoke-ScriptAnalyzer.md (#862) (Thanks @sethvs!)
89+
- Use the typewriter apostrophe instead the typographic apostrophe (#855) (Thanks @alexandear!)
90+
- Add justification to ReadMe (#848) (Thanks @KevinMarquette!)
91+
- Fix typo in README (#845) (Thanks @misterGF!)
92+
93+
## [1.16.1](https://github.com/PowerShell/PSScriptAnalyzer/tree/1.16.1) - 2017-09-01
94+
### Fixed
95+
- (#815) Formatter crashes due to invalid extent comparisons
96+
97+
## [1.16.0](https://github.com/PowerShell/PSScriptAnalyzer/tree/1.16.0) - 2017-08-15
298
### Added
399
- (#803) `CustomRulePath`, `RecurseCustomRulePath` and `IncludeDefaultRules` parameters to settings file.
4100

0 commit comments

Comments
 (0)