Skip to content

Commit 79d9b3a

Browse files
committed
probably better
1 parent 1c551ab commit 79d9b3a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/PSCodingStandards/Get-RuleForPath.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@ function Get-RuleForPath {
8585
$testDirs = (Get-ATestDirectory -RuleObject $q -Language $Language)
8686
foreach($testDirectory in $testDirs){
8787
# resolve path to be compatible
88-
$testPath = (Join-Path (Resolve-Path . -Relative) $testDirectory) + [IO.Path]::DirectorySeparatorChar
88+
$testPath = (Join-Path (Resolve-Path . -Relative) $testDirectory)
8989

90-
# see if the TEST directory is a substring of the full path
91-
if($modifiedPath.StartsWith($testPath)){
90+
if((Split-Path $modifiedPath -Parent) -eq $testPath){
9291
$matchingRules += $q
9392
continue
9493
}
9594

96-
if($modifiedPathWithReplacement.StartsWith($testPath)){
95+
if((Split-Path $modifiedPathWithReplacement -Parent) -eq $testPath){
9796
$matchingRules += $q
9897
continue
9998
}

0 commit comments

Comments
 (0)