Skip to content

Commit 1fd648f

Browse files
🩹 [Patch]: Update linter and git configuration (#97)
## Description This pull request includes several updates to configuration files and scripts, primarily focusing on code quality and compliance improvements. The most significant changes include updating linter configurations, modifying PowerShell script settings, and updating the license year. ### Linter Configuration Updates: * Added a new `.jscpd.json` configuration file to set up code duplication detection with specific thresholds and ignore patterns. * Updated `.powershell-psscriptanalyzer.psd1` to enable specific rules and adjust settings for PowerShell script analysis. * Updated `.github/workflows/Linter.yml` to disable JSON Prettier validation. ### PowerShell Script Updates: * Added `SuppressMessageAttribute` to suppress specific PSScriptAnalyzer rules in `Resolve-PSModuleDependency.ps1` and `Test-PSModule.ps1`. [[1]](diffhunk://#diff-48557b471e7d62a89be3627235334ab8a39eb6119174abb61714b92d844508e2R21-R25) [[2]](diffhunk://#diff-2100eb52126417766eeb5b98f9c6a0da1dd10302b3b7c05d476295e3bd76ce76R12-R15) * Added `SuppressMessageAttribute` to the main script `main.ps1` to suppress the `PSAvoidUsingWriteHost` rule. ### License Update: * Updated the license year in the `LICENSE` file from 2024 to 2025. ## 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 49dd4d7 commit 1fd648f

File tree

9 files changed

+600
-25
lines changed

9 files changed

+600
-25
lines changed

.github/linters/.jscpd.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"threshold": 0,
3+
"reporters": [
4+
"consoleFull"
5+
],
6+
"ignore": [
7+
"**/tests/**",
8+
"**/.github/workflows/Action-Test*"
9+
],
10+
"absolute": true
11+
}
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)