Skip to content

Commit a4813bf

Browse files
🩹 [Patch]: Add linter configurations and update .gitignore for VS Code (#15)
## Description This pull request focuses on adding and configuring various linters for the project, as well as making some minor adjustments to PowerShell scripts. The most important changes include adding configuration files for JavaScript Copy/Paste Detector (jscpd), Markdown linter, and PowerShell Script Analyzer, updating the GitHub Actions workflow for the linter, and modifying PowerShell scripts to include necessary module requirements and suppress specific warnings. ### Linter Configuration: * Added `.jscpd.json` configuration file to set up JavaScript Copy/Paste Detector with a threshold of 0 and specific reporters and ignore patterns. * Added `.markdown-lint.yml` configuration file to define rules for the Markdown linter, including settings for unordered list style, line length, and other formatting rules. * Added `.powershell-psscriptanalyzer.psd1` configuration file to enable and configure various rules for PowerShell Script Analyzer, such as consistent indentation and whitespace usage. ### GitHub Actions Workflow: * Updated `.github/workflows/Linter.yml` to use the latest version of `super-linter/super-linter` and adjusted environment variables for validating JSON and Markdown files. ### PowerShell Scripts: * Modified `Build-PSModuleDocumentation.ps1`, `Import-PSModule.ps1`, and `Resolve-PSModuleDependency.ps1` to include `#Requires` statements for necessary modules and added suppression for `PSAvoidUsingWriteHost` warnings to ensure proper script execution. [[1]](diffhunk://#diff-95b236851bd9052577a2cdf569f08e195e7d6cc424f6cb6d074ccc10b2cb7241L1-R1) [[2]](diffhunk://#diff-e4bfa9c4a169541b0894ed0c4f60df9fcde101f9bd11ea736e8c8173b15de476L1-R1) [[3]](diffhunk://#diff-48557b471e7d62a89be3627235334ab8a39eb6119174abb61714b92d844508e2L1-R1) * Adjusted `scripts/main.ps1` to suppress `PSAvoidUsingWriteHost` warnings and added `#Requires -Modules Utilities` to ensure all required modules are loaded. ## 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 c1b2255 commit a4813bf

File tree

10 files changed

+659
-42
lines changed

10 files changed

+659
-42
lines changed

.github/linters/.jscpd.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"threshold": 0,
3+
"reporters": [
4+
"consoleFull"
5+
],
6+
"ignore": [
7+
"**/tests/**"
8+
],
9+
"absolute": true
10+
}

.github/linters/.markdown-lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
###########################
2+
## Markdown Linter rules ##
3+
###########################
4+
5+
# Linter rules doc:
6+
# - https://github.com/DavidAnson/markdownlint
7+
8+
###############
9+
# Rules by id #
10+
###############
11+
MD004: false # Unordered list style
12+
MD007:
13+
indent: 2 # Unordered list indentation
14+
MD013:
15+
line_length: 808 # Line length
16+
MD026:
17+
punctuation: ".,;:!。,;:" # List of not allowed
18+
MD029: false # Ordered list item prefix
19+
MD033: false # Allow inline HTML
20+
MD036: false # Emphasis used instead of a heading
21+
22+
#################
23+
# Rules by tags #
24+
#################
25+
blank_lines: false # Error on blank lines
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
}
52+
ExcludeRules = @(
53+
'PSMissingModuleManifestField', # This rule is not applicable until the module is built.
54+
'PSUseToExportFieldsInManifest'
55+
)
56+
}

0 commit comments

Comments
 (0)