Skip to content

Commit

Permalink
chore: fix pylint message use-set-for-membership
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Troeger <[email protected]>
  • Loading branch information
jenstroeger committed Oct 2, 2024
1 parent 6b9742d commit 10140a7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ fail-under = 10.0
suggestion-mode = true # Remove this setting when pylint v4 is released.
load-plugins = [
"pylint.extensions.for_any_all",
"pylint.extensions.set_membership",
]
disable = [
"fixme",
Expand Down
2 changes: 1 addition & 1 deletion src/macaron/repo_finder/provenance_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def find_provenance(self, purl: PackageURL) -> list[InTotoPayload]:
discovery_functions = [partial(find_npm_provenance, purl, self.npm_registry)]
return self._find_provenance(discovery_functions)

if purl.type in ["gradle", "maven"]:
if purl.type in {"gradle", "maven"}:
# TODO add support for Maven Central provenance.
if not self.jfrog_registry:
logger.debug("Missing JFrog registry to find provenance in.")
Expand Down
4 changes: 2 additions & 2 deletions src/macaron/repo_finder/repo_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def find_repo(purl: PackageURL) -> str:
repo_finder: BaseRepoFinder
if purl.type == "maven":
repo_finder = JavaRepoFinder()
elif defaults.getboolean("repofinder", "use_open_source_insights") and purl.type in [
elif defaults.getboolean("repofinder", "use_open_source_insights") and purl.type in {
"pypi",
"nuget",
"cargo",
"npm",
]:
}:
repo_finder = DepsDevRepoFinder()
else:
logger.debug("No Repo Finder found for package type: %s of %s", purl.type, purl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def build_call_graph_from_node(node: GitHubWorkflowNode, repo_path: str) -> None
# Right now, the script with the default shell is passed to the parser, which will fail
# if the runner is Windows and Powershell is used. But there is no easy way to avoid passing
# the script because that means we need to accurately determine the runner's OS.
if step.get("run") and ("shell" not in step or step["shell"] in ["bash", "sh"]):
if step.get("run") and ("shell" not in step or step["shell"] in {"bash", "sh"}):
try:
name = "UNKNOWN"
node_id = None
Expand Down
4 changes: 2 additions & 2 deletions src/macaron/slsa_analyzer/git_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def parse_remote_url(
res_netloc = ""

# e.g., https://github.com/owner/project.git
if parsed_url.scheme in ("http", "https", "ftp", "ftps", "git+https"):
if parsed_url.scheme in {"http", "https", "ftp", "ftps", "git+https"}:
if parsed_url.netloc not in allowed_git_service_hostnames:
return None
path_params = parsed_url.path.strip("/").split("/")
Expand All @@ -651,7 +651,7 @@ def parse_remote_url(
# e.g.:
# ssh://git@hostname:port/owner/project.git
# ssh://git@hostname:owner/project.git
elif parsed_url.scheme in ("ssh", "git+ssh"):
elif parsed_url.scheme in {"ssh", "git+ssh"}:
user_host, _, port = parsed_url.netloc.partition(":")
user, _, host = user_host.rpartition("@")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, expectation_paths: list[str]) -> None:

for expectation_path in expectation_paths:
_, ext = os.path.splitext(expectation_path)
if ext in (".cue",):
if ext == ".cue":
expectation = CUEExpectation.make_expectation(expectation_path)
if expectation and expectation.target:
self.expectations[expectation.target] = expectation
Expand Down

0 comments on commit 10140a7

Please sign in to comment.