Skip to content

Custom rule is invoked twice for a single script #689

Open
@lzybkr

Description

@lzybkr

I am writing custom rules and I see an error reported twice when there should be just one report.

I invoke script analyzer like this:

#11 PS> Invoke-ScriptAnalyzer -CustomRulePath D:\gh\PesterAnalyzerRules -Path a.ps1

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PesterAnalyzerRules\Measure-ShouldT Information  a.ps1      3     Pipe a script block to 'Should Throw' or 'Should Not Throw'
hrow
PesterAnalyzerRules\Measure-ShouldT Information  a.ps1      3     Pipe a script block to 'Should Throw' or 'Should Not Throw'
hrow


@ D:\xtmp
#12 PS> cat a.ps1

Describe "a" {
    "b" | Should Throw
}

In a debugger, I noticed my rule is getting called on two different threads.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions