Skip to content
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

Fix Powershell Formatter appending new line #2239

Merged
merged 10 commits into from
Jan 10, 2023
Merged
64 changes: 32 additions & 32 deletions .automation/generated/flavors-stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -1205,8 +1205,8 @@
2727354
],
[
"2023-01-09T23:13:18",
2729520
"2023-01-10T17:02:05",
2730643
]
],
"ci_light": [
Expand Down Expand Up @@ -2415,8 +2415,8 @@
41903
],
[
"2023-01-09T23:13:18",
42265
"2023-01-10T17:02:05",
42414
]
],
"cupcake": [
Expand Down Expand Up @@ -2605,8 +2605,8 @@
1424
],
[
"2023-01-09T23:13:18",
1454
"2023-01-10T17:02:05",
1464
]
],
"dart": [
Expand Down Expand Up @@ -4725,8 +4725,8 @@
101154
],
[
"2023-01-09T23:13:18",
101705
"2023-01-10T17:02:05",
101950
]
],
"dotnet": [
Expand Down Expand Up @@ -5935,8 +5935,8 @@
337598
],
[
"2023-01-09T23:13:18",
338154
"2023-01-10T17:02:05",
338483
]
],
"go": [
Expand Down Expand Up @@ -7145,8 +7145,8 @@
15956
],
[
"2023-01-09T23:13:18",
15997
"2023-01-10T17:02:05",
16005
]
],
"java": [
Expand Down Expand Up @@ -8355,8 +8355,8 @@
104842
],
[
"2023-01-09T23:13:18",
105028
"2023-01-10T17:02:05",
105128
]
],
"javascript": [
Expand Down Expand Up @@ -9565,8 +9565,8 @@
183754
],
[
"2023-01-09T23:13:18",
184760
"2023-01-10T17:02:05",
185090
]
],
"php": [
Expand Down Expand Up @@ -10775,8 +10775,8 @@
35001
],
[
"2023-01-09T23:13:18",
37122
"2023-01-10T17:02:05",
37293
]
],
"python": [
Expand Down Expand Up @@ -11985,8 +11985,8 @@
143981
],
[
"2023-01-09T23:13:18",
144627
"2023-01-10T17:02:05",
144961
]
],
"ruby": [
Expand Down Expand Up @@ -13191,8 +13191,8 @@
2802
],
[
"2023-01-09T23:13:18",
2805
"2023-01-10T17:02:05",
2807
]
],
"rust": [
Expand Down Expand Up @@ -14397,8 +14397,8 @@
4393
],
[
"2023-01-09T23:13:18",
4400
"2023-01-10T17:02:05",
4406
]
],
"salesforce": [
Expand Down Expand Up @@ -15607,8 +15607,8 @@
15939
],
[
"2023-01-09T23:13:18",
15956
"2023-01-10T17:02:05",
15966
]
],
"scala": [
Expand Down Expand Up @@ -16815,8 +16815,8 @@
1981
],
[
"2023-01-09T23:13:18",
2011
"2023-01-10T17:02:05",
2013
]
],
"swift": [
Expand Down Expand Up @@ -18021,8 +18021,8 @@
3078
],
[
"2023-01-09T23:13:18",
3082
"2023-01-10T17:02:05",
3086
]
],
"terraform": [
Expand Down Expand Up @@ -19231,8 +19231,8 @@
157268
],
[
"2023-01-09T23:13:18",
158035
"2023-01-10T17:02:05",
158374
]
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ All linters are integrated in the [MegaLinter docker image](https://hub.docker.c
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/rst.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**RST**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst.md) | [**rst-lint**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst_rst_lint.md)<br/>[_RST_RST_LINT_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst_rst_lint.md) | [![GitHub stars](https://img.shields.io/github/stars/twolfson/restructuredtext-lint?cacheSeconds=3600)](https://github.com/twolfson/restructuredtext-lint) |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/rst.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**RST**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst.md) | [**rstcheck**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst_rstcheck.md)<br/>[_RST_RSTCHECK_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst_rstcheck.md) | [![GitHub stars](https://img.shields.io/github/stars/myint/rstcheck?cacheSeconds=3600)](https://github.com/myint/rstcheck) |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/rst.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**RST**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst.md) | [**rstfmt**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst_rstfmt.md)<br/>[_RST_RSTFMT_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/rst_rstfmt.md) | ![formatter](https://shields.io/badge/-format-yellow) |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/xml.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**XML**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/xml.md) | [**xmllint**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/xml_xmllint.md)<br/>[_XML_XMLLINT_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/xml_xmllint.md) | |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/xml.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**XML**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/xml.md) | [**xmllint**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/xml_xmllint.md)<br/>[_XML_XMLLINT_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/xml_xmllint.md) | ![autofix](https://shields.io/badge/-autofix-green) |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/yaml.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**YAML**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml.md) | [**prettier**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml_prettier.md)<br/>[_YAML_PRETTIER_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml_prettier.md) | [![GitHub stars](https://img.shields.io/github/stars/prettier/prettier?cacheSeconds=3600)](https://github.com/prettier/prettier) ![formatter](https://shields.io/badge/-format-yellow) |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/yaml.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**YAML**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml.md) | [**yamllint**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml_yamllint.md)<br/>[_YAML_YAMLLINT_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml_yamllint.md) | [![GitHub stars](https://img.shields.io/github/stars/adrienverge/yamllint?cacheSeconds=3600)](https://github.com/adrienverge/yamllint) |
| <img src="https://github.com/oxsecurity/megalinter/raw/main/docs/assets/icons/yaml.ico" alt="" height="32px" class="megalinter-icon"></a> <!-- linter-icon --> | [**YAML**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml.md) | [**v8r**](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml_v8r.md)<br/>[_YAML_V8R_](https://github.com/oxsecurity/megalinter/tree/main/docs/descriptors/yaml_v8r.md) | [![GitHub stars](https://img.shields.io/github/stars/chris48s/v8r?cacheSeconds=3600)](https://github.com/chris48s/v8r) |
Expand Down
17 changes: 17 additions & 0 deletions TEMPLATES/.powershell-formatter.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/markdown/Invoke-ScriptAnalyzer.md#-settings
@{
#CustomRulePath='path\to\CustomRuleModule.psm1'
#RecurseCustomRulePath='path\of\customrules'
#Severity = @(
# 'Error'
# 'Warning'
#)
#IncludeDefaultRules=${true}
ExcludeRules = @(
'PSMissingModuleManifestField'
)
#IncludeRules = @(
# 'PSAvoidUsingWriteHost',
# 'MyCustomRuleName'
#)
}
2 changes: 2 additions & 0 deletions docs/descriptors/powershell_powershell_formatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: How to use powershell_formatter (configure, ignore files, ignore er
- Version in MegaLinter: **7.3.1**
- Visit [Official Web Site](https://github.com/PowerShell/PSScriptAnalyzer#readme){target=_blank}
- See [How to configure powershell_formatter rules](https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer?view=ps-modules#explicit){target=_blank}
- If custom `.powershell-formatter.psd1` config file is not found, [.powershell-formatter.psd1](https://github.com/oxsecurity/megalinter/tree/main/TEMPLATES/.powershell-formatter.psd1){target=_blank} will be used
- See [How to disable powershell_formatter rules in files](https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer?view=ps-modules#suppressing-rules){target=_blank}
- See [Index of problems detected by powershell_formatter](https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/rules/readme?view=ps-modules){target=_blank}

Expand All @@ -24,6 +25,7 @@ description: How to use powershell_formatter (configure, ignore files, ignore er

| Variable | Description | Default value |
|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| POWERSHELL_POWERSHELL_FORMATTER_OUTPUT_ENCODING | `-Encoding` to be used when writing content to the file | `utf8` |
| POWERSHELL_POWERSHELL_FORMATTER_ARGUMENTS | User custom arguments to add in linter CLI call<br/>Ex: `-s --foo "bar"` | |
| POWERSHELL_POWERSHELL_FORMATTER_FILTER_REGEX_INCLUDE | Custom regex including filter<br/>Ex: `(src\|lib)` | Include every file |
| POWERSHELL_POWERSHELL_FORMATTER_FILTER_REGEX_EXCLUDE | Custom regex excluding filter<br/>Ex: `(test\|examples)` | Exclude no file |
Expand Down
6 changes: 3 additions & 3 deletions docs/descriptors/xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ description: xmllint is available to analyze XML files in MegaLinter

## Linters

| Linter | Additional |
|-------------------------------------------------------------------|------------|
| [**xmllint**](xml_xmllint.md)<br/>[_XML_XMLLINT_](xml_xmllint.md) | |
| Linter | Additional |
|-------------------------------------------------------------------|-----------------------------------------------------|
| [**xmllint**](xml_xmllint.md)<br/>[_XML_XMLLINT_](xml_xmllint.md) | ![autofix](https://shields.io/badge/-autofix-green) |

## Linted files

Expand Down
3 changes: 3 additions & 0 deletions docs/descriptors/xml_xmllint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: How to use xmllint (configure, ignore files, ignore errors, help &
<!-- markdownlint-disable MD033 MD041 -->
<!-- @generated by .automation/build.py, please do not update manually -->
# xmllint
![autofix](https://shields.io/badge/-autofix-green)

## xmllint documentation

Expand All @@ -17,6 +18,8 @@ description: How to use xmllint (configure, ignore files, ignore errors, help &
- Enable xmllint by adding `XML_XMLLINT` in [ENABLE_LINTERS variable](https://megalinter.io/beta/configuration/#activation-and-deactivation)
- Disable xmllint by adding `XML_XMLLINT` in [DISABLE_LINTERS variable](https://megalinter.io/beta/configuration/#activation-and-deactivation)

- Enable **auto-fixes** by adding `XML_XMLLINT` in [APPLY_FIXES variable](https://megalinter.io/beta/configuration/#apply-fixes)

| Variable | Description | Default value |
|-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
| XML_XMLLINT_ARGUMENTS | User custom arguments to add in linter CLI call<br/>Ex: `-s --foo "bar"` | |
Expand Down
Loading