Skip to content
Merged
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
9 changes: 7 additions & 2 deletions Tests/Engine/GetScriptAnalyzerRule.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ Describe "Test Name parameters" {

It "get Rules with no parameters supplied" {
$defaultRules = Get-ScriptAnalyzerRule
$expectedNumRules = 72
$defaultRules.Count | Should -Be $expectedNumRules
# Dynamically count the expected number of rules from source files
# by finding all C# files with [Export(typeof(I...Rule))] attributes
$rulesRoot = Resolve-Path "$PSScriptRoot/../../Rules"
$expectedNumRules = (Get-ChildItem -Path $rulesRoot -Filter '*.cs' -Recurse |
Select-String -Pattern 'Export\(typeof\s*\(I\w+Rule\)\)' |
Select-Object -ExpandProperty Path -Unique).Count
Comment on lines +66 to +71
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow bad Copilot, that suggestion would mean that we don't end up testing anything at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Claude did the actual PR...lol)

$defaultRules.Count | Should -Be $expectedNumRules
}

It "is a positional parameter" {
Expand Down
Loading