Merge pull request #3192 from miradnanali/fix-filename-quoting-for-lint

fix: Use shlex.quote() to enable linting filepaths containing shell metacharacters
This commit is contained in:
paul-gauthier 2025-03-28 19:07:53 -10:00 committed by GitHub
commit 8df5406986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,7 @@ import subprocess
import sys import sys
import traceback import traceback
import warnings import warnings
import shlex
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
@ -44,7 +45,7 @@ class Linter:
return fname return fname
def run_cmd(self, cmd, rel_fname, code): def run_cmd(self, cmd, rel_fname, code):
cmd += " " + rel_fname cmd += " " + shlex.quote(rel_fname)
returncode = 0 returncode = 0
stdout = "" stdout = ""