MCPcopy
hub / github.com/GitGuardian/ggshield / parser

Method parser

ggshield/core/scan/commit.py:62–75  ·  view source on GitHub ↗
(commit: "Commit")

Source from the content-addressed store, hash-verified

60 info = CommitInformation.from_sha(sha, cwd=cwd)
61
62 def parser(commit: "Commit") -> Iterable[Scannable]:
63 for paths in batched(commit.info.paths, _MAX_DOCS_PER_COMMIT):
64 cmd = ["show", sha, *PATCH_COMMON_ARGS, "--"]
65
66 # Append paths to the command-line. If the file has been renamed, append
67 # both old and new paths. If we only append the new path then `git
68 # show` returns the new path as an added file.
69 for path in paths:
70 if old_path := commit.info.renames.get(path):
71 cmd.append(str(old_path))
72 cmd.append(str(path))
73
74 patch = git(cmd, cwd=cwd)
75 yield from parse_patch(sha, patch, exclusion_regexes)
76
77 return Commit(sha, parser, info)
78

Callers

nothing calls this directly

Calls 4

batchedFunction · 0.90
gitFunction · 0.90
parse_patchFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected