Skip to content

Commit 8819705

Browse files
🩹 [Patch]: Update linter configurations and license year (#106)
## Description This pull request includes several updates to the configuration files and PowerShell scripts to enhance code quality and maintainability. The most important changes include updates to the JSCPD and PSScriptAnalyzer configurations, adjustments to the module requirements in various scripts, and suppression of specific warnings. ### Configuration Updates: * [`.github/linters/.jscpd.json`](diffhunk://#diff-557094e283c00b23265c1c75872f41c6b1a524a00f0d99dd68ebd22cb63bfdd6R1-R14): Added a new configuration file for JSCPD to set the threshold to 0, specify reporters, and ignore certain paths. * [`.github/linters/.powershell-psscriptanalyzer.psd1`](diffhunk://#diff-aae69c9d6774628ed181eacf53aee0f38eb6c2f53492cf3a5b7f7bdb6ef43b6aL1-L17): Updated the PSScriptAnalyzer configuration to enable specific rules and adjust the excluded rules. ### Module Requirement Adjustments: * `scripts/helpers/Build-PSModule.ps1`, `scripts/helpers/Build/Build-PSModuleBase.ps1`, `scripts/helpers/Build/Build-PSModuleManifest.ps1`, `scripts/helpers/Build/Get-PSModuleAliasesToExport.ps1`, `scripts/helpers/Build/Get-PSModuleCmdletsToExport.ps1`, `scripts/helpers/Build/Get-PSModuleFunctionsToExport.ps1`, `scripts/helpers/Build/Get-PSModuleVariablesToExport.ps1`, `scripts/helpers/Build/Import-PSModule.ps1`, `scripts/helpers/Build/Resolve-PSModuleDependency.ps1`, `scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1`, `scripts/main.ps1`: Re-added the `#Requires -Modules` directive for required modules and added suppression for `PSAvoidUsingWriteHost` warnings. [[1]](diffhunk://#diff-c688e346ad60fbe881bd05b6a5dbc1cd712fdca0bf8b8527965db583af825fd9R10-R19) [[2]](diffhunk://#diff-1ab7417b36702be4629b208ad7dd9ec76f94998bb625c4810edda2f9b5dbddb8R14-R22) [[3]](diffhunk://#diff-50cfb011f5c8aeef8145003927ec3e5edfdf26e5d417bcee6e441517c07454f9R14-R15) [[4]](diffhunk://#diff-ae18191466ffa02c1a8429365cf96d8768f5eae03331c4a35199f8cd961e76a7R13-R17) [[5]](diffhunk://#diff-f542f4a75d778df60fee6e176c795e133be2ed109d8212c05aa545383bd26c46R13-R17) [[6]](diffhunk://#diff-d35d4bdcf90f10b73b3318d21c09dd5f8b9ca52fef3d2aa84ac0d0388011ee29R13-R16) [[7]](diffhunk://#diff-e2148fcf63283d70b3d432f67fc98191e2cc712dc3f4d30914c8c0810d11a6deR13-R16) [[8]](diffhunk://#diff-15f2301e39f56f54fa469db56cc7c487e2df36eb295bb74e8d2325aabcd164c0R15-R19) [[9]](diffhunk://#diff-b278dc96f784d462b15a4fe67b088a5b5d9cc502dd6eba3d660da085e576652fR19-R25) [[10]](diffhunk://#diff-faeb855accbc346b12f7a0ece1d91f67e26e8929ab8133aedca4051d179c66faR14-R19) [[11]](diffhunk://#diff-dc2e5a659836b1b73abb03421c567f5018c2755677c4a0aa764cb26117b68011L1-R9) ### License Update: * `LICENSE`: Updated the copyright year from 2024 to 2025. (F75789b6L1) ### Linter Workflow Adjustment: * [`.github/workflows/Linter.yml`](diffhunk://#diff-482e65806ed9e4a7320f14964764086b91fed4a28d12e4efde1776472e147e79L30-R30): Changed the validation setting from `VALIDATE_JSCPD` to `VALIDATE_JSON_PRETTIER`. ### Script Output Adjustments: * `tests/tools/1-build.ps1`, `tests/tools/2-build.ps1`: Changed the output from `Write-Host` to a direct string output. [[1]](diffhunk://#diff-de6d50a7c32f536bea22dc71c6514d47d7d54d859ef5473045ac801f055ac380L1-R1) [[2]](diffhunk://#diff-e522bb466e514d213416a3b0ab344605da146583de06b3b94fa5cce84d370109L1-R1) ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent b75256c commit 8819705

20 files changed

+682
-81
lines changed

.github/linters/.jscpd.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"threshold": 0,
3+
"reporters": [
4+
"consoleFull"
5+
],
6+
"ignore": [
7+
"**/tests/**",
8+
"**/.github/workflows/Action-Test.yml",
9+
"**/scripts/helpers/Build/Build-PSModuleManifest.ps1",
10+
"**/scripts/helpers/Build/Build-PSModuleRootModule.ps1",
11+
"**/scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1"
12+
],
13+
"absolute": true
14+
}
Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,56 @@
1-
#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/Cmdlets/Invoke-ScriptAnalyzer.md#-settings
2-
@{
3-
#CustomRulePath='path\to\CustomRuleModule.psm1'
4-
#RecurseCustomRulePath='path\of\customrules'
5-
#Severity = @(
6-
# 'Error'
7-
# 'Warning'
8-
#)
9-
#IncludeDefaultRules=${true}
1+
@{
2+
Rules = @{
3+
PSAlignAssignmentStatement = @{
4+
Enable = $true
5+
CheckHashtable = $true
6+
}
7+
PSAvoidLongLines = @{
8+
Enable = $true
9+
MaximumLineLength = 150
10+
}
11+
PSAvoidSemicolonsAsLineTerminators = @{
12+
Enable = $true
13+
}
14+
PSPlaceCloseBrace = @{
15+
Enable = $true
16+
NewLineAfter = $false
17+
IgnoreOneLineBlock = $true
18+
NoEmptyLineBefore = $false
19+
}
20+
PSPlaceOpenBrace = @{
21+
Enable = $true
22+
OnSameLine = $true
23+
NewLineAfter = $true
24+
IgnoreOneLineBlock = $true
25+
}
26+
PSProvideCommentHelp = @{
27+
Enable = $true
28+
ExportedOnly = $false
29+
BlockComment = $true
30+
VSCodeSnippetCorrection = $false
31+
Placement = 'begin'
32+
}
33+
PSUseConsistentIndentation = @{
34+
Enable = $true
35+
IndentationSize = 4
36+
PipelineIndentation = 'IncreaseIndentationForFirstPipeline'
37+
Kind = 'space'
38+
}
39+
PSUseConsistentWhitespace = @{
40+
Enable = $true
41+
CheckInnerBrace = $true
42+
CheckOpenBrace = $true
43+
CheckOpenParen = $true
44+
CheckOperator = $true
45+
CheckPipe = $true
46+
CheckPipeForRedundantWhitespace = $true
47+
CheckSeparator = $true
48+
CheckParameter = $true
49+
IgnoreAssignmentOperatorInsideHashTable = $true
50+
}
51+
}
1052
ExcludeRules = @(
11-
'PSMissingModuleManifestField'
12-
'PSAvoidUsingWriteHost'
53+
'PSMissingModuleManifestField', # This rule is not applicable until the module is built.
54+
'PSUseToExportFieldsInManifest'
1355
)
14-
#IncludeRules = @(
15-
# 'PSAvoidUsingWriteHost',
16-
# 'MyCustomRuleName'
17-
#)
1856
}

0 commit comments

Comments
 (0)