diff --git a/.github/workflows/Lint-SourceCode.yml b/.github/workflows/Lint-SourceCode.yml index 21ef6db1..627dfc08 100644 --- a/.github/workflows/Lint-SourceCode.yml +++ b/.github/workflows/Lint-SourceCode.yml @@ -53,17 +53,15 @@ jobs: uses: actions/checkout@v5 with: persist-credentials: false - fetch-depth: 0 - name: Lint-SourceCode - uses: PSModule/Invoke-ScriptAnalyzer@v3 + uses: PSModule/Invoke-ScriptAnalyzer@v4 with: Debug: ${{ inputs.Debug }} Prerelease: ${{ inputs.Prerelease }} Verbose: ${{ inputs.Verbose }} Version: ${{ inputs.Version }} Path: src - Settings: SourceCode WorkingDirectory: ${{ inputs.WorkingDirectory }} TestResult_Enabled: true TestResult_TestSuiteName: PSModuleLint-SourceCode-${{ runner.os }} diff --git a/.github/workflows/Test-Module.yml b/.github/workflows/Test-Module.yml index 01b9fa24..e6d757d7 100644 --- a/.github/workflows/Test-Module.yml +++ b/.github/workflows/Test-Module.yml @@ -84,7 +84,6 @@ jobs: uses: actions/checkout@v5 with: persist-credentials: false - fetch-depth: 0 - name: Download module artifact uses: actions/download-artifact@v5 @@ -107,6 +106,11 @@ jobs: name: Lint-Module (${{ inputs.RunsOn }}) runs-on: ${{ inputs.RunsOn }} steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + persist-credentials: false + - name: Download module artifact uses: actions/download-artifact@v5 with: @@ -114,7 +118,7 @@ jobs: path: ${{ inputs.WorkingDirectory }}/outputs/module - name: Lint-Module - uses: PSModule/Invoke-ScriptAnalyzer@v3 + uses: PSModule/Invoke-ScriptAnalyzer@v4 with: Path: outputs/module Debug: ${{ inputs.Debug }} @@ -122,6 +126,5 @@ jobs: Verbose: ${{ inputs.Verbose }} Version: ${{ inputs.Version }} WorkingDirectory: ${{ inputs.WorkingDirectory }} - Settings: Module TestResult_Enabled: true TestResult_TestSuiteName: PSModuleLint-Module-${{ runner.os }} diff --git a/.github/workflows/Workflow-Test-WithManifest.yml b/.github/workflows/Workflow-Test-WithManifest.yml index 8caaabc1..85409571 100644 --- a/.github/workflows/Workflow-Test-WithManifest.yml +++ b/.github/workflows/Workflow-Test-WithManifest.yml @@ -25,5 +25,4 @@ jobs: secrets: inherit with: WorkingDirectory: tests/srcWithManifestTestRepo - Name: PSModuleTest2 SettingsPath: .github/PSModule.yml diff --git a/tests/srcWithManifestTestRepo/.github/linters/.powershell-psscriptanalyzer.psd1 b/tests/srcWithManifestTestRepo/.github/linters/.powershell-psscriptanalyzer.psd1 new file mode 100644 index 00000000..09cc3d0c --- /dev/null +++ b/tests/srcWithManifestTestRepo/.github/linters/.powershell-psscriptanalyzer.psd1 @@ -0,0 +1,56 @@ +@{ + Rules = @{ + PSAlignAssignmentStatement = @{ + Enable = $true + CheckHashtable = $true + } + PSAvoidLongLines = @{ + Enable = $true + MaximumLineLength = 150 + } + PSAvoidSemicolonsAsLineTerminators = @{ + Enable = $true + } + PSPlaceCloseBrace = @{ + Enable = $true + NewLineAfter = $false + IgnoreOneLineBlock = $true + NoEmptyLineBefore = $false + } + PSPlaceOpenBrace = @{ + Enable = $true + OnSameLine = $true + NewLineAfter = $true + IgnoreOneLineBlock = $true + } + PSProvideCommentHelp = @{ + Enable = $true + ExportedOnly = $false + BlockComment = $true + VSCodeSnippetCorrection = $false + Placement = 'begin' + } + PSUseConsistentIndentation = @{ + Enable = $true + IndentationSize = 4 + PipelineIndentation = 'IncreaseIndentationForFirstPipeline' + Kind = 'space' + } + PSUseConsistentWhitespace = @{ + Enable = $true + CheckInnerBrace = $true + CheckOpenBrace = $true + CheckOpenParen = $true + CheckOperator = $true + CheckPipe = $true + CheckPipeForRedundantWhitespace = $true + CheckSeparator = $true + CheckParameter = $true + IgnoreAssignmentOperatorInsideHashTable = $true + } + } + ExcludeRules = @( + 'PSMissingModuleManifestField', # This rule is not applicable until the module is built. + 'PSUseToExportFieldsInManifest' + ) +}