Skip to content

Commit

Permalink
Only overwrite the file if apply_fixes = True
Browse files Browse the repository at this point in the history
  • Loading branch information
bdovaz committed Jan 10, 2023
1 parent 0aee3e3 commit ba2e214
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion megalinter/linters/PowershellLinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def build_lint_command(self, file=None):
file_encoding = config.get("POWERSHELL_POWERSHELL_FORMATTER_OUTPUT_ENCODING", "utf8")

pwsh_script[0] += f" -ScriptDefinition (Get-Content -Path '{file}' -Raw)"
pwsh_script[0] += f" | Out-File '{file}' -Encoding {file_encoding} -NoNewline"

if (self.apply_fixes is True):
pwsh_script[0] += f" | Out-File '{file}' -Encoding {file_encoding} -NoNewline"

if (
self.linter_name == "powershell"
Expand Down

0 comments on commit ba2e214

Please sign in to comment.