Skip to content
This repository was archived by the owner on Feb 24, 2021. It is now read-only.

Commit 4a9091c

Browse files
committed
PR comments
1 parent 2b72134 commit 4a9091c

File tree

5 files changed

+61
-55
lines changed

5 files changed

+61
-55
lines changed

DscResource.CodeCoverage/CodeCovIo.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function Add-UniqueFileLineToTable
4040

4141
# file paths need to be relative to repo root when querying GIT
4242
Push-Location -LiteralPath $RepoRoot
43+
4344
try
4445
{
4546
Write-Verbose -Message "running git ls-files" -Verbose

DscResource.Container/DscResource.Container.psm1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,11 @@ function Out-MissedCommand
723723
Write-Info -ForegroundColor Red -Message ($script:localizedData.MissedCommandsInCodeCoverage -f $MissedCommand.Count)
724724

725725
[PSCustomObject[]] $MissedCommand = $MissedCommand |
726-
Select-Object -Property @{
727-
Name = 'File'; Expression = {
728-
$_.File -replace ("$env:APPVEYOR_BUILD_FOLDER\" -replace '\\', '\\')
729-
}
730-
}, Function, Line, Command
726+
Select-Object -Property @{
727+
Name = 'File'; Expression = {
728+
$_.File -replace ("$env:APPVEYOR_BUILD_FOLDER\" -replace '\\', '\\')
729+
}
730+
}, Function, Line, Command
731731

732732
$fileFieldMaxLength = ($MissedCommand.File | Measure-Object -Maximum -Property Length).Maximum
733733
$functionFieldMaxLength = ($MissedCommand.Function | Measure-Object -Maximum -Property Length).Maximum

DscResource.DocumentationHelper/WikiPages.psm1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ function New-DscResourceWikiSite
7070
foreach ($mofSchemaFile in $mofSchemaFiles)
7171
{
7272
$mofSchema = Get-MofSchemaObject -FileName $mofSchemaFile.FullName |
73-
Where-Object -FilterScript {
74-
($_.ClassName -eq $mofSchemaFile.Name.Replace('.schema.mof', '')) `
75-
-and ($null -ne $_.FriendlyName)
76-
}
73+
Where-Object -FilterScript {
74+
($_.ClassName -eq $mofSchemaFile.Name.Replace('.schema.mof', '')) `
75+
-and ($null -ne $_.FriendlyName)
76+
}
7777

7878
$descriptionPath = Join-Path -Path $mofSchemaFile.DirectoryName -ChildPath 'readme.md'
7979

@@ -404,11 +404,11 @@ function Publish-WikiContent
404404
try
405405
{
406406
Write-Verbose -Message $script:localizedData.ConfigGlobalGitMessage
407-
Invoke-Git -Arguments 'config --global core.autocrlf true'
407+
Invoke-Git -Arguments 'config', '--global', 'core.autocrlf', 'true'
408408

409409
$wikiRepoName = "https://github.com/$RepoName.wiki.git"
410410
Write-Verbose -Message ($script:localizedData.CloneWikiGitRepoMessage -f $WikiRepoName)
411-
Invoke-Git -Arguments 'clone', "$wikiRepoName" , "$path" , '--quiet'
411+
Invoke-Git -Arguments 'clone', $wikiRepoName , $path , '--quiet'
412412

413413
$jobArtifactsUrl = "$appVeyorApiUrl/buildjobs/$JobId/artifacts"
414414
Write-Verbose -Message ($localizedData.DownloadAppVeyorArtifactDetailsMessage -f $JobId, $jobArtifactsUrl)
@@ -459,8 +459,8 @@ function Publish-WikiContent
459459
Set-Location -Path $path
460460

461461
Write-Verbose -Message $script:localizedData.ConfigLocalGitMessage
462-
Invoke-Git -Arguments 'config', '--local', 'user.email', "$GitUserEmail"
463-
Invoke-Git -Arguments 'config', '--local', 'user.name', "$GitUserName"
462+
Invoke-Git -Arguments 'config', '--local', 'user.email', $GitUserEmail
463+
Invoke-Git -Arguments 'config', '--local', 'user.name', $GitUserName
464464
Invoke-Git -Arguments 'remote', 'set-url' , 'origin' , "https://$($GitUserName):$($GithubAccessToken)@github.com/$RepoName.wiki.git"
465465

466466
Write-Verbose -Message $localizedData.AddWikiContentToGitRepoMessage

Meta.Tests.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else
4747

4848
$dscResourcesFolderFilePath = Join-Path -Path $moduleRootFilePath -ChildPath 'DscResources'
4949

50-
if (-not (Test-Path $dscResourcesFolderFilePath))
50+
if (-not (Test-Path -Path $dscResourcesFolderFilePath))
5151
{
5252
$dscResourcesFolderFilePath = $moduleRootFilePath
5353
}
@@ -935,9 +935,10 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'Markdown' {
935935
{
936936
if ($dscResourcesFolderFilePath -eq $moduleRootFilePath)
937937
{
938-
#reverting back to defaults
938+
# Reverting back to defaults
939939
$dscResourcesFolderFilePath = Join-Path -Path $moduleRootFilePath -ChildPath 'DscResources'
940940
}
941+
941942
$gulpArgumentList = @(
942943
'test-mdsyntax',
943944
'--silent',

TestHelper.psm1

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,47 +41,47 @@ function New-Nuspec
4141
param
4242
(
4343
[Parameter(Mandatory = $true)]
44-
[String]
44+
[System.String]
4545
$PackageName,
4646

4747
[Parameter(Mandatory = $true)]
48-
[String]
48+
[System.String]
4949
$Version,
5050

5151
[Parameter(Mandatory = $true)]
52-
[String]
52+
[System.String]
5353
$Author,
5454

5555
[Parameter(Mandatory = $true)]
56-
[String]
56+
[System.String]
5757
$Owners,
5858

5959
[Parameter(Mandatory = $true)]
60-
[String]
60+
[System.String]
6161
$DestinationPath,
6262

6363
[Parameter()]
64-
[String]
64+
[System.String]
6565
$LicenseUrl,
6666

6767
[Parameter()]
68-
[String]
68+
[System.String]
6969
$ProjectUrl,
7070

7171
[Parameter()]
72-
[String]
72+
[System.String]
7373
$IconUrl,
7474

7575
[Parameter()]
76-
[String]
76+
[System.String]
7777
$PackageDescription,
7878

7979
[Parameter()]
80-
[String]
80+
[System.String]
8181
$ReleaseNotes,
8282

8383
[Parameter()]
84-
[String]
84+
[System.String]
8585
$Tags
8686
)
8787

@@ -97,21 +97,21 @@ function New-Nuspec
9797
<owners>$Owners</owners>
9898
"@
9999

100-
if (-not [String]::IsNullOrEmpty($LicenseUrl))
100+
if (-not [System.String]::IsNullOrEmpty($LicenseUrl))
101101
{
102102
$nuspecFileContent += @"
103103
<licenseUrl>$LicenseUrl</licenseUrl>
104104
"@
105105
}
106106

107-
if (-not [String]::IsNullOrEmpty($ProjectUrl))
107+
if (-not [System.String]::IsNullOrEmpty($ProjectUrl))
108108
{
109109
$nuspecFileContent += @"
110110
<projectUrl>$ProjectUrl</projectUrl>
111111
"@
112112
}
113113

114-
if (-not [String]::IsNullOrEmpty($IconUrl))
114+
if (-not [System.String]::IsNullOrEmpty($IconUrl))
115115
{
116116
$nuspecFileContent += @"
117117
<iconUrl>$IconUrl</iconUrl>
@@ -156,11 +156,11 @@ function Install-ModuleFromPowerShellGallery
156156
param
157157
(
158158
[Parameter(Mandatory = $true)]
159-
[String]
159+
[System.String]
160160
$ModuleName,
161161

162162
[Parameter(Mandatory = $true)]
163-
[String]
163+
[System.String]
164164
$DestinationPath
165165
)
166166

@@ -285,22 +285,22 @@ function Initialize-TestEnvironment
285285
(
286286
[Parameter(Mandatory = $true)]
287287
[ValidateNotNullOrEmpty()]
288-
[String]
288+
[System.String]
289289
$DscModuleName,
290290

291291
[Parameter(Mandatory = $true)]
292292
[ValidateNotNullOrEmpty()]
293-
[String]
293+
[System.String]
294294
$DscResourceName,
295295

296296
[Parameter(Mandatory = $true)]
297297
[ValidateSet('Unit', 'Integration')]
298-
[String]
298+
[System.String]
299299
$TestType,
300300

301301
[Parameter()]
302302
[ValidateSet('Mof', 'Class')]
303-
[String]
303+
[System.String]
304304
$ResourceType = 'Mof'
305305
)
306306

@@ -522,13 +522,14 @@ function Test-FileContainsClassResource
522522
param
523523
(
524524
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
525-
[String]
525+
[System.String]
526526
$FilePath
527527
)
528528

529529
$fileAst = [System.Management.Automation.Language.Parser]::ParseFile($FilePath, [ref]$null, [ref]$null)
530+
$attributeAst = $fileAst.FindAll( { $args[0] -is [System.Management.Automation.Language.AttributeAst] }, $false)
530531

531-
foreach ($fileAttributeAst in $fileAst.FindAll( { $args[0] -is [System.Management.Automation.Language.AttributeAst] }, $false))
532+
foreach ($fileAttributeAst in $attributeAst)
532533
{
533534
if ($fileAttributeAst.Extent.Text -ieq '[DscResource()]')
534535
{
@@ -558,7 +559,7 @@ function Get-ClassResourceNameFromFile
558559
param
559560
(
560561
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
561-
[String]
562+
[System.String]
562563
$FilePath
563564
)
564565

@@ -595,7 +596,7 @@ function Test-ModuleContainsScriptResource
595596
param
596597
(
597598
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
598-
[String]
599+
[System.String]
599600
$ModulePath
600601
)
601602

@@ -619,7 +620,7 @@ function Test-ModuleContainsClassResource
619620
param
620621
(
621622
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
622-
[String]
623+
[System.String]
623624
$ModulePath
624625
)
625626

@@ -650,7 +651,7 @@ function Get-Psm1FileList
650651
param
651652
(
652653
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
653-
[String]
654+
[System.String]
654655
$FilePath
655656
)
656657

@@ -671,7 +672,7 @@ function Get-FileParseErrors
671672
param
672673
(
673674
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
674-
[String]
675+
[System.String]
675676
$FilePath
676677
)
677678

@@ -699,7 +700,7 @@ function Get-TextFilesList
699700
param
700701
(
701702
[Parameter(Mandatory = $true)]
702-
[String]
703+
[System.String]
703704
$Root
704705
)
705706

@@ -747,7 +748,7 @@ function Get-ModuleScriptResourceNames
747748
param
748749
(
749750
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
750-
[String]
751+
[System.String]
751752
$ModulePath
752753
)
753754

@@ -847,7 +848,7 @@ function Get-SuppressedPSSARuleNameList
847848
param
848849
(
849850
[Parameter(Mandatory = $true)]
850-
[String]
851+
[System.String]
851852
$FilePath
852853
)
853854

@@ -860,7 +861,9 @@ function Get-SuppressedPSSARuleNameList
860861

861862
foreach ($attributeAst in $attributeAsts)
862863
{
863-
if ([System.Diagnostics.CodeAnalysis.SuppressMessageAttribute].FullName.ToLower().Contains($attributeAst.TypeName.FullName.ToLower()))
864+
$messageAttributeName = [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute].FullName.ToLower()
865+
866+
if ($messageAttributeName.Contains($attributeAst.TypeName.FullName.ToLower()))
864867
{
865868
$suppressedPSSARuleNames += $attributeAst.PositionalArguments.Extent.Text
866869
}
@@ -1255,9 +1258,9 @@ function Get-ResourceModulesInConfiguration
12551258
} # foreach
12561259

12571260
# Did a module get identified when stepping through the elements?
1258-
if (-not [String]::IsNullOrEmpty($moduleName))
1261+
if (-not [System.String]::IsNullOrEmpty($moduleName))
12591262
{
1260-
if ([String]::IsNullOrEmpty($moduleVersion))
1263+
if ([System.String]::IsNullOrEmpty($moduleVersion))
12611264
{
12621265
$listedModules += @{
12631266
Name = $moduleName
@@ -1401,7 +1404,7 @@ function Get-DscIntegrationTestOrderNumber
14011404
(
14021405
[Parameter()]
14031406
[ValidateNotNullOrEmpty()]
1404-
[String]
1407+
[System.String]
14051408
$Path
14061409
)
14071410

@@ -1476,7 +1479,7 @@ function Get-DscTestContainerInformation
14761479
(
14771480
[Parameter()]
14781481
[ValidateNotNullOrEmpty()]
1479-
[String]
1482+
[System.String]
14801483
$Path
14811484
)
14821485

@@ -1627,7 +1630,7 @@ function Set-PSModulePath
16271630
(
16281631
[Parameter(Mandatory = $true)]
16291632
[ValidateNotNullOrEmpty()]
1630-
[String]
1633+
[System.String]
16311634
$Path,
16321635

16331636
[Parameter()]
@@ -1670,10 +1673,10 @@ function Write-Info
16701673
$ForegroundColor = 'Yellow'
16711674
)
16721675

1673-
$curentColor = $host.ui.RawUI.ForegroundColor
1674-
$host.ui.RawUI.ForegroundColor = $ForegroundColor
1676+
$curentColor = $host.UI.RawUI.ForegroundColor
1677+
$host.UI.RawUI.ForegroundColor = $ForegroundColor
16751678
Write-Information -MessageData "[Build Info] [UTC $([System.DateTime]::UtcNow)] $message"
1676-
$host.ui.RawUI.ForegroundColor = $curentColor
1679+
$host.UI.RawUI.ForegroundColor = $curentColor
16771680
}
16781681

16791682
<#
@@ -2045,7 +2048,7 @@ function Write-PsScriptAnalyzerWarning
20452048
$PssaRuleOutput,
20462049

20472050
[Parameter(Mandatory = $true)]
2048-
[string]
2051+
[System.String]
20492052
$RuleType
20502053
)
20512054

@@ -2055,6 +2058,7 @@ function Write-PsScriptAnalyzerWarning
20552058
foreach ($ruleNameGroup in $ruleCollection)
20562059
{
20572060
Write-Warning -Message "The following PSScriptAnalyzer rule '$($ruleNameGroup.Name)' errors need to be fixed:"
2061+
20582062
foreach ($rule in $ruleNameGroup.Group)
20592063
{
20602064
Write-Warning -Message "$($rule.ScriptName) (Line $($rule.Line)): $($rule.Message)"

0 commit comments

Comments
 (0)