generated from PSModule/Template-Action
-
Notifications
You must be signed in to change notification settings - Fork 0
🌟[Major]: Remove Settings with predefined settings
#18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
eaf82d0
Remove `Settings` with predefined settings
MariusStorhaug a2b93ad
Update README.md
MariusStorhaug 1ffbf28
Reorder settings file validation to improve script flow
MariusStorhaug af4f33c
Refactor settings file path handling to use environment variable dire…
MariusStorhaug 14b3bb2
Refactor settings file path handling to use resolved path variable
MariusStorhaug 353cbcc
Update README.md
MariusStorhaug 7ed9e4c
Update scripts/main.ps1
MariusStorhaug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,18 @@ | ||
| # If test type is module, the code we ought to test is in the path/name folder, otherwise it's in the path folder. | ||
| $settings = $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Settings | ||
| # Resolve paths for testing | ||
| $testPath = Resolve-Path -Path "$PSScriptRoot/tests/PSScriptAnalyzer" | Select-Object -ExpandProperty Path | ||
| $path = [string]::IsNullOrEmpty($env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path) ? '.' : $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path | ||
| $codePath = Resolve-Path -Path $path | Select-Object -ExpandProperty Path | ||
| $settingsFilePath = switch -Regex ($settings) { | ||
| 'Module|SourceCode' { | ||
| "$testPath/$settings.Settings.psd1" | ||
| } | ||
| 'Custom' { | ||
| Resolve-Path -Path $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath | Select-Object -ExpandProperty Path | ||
| } | ||
| default { | ||
| throw "Invalid test type: [$settings]" | ||
| } | ||
| } | ||
| $settingsFilePath = Resolve-Path -Path $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath | Select-Object -ExpandProperty Path | ||
|
|
||
| [pscustomobject]@{ | ||
| Settings = $settings | ||
| CodePath = $codePath | ||
| TestPath = $testPath | ||
| SettingsFilePath = $settingsFilePath | ||
| } | Format-List | Out-String | ||
|
|
||
| Set-GitHubOutput -Name Settings -Value $settings | ||
| if (!(Test-Path -Path $settingsFilePath)) { | ||
| throw "Settings file not found at path: $settingsFilePath" | ||
| } | ||
| Set-GitHubOutput -Name CodePath -Value $codePath | ||
| Set-GitHubOutput -Name TestPath -Value $testPath | ||
| Set-GitHubOutput -Name SettingsFilePath -Value $settingsFilePath |
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions
56
tests/srcWithManifestTestRepo/tests/SourceCode.Settings.psd1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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' | ||
| ) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.