Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion locale/grass_po_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_stats(languages, directory):
fpref = flang.split("_")[0]
# run msgfmt for statistics
# TODO check if it's working on windows
process = subprocess.Popen(
process = subprocess.Popen( # nosec B607: fixed external tool "msgfmt" with no portable absolute path
["msgfmt", "--statistics", os.path.join(directory, flang)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down
6 changes: 3 additions & 3 deletions python/grass/gunittest/reporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_svn_revision():
"""
# TODO: here should be starting directory
# but now we are using current as starting
with subprocess.Popen(
with subprocess.Popen( # nosec B607: fixed external tool "svnversion" with no portable absolute path
["svnversion", "."], stdout=subprocess.PIPE, stderr=subprocess.PIPE
) as p:
stdout, stderr = p.communicate()
Expand All @@ -197,7 +197,7 @@ def get_svn_info():
"""
try:
# TODO: introduce directory, not only current
with subprocess.Popen(
with subprocess.Popen( # nosec B607: fixed external tool "svn" with no portable absolute path
["svn", "info", ".", "--xml"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down Expand Up @@ -252,7 +252,7 @@ def get_svn_path_authors(path, from_date=None):
revision_range = "BASE:1" if from_date is None else "BASE:{%s}" % from_date
try:
# TODO: allow also usage of --limit
with subprocess.Popen(
with subprocess.Popen( # nosec B607: fixed external tool "svn" with no portable absolute path
["svn", "log", "--xml", "--revision", revision_range, path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down
2 changes: 1 addition & 1 deletion scripts/g.manual/g.manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def start_man(entry):

for ext in ["", ".gz", ".bz2"]:
if Path(path + ext).exists():
os.execlp("man", "man", path + ext)
os.execlp("man", "man", path + ext) # nosec B607: runs the user's system "man" (PATH lookup intended)
grass.fatal(_("Error starting 'man' for '%s'") % path)
grass.fatal(_("No manual page entry for '%s'") % entry)

Expand Down
2 changes: 1 addition & 1 deletion utils/coverage_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def get_grass_config_path():
grass_config_path = None
try:
grass_config_path = subprocess.run(
grass_config_path = subprocess.run( # nosec B607: fixed external tool "grass" with no portable absolute path
["grass", "--config", "path"], capture_output=True, text=True, check=True
).stdout.rstrip()
except OSError:
Expand Down
2 changes: 1 addition & 1 deletion utils/generate_last_commit_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_last_commit(src_dir):
if ".html{}".format(join_sep) not in join_sep.join(files) + join_sep:
continue
rel_path = os.path.relpath(root)
process_result = subprocess.run(
process_result = subprocess.run( # nosec B607: fixed external tool "git" with no portable absolute path
[
"git",
"log",
Expand Down
8 changes: 4 additions & 4 deletions utils/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def adjust_after(lines):
username = username.replace("@", "")
if username in known_bot_names:
continue
output = subprocess.run(
output = subprocess.run( # nosec B607: fixed external tool "gh" with no portable absolute path
["gh", "api", f"users/{username}"],
capture_output=True,
text=True,
Expand Down Expand Up @@ -203,7 +203,7 @@ def print_notes(

def notes_from_gh_api(start_tag, end_tag, branch, categories, exclude):
"""Generate notes from GitHub API"""
text = subprocess.run(
text = subprocess.run( # nosec B607: fixed external tool "gh" with no portable absolute path
[
"gh",
"api",
Expand Down Expand Up @@ -255,7 +255,7 @@ def csv_to_dict(filename, key, value):

def notes_from_git_log(start_tag, end_tag, categories, exclude):
"""Generate notes from git log"""
text = subprocess.run(
text = subprocess.run( # nosec B607: fixed external tool "git" with no portable absolute path
["git", "log", f"{start_tag}..{end_tag}", f"--pretty=format:{PRETTY_TEMPLATE}"],
capture_output=True,
text=True,
Expand Down Expand Up @@ -337,7 +337,7 @@ def create_release_notes(args):
end_tag = args.end_tag
if not end_tag:
# git log has default, but the others do not.
end_tag = subprocess.run(
end_tag = subprocess.run( # nosec B607: fixed external tool "git" with no portable absolute path
["git", "rev-parse", "--verify", "HEAD"],
capture_output=True,
text=True,
Expand Down
4 changes: 2 additions & 2 deletions utils/md_isvalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def check_md(filename):
with subprocess.Popen(["mdl", filename]) as p:
with subprocess.Popen(["mdl", filename]) as p: # nosec B607: fixed external tool "mdl" with no portable absolute path
p.wait()


Expand All @@ -29,7 +29,7 @@ def check_module(module):
with open(tmp_file, "w") as fp:
with subprocess.Popen([module, "--md-description"], stdout=fp) as p:
p.wait()
with subprocess.Popen(
with subprocess.Popen( # nosec B607: fixed external tool "mdl" with no portable absolute path
[
"mdl",
"--style",
Expand Down
8 changes: 4 additions & 4 deletions utils/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_version_branch(major_version, addons_git_repo_url):
"""
version_branch = f"grass{major_version}"
if source_is_remote():
branch = subprocess.Popen(
branch = subprocess.Popen( # nosec B607: fixed external tool "git" with no portable absolute path
[
"git",
"ls-remote",
Expand Down Expand Up @@ -110,7 +110,7 @@ def has_src_code_git(src_dir):
actual_dir = Path.cwd()
os.chdir(src_dir)
try:
process_result = subprocess.run(
process_result = subprocess.run( # nosec B607: fixed external tool "git" with no portable absolute path
[
"git",
"log",
Expand Down Expand Up @@ -399,7 +399,7 @@ def get_addon_path(base_url, pgm, major_version):
try:
with tempfile.TemporaryDirectory(dir=addons_base_dir) as tmpdir:
tmp_clone_path = Path(tmpdir) / "grass-addons"
subprocess.call(
subprocess.call( # nosec B607: fixed external tool "git" with no portable absolute path
[
"git",
"clone",
Expand All @@ -415,7 +415,7 @@ def get_addon_path(base_url, pgm, major_version):
except (shutil.Error, OSError):
if not grass_addons_dir.exists():
raise
addons_file_list = subprocess.Popen(
addons_file_list = subprocess.Popen( # nosec B607: fixed external tool "git" with no portable absolute path
["git", "ls-tree", "--name-only", "-r", addons_branch],
cwd=grass_addons_dir,
stdout=subprocess.PIPE,
Expand Down
Loading