1
0
Fork 0
mirror of synced 2024-06-02 18:34:37 +12:00

B607/603 coverage

This commit is contained in:
OMEGARAZER 2023-04-20 15:42:53 -04:00
parent 54b242fe9c
commit a8c757072b
No known key found for this signature in database
GPG key ID: D89925310D306E35
2 changed files with 10 additions and 4 deletions

View file

@ -23,7 +23,9 @@ class Completion:
for point in self.entry_points:
self.env[f"_{point.upper().replace('-', '_')}_COMPLETE"] = "bash_source"
with Path(comp_dir + point).open(mode="w") as file:
file.write(subprocess.run([point], env=self.env, capture_output=True, text=True).stdout)
file.write(
subprocess.run([point], env=self.env, capture_output=True, text=True).stdout, # noqa: S603
)
print(f"Bash completion for {point} written to {comp_dir}{point}")
if self.shell in ("all", "fish"):
comp_dir = self.share_dir + "/fish/vendor_completions.d/"
@ -33,7 +35,9 @@ class Completion:
for point in self.entry_points:
self.env[f"_{point.upper().replace('-', '_')}_COMPLETE"] = "fish_source"
with Path(comp_dir + point + ".fish").open(mode="w") as file:
file.write(subprocess.run([point], env=self.env, capture_output=True, text=True).stdout)
file.write(
subprocess.run([point], env=self.env, capture_output=True, text=True).stdout, # noqa: S603
)
print(f"Fish completion for {point} written to {comp_dir}{point}.fish")
if self.shell in ("all", "zsh"):
comp_dir = self.share_dir + "/zsh/site-functions/"
@ -43,7 +47,9 @@ class Completion:
for point in self.entry_points:
self.env[f"_{point.upper().replace('-', '_')}_COMPLETE"] = "zsh_source"
with Path(comp_dir + "_" + point).open(mode="w") as file:
file.write(subprocess.run([point], env=self.env, capture_output=True, text=True).stdout)
file.write(
subprocess.run([point], env=self.env, capture_output=True, text=True).stdout, # noqa: S603
)
print(f"Zsh completion for {point} written to {comp_dir}_{point}")
def uninstall(self) -> None:

View file

@ -171,7 +171,7 @@ class FileNameFormatter:
@staticmethod
def find_max_path_length() -> int:
try:
return int(subprocess.check_output(["getconf", "PATH_MAX", "/"]))
return int(subprocess.check_output(["getconf", "PATH_MAX", "/"])) # noqa: S603, S607
except (ValueError, subprocess.CalledProcessError, OSError):
if platform.system() == "Windows":
return FileNameFormatter.WINDOWS_MAX_PATH_LENGTH