Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
a6f77d3
add sensible defaults code
JamesWTruher Mar 10, 2019
499a62a
Add hosted analyzer class
JamesWTruher Jun 25, 2019
1b7b9b1
more hosting updates
JamesWTruher Jun 27, 2019
9e5cd87
Formatter seems to be working
JamesWTruher Jul 8, 2019
8c0b30b
change calls to analyzer to be more like the cmdlet
JamesWTruher Jul 19, 2019
e5e31af
checkpoint
JamesWTruher Sep 5, 2019
2de9d8f
Since RunspacePools are disposable, implement IDisposable for HostedA…
JamesWTruher Sep 10, 2019
1034af8
add another supported library
JamesWTruher Sep 10, 2019
795b68c
Remove IDisposable in Helper as we no longer create a runspace pool
JamesWTruher Sep 12, 2019
a71ac90
make helper disposable to remove all vestiges of runspaces
JamesWTruher Sep 13, 2019
65aae15
add sensible defaults code
JamesWTruher Mar 10, 2019
567f530
Add hosted analyzer class
JamesWTruher Jun 25, 2019
8d7d2a6
more hosting updates
JamesWTruher Jun 27, 2019
73fec1b
Formatter seems to be working
JamesWTruher Jul 8, 2019
874628a
change calls to analyzer to be more like the cmdlet
JamesWTruher Jul 19, 2019
67dc945
checkpoint
JamesWTruher Sep 5, 2019
dd5b919
Since RunspacePools are disposable, implement IDisposable for HostedA…
JamesWTruher Sep 10, 2019
01f7957
add another supported library
JamesWTruher Sep 10, 2019
ed3436b
Remove IDisposable in Helper as we no longer create a runspace pool
JamesWTruher Sep 12, 2019
db5c2f7
make helper disposable to remove all vestiges of runspaces
JamesWTruher Sep 13, 2019
1b85759
Merge branch 'hosting' of https://github.com/JamesWTruher/PSScriptAna…
JamesWTruher Sep 16, 2019
a3d58a8
Add locking to hosted analyzer methods which change analyzer state
JamesWTruher Sep 23, 2019
b38e35d
Add simple locking to hosted analyzer apis
JamesWTruher Oct 7, 2019
b2e76ee
Change hostedanalyzer fields to properties
JamesWTruher Oct 8, 2019
ba88ff8
Remove dispose of Helper.Instance.
JamesWTruher Oct 15, 2019
7610d49
Add an overload for Fix which takes a settings object
JamesWTruher Oct 21, 2019
e43d72b
Adding tests for HostedAnalyzer
JamesWTruher Oct 21, 2019
c969ead
fix ToString
JamesWTruher Oct 21, 2019
c081444
Add C# tests for the hosted analyzer
JamesWTruher Oct 28, 2019
0dcb55d
Fix up reference assembly build and when it should be built
JamesWTruher Oct 29, 2019
fe6f907
Merge branch 'master' into hosting
JamesWTruher Oct 29, 2019
8ecc70c
remove reference from build for the moment
JamesWTruher Oct 29, 2019
6422360
bug fix - change initializer for a couple of Settings properties
JamesWTruher Oct 30, 2019
893b553
Start removing dead code
JamesWTruher Nov 1, 2019
15d21ef
More code cleanup
JamesWTruher Nov 5, 2019
d76f87c
Code Cleanup
JamesWTruher Nov 11, 2019
7c1e74a
Merge remote-tracking branch 'upstream/master' into hosting
JamesWTruher Nov 11, 2019
aad6ed0
Merge branch 'master' into hosting
JamesWTruher Nov 12, 2019
89ba69f
incorporate feedback from https://github.com/PowerShell/PowerShellEdi…
JamesWTruher Nov 12, 2019
8e27c8b
Fix typo in WriteError to add to correct collection
JamesWTruher Nov 13, 2019
a88bc3b
Remove Get-Runspace from tests, it wasn't being used
JamesWTruher Nov 13, 2019
182d128
Create helper function so we can test hosted analyzer on PS4
JamesWTruher Nov 13, 2019
7b40004
update json library version
JamesWTruher Nov 13, 2019
b1a93c8
Merge remote-tracking branch 'upstream/master' into hosting
JamesWTruher Nov 14, 2019
0fa1e64
Fix typo in hosted analyzer tests
JamesWTruher Nov 14, 2019
99e9387
remove some of the nupkg creation code which we're not doing
JamesWTruher Nov 14, 2019
f0868fb
Add the new APIs to the reference assembly
JamesWTruher Nov 14, 2019
3e9d242
Update version to 1.18.4 for signing files in hosting release
JamesWTruher Nov 18, 2019
24533f3
Add reference build to build All
JamesWTruher Nov 21, 2019
bbb5d75
global.json needed in directory for build
JamesWTruher Nov 21, 2019
00a73e3
Add .nupkg to be signed
JamesWTruher Nov 21, 2019
c744561
Add support for format with settings and range
JamesWTruher Nov 29, 2019
909f62a
Add a couple of new apis that are needed by Editor Services
JamesWTruher Dec 6, 2019
3f1debe
Update reference library to include changes in previous hosted analyzer
JamesWTruher Dec 6, 2019
798f8b2
Make Fix and Format similar from a signature basis
JamesWTruher Dec 12, 2019
1e8c7d8
Merge branch 'master' into hosting
JamesWTruher Dec 12, 2019
88f379c
match sdk version with base project
JamesWTruher Dec 12, 2019
28501a6
Merge branch 'master' into hosting
bergmeister Jan 16, 2020
4e6c2ae
Add documentation for hosted analyzer
JamesWTruher Jan 28, 2020
f65bb3e
Merge branch 'hosting' of https://github.com/JamesWTruher/PSScriptAna…
JamesWTruher Jan 28, 2020
43af91c
Merge branch 'master' into hosting
JamesWTruher Jan 28, 2020
2afcc2a
Merge branch 'master' into hosting
JamesWTruher Feb 5, 2020
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
Prev Previous commit
Next Next commit
Remove Get-Runspace from tests, it wasn't being used
  • Loading branch information
JamesWTruher committed Nov 13, 2019
commit a88bc3b50f263110732b982cadc9c845053efa66
16 changes: 6 additions & 10 deletions Tests/Engine/HostedAnalyzer.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
Describe "Hosted Analyzer Tests" {
BeforeAll {
$HostedAnalyzer = new-object Microsoft.Windows.PowerShell.ScriptAnalyzer.Hosting.HostedAnalyzer
$RunspaceCount = (Get-Runspace).Count
}
AfterAll {
$HostedAnalyzer.Dispose()
}

Context "Analyze Method Tests" {
$defaultAnalyzerTests =
$defaultAnalyzerTests =
@{ Script = 'gci'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingCmdletAliases') },
@{ Script = 'gc'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingCmdletAliases') },
@{ Script = 'get-command;gc'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingCmdletAliases') },
Expand Down Expand Up @@ -85,7 +84,7 @@ Describe "Hosted Analyzer Tests" {

Context "Tests with Settings" {

$settingsAnalyzerTests =
$settingsAnalyzerTests =
@{ Script = 'write-host no1'; ExpectedResultCount = 0; ExpectedRuleViolation = @(); Settings = $HostedAnalyzer.CreateSettings('PSGallery') },
@{ Script = 'write-host no2'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingWriteHost'); Settings = $HostedAnalyzer.CreateSettings() },
@{ Script = 'write-host no3'; ExpectedResultCount = 0; ExpectedRuleViolation = @(); Settings = $($s = $HostedAnalyzer.CreateSettings(); $null = $s.ExcludeRules.Add('PSAvoidUsingWriteHost'); $s) },
Expand Down Expand Up @@ -154,14 +153,13 @@ Describe "Hosted Analyzer Tests" {
Describe "Async Hosted Analyzer Tests" {
BeforeAll {
$HostedAnalyzer = new-object Microsoft.Windows.PowerShell.ScriptAnalyzer.Hosting.HostedAnalyzer
$RunspaceCount = (Get-Runspace).Count
}
AfterAll {
$HostedAnalyzer.Dispose()
}

Context "Async Analyze Method Tests" {
$defaultAnalyzerTests =
$defaultAnalyzerTests =
@{ Script = 'gci'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingCmdletAliases') },
@{ Script = 'gc'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingCmdletAliases') },
@{ Script = 'get-command;gc'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingCmdletAliases') },
Expand Down Expand Up @@ -235,7 +233,7 @@ Describe "Async Hosted Analyzer Tests" {

Context "Async Tests with Settings" {

$settingsAnalyzerTests =
$settingsAnalyzerTests =
@{ Script = 'write-host no1'; ExpectedResultCount = 0; ExpectedRuleViolation = @(); Settings = $HostedAnalyzer.CreateSettings('PSGallery') },
@{ Script = 'write-host no2'; ExpectedResultCount = 1; ExpectedRuleViolation = @('PSAvoidUsingWriteHost'); Settings = $HostedAnalyzer.CreateSettings() },
@{ Script = 'write-host no3'; ExpectedResultCount = 0; ExpectedRuleViolation = @(); Settings = $($s = $HostedAnalyzer.CreateSettings(); $null = $s.ExcludeRules.Add('PSAvoidUsingWriteHost'); $s) },
Expand Down Expand Up @@ -304,7 +302,6 @@ Describe "Async Hosted Analyzer Tests" {
Describe "Create Settings APIs" {
BeforeAll {
$HostedAnalyzer = new-object Microsoft.Windows.PowerShell.ScriptAnalyzer.Hosting.HostedAnalyzer
$RunspaceCount = (Get-Runspace).Count
}
AfterAll {
$HostedAnalyzer.Dispose()
Expand All @@ -319,7 +316,7 @@ Describe "Create Settings APIs" {
$settings | Should -BeOfType [Microsoft.Windows.PowerShell.ScriptAnalyzer.Settings]
}

$settingsPropertyValues =
$settingsPropertyValues =
@{ Name = "RecurseCustomRulePath"; Value = $false; type = "bool" },
@{ Name = "IncludeDefaultRules"; Value = $true; type = "bool" },
@{ Name = "FilePath"; Value = $null; type = "string" },
Expand Down Expand Up @@ -368,7 +365,7 @@ Describe "Create Settings APIs" {
$createdRules = ($setting.IncludeRules | Sort-Object) -join ":"
$expectedRules = "PSAlignAssignmentStatement:PSPlaceCloseBrace:PSPlaceOpenBrace:PSUseConsistentIndentation:PSUseConsistentWhitespace:PSUseCorrectCasing"
$createdRules | Should -Be $expectedRules

}

It "Should create settings which can be used in analyze" {
Expand All @@ -384,7 +381,6 @@ Describe "Create Settings APIs" {
Describe "Get Rule Apis" {
BeforeAll {
$HostedAnalyzer = new-object Microsoft.Windows.PowerShell.ScriptAnalyzer.Hosting.HostedAnalyzer
$RunspaceCount = (Get-Runspace).Count
$AnalyzerRules = Get-ScriptAnalyzerRule
$UsePattern = '*use*'
$UseRules = Get-ScriptAnalyzerRule -Name $UsePattern
Expand Down