Skip to content

Commit

Permalink
chore(deps-dev): Bump ruff from 0.0.254 to 0.1.1 (#352)
Browse files Browse the repository at this point in the history
* chore(deps-dev): Bump ruff from 0.0.254 to 0.1.1

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.254 to 0.1.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@v0.0.254...v0.1.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* auto-fixes from new ruff

Signed-off-by: Will Murphy <[email protected]>

* chore: Disable lints for ruff upgrade

We want to use latest ruff, but be selective about how much diff we
introduce into vunnel at once. Therefore, bump ruff, but mostly disable
new lints.

Signed-off-by: Will Murphy <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Will Murphy <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Will Murphy <[email protected]>
  • Loading branch information
dependabot[bot] and willmurphyscode authored Oct 23, 2023
1 parent ec10925 commit 7cc7e5b
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 39 deletions.
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ types-requests = "^2.28.11.7"
mypy = "^1.1"
radon = ">=5.1,<7.0"
dunamai = "^1.15.0"
ruff = "^0.0.254"
ruff = ">=0.0.254,<0.1.2"
yardstick = {git = "https://github.com/anchore/yardstick", rev = "v0.7.0"}
tabulate = "0.9.0"

Expand Down
2 changes: 1 addition & 1 deletion src/vunnel/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def clear_provider(cfg: config.Application, provider_names: str, _input: bool, r
@click.argument("provider_names", metavar="PROVIDER", nargs=-1)
@click.option("--show-empty", default=False, is_flag=True, help="show providers with no state")
@click.pass_obj
def status_provider(cfg: config.Application, provider_names: str, show_empty: bool) -> None:
def status_provider(cfg: config.Application, provider_names: str, show_empty: bool) -> None: # noqa: C901
print(cfg.root)
selected_names = provider_names if provider_names else providers.names()

Expand Down
2 changes: 1 addition & 1 deletion src/vunnel/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _normalize_name(name: str) -> str:
@dataclass
class Log:
slim: bool = os.environ.get("VUNNEL_LOG_SLIM", default="false") == "true"
level: str = os.environ.get("VUNNEL_LOG_LEVEL", default="INFO")
level: str = os.environ.get("VUNNEL_LOG_LEVEL", default="INFO") # noqa: RUF009
show_timestamp: bool = os.environ.get("VUNNEL_LOG_SHOW_TIMESTAMP", default="false") == "true"
show_level: bool = os.environ.get("VUNNEL_LOG_SHOW_LEVEL", default="true") == "true"

Expand Down
4 changes: 2 additions & 2 deletions src/vunnel/providers/amazon/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _get_alas_html(self, alas_url, alas_file, skip_if_exists=True):
self.logger.debug(f"loading existing ALAS from {alas_file}")
with open(alas_file, encoding="utf-8") as fp:
content = fp.read()
return content
return content # noqa: RET504

try:
self.logger.debug(f"downloading ALAS from {alas_url}")
Expand Down Expand Up @@ -210,7 +210,7 @@ def __init__(self):

class PackagesHTMLParser(HTMLParser):
_new_packages_tuple_ = ("id", "new_packages")
_arch_list_ = ["x86_64:", "noarch:", "src:"]
_arch_list_ = ["x86_64:", "noarch:", "src:"] # noqa: RUF012

def __init__(self):
self.fixes = []
Expand Down
4 changes: 2 additions & 2 deletions src/vunnel/providers/debian/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _get_cve_to_dsalist(self, dsa):
return ns_cve_dsalist

# noqa
def _parse_dsa_record(self, dsa_lines):
def _parse_dsa_record(self, dsa_lines): # noqa: C901
"""
:param dsa_lines:
Expand Down Expand Up @@ -259,7 +259,7 @@ def _normalize_dsa_list(self):

return ns_cve_dsalist

def _normalize_json(self, ns_cve_dsalist=None): # noqa: PLR0912,PLR0915
def _normalize_json(self, ns_cve_dsalist=None): # noqa: PLR0912,PLR0915,C901
adv_mets = {}
# all_matched_dsas = set()
# all_dsas = set()
Expand Down
11 changes: 4 additions & 7 deletions src/vunnel/providers/github/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ def graphql_advisories(cursor=None, timestamp=None, vuln_cursor=None):
"%sclassifications: [GENERAL, MALWARE], first: 100, orderBy: {field: UPDATED_AT, direction: ASC}" % vuln_after
)

return """
return f"""
{{
{} {{
{caller} {{
nodes {{
ghsaId
classification
Expand All @@ -448,7 +448,7 @@ def graphql_advisories(cursor=None, timestamp=None, vuln_cursor=None):
references {{
url
}}
vulnerabilities({}) {{
vulnerabilities({vulnerabilities}) {{
pageInfo {{
endCursor
hasNextPage
Expand Down Expand Up @@ -476,10 +476,7 @@ def graphql_advisories(cursor=None, timestamp=None, vuln_cursor=None):
}}
}}
}}
""".format(
caller,
vulnerabilities,
)
"""


class NodeParser(dict):
Expand Down
1 change: 0 additions & 1 deletion src/vunnel/providers/mariner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@ def update(self, last_updated: datetime.datetime | None) -> tuple[list[str], int
schema=self.schema,
payload=record,
)
pass
return self.parser.urls, len(writer)
1 change: 0 additions & 1 deletion src/vunnel/providers/mariner/generate_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def main() -> None:
stdout, stderr = process.communicate()
print(stdout)
print(stderr)
pass


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions src/vunnel/providers/mariner/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def __init__(self, oval_file_path: str, logger: logging.Logger):
fail_on_unknown_properties=False,
)
xml_parser = XmlParser(config=parser_config)
root = etree.parse(oval_file_path)
# S320 disable explanation: the mariner linux vulnerability feed is not untrusted xml
root = etree.parse(oval_file_path) # noqa: S320
nsmap = etree.XPath("/*")(root)[0].nsmap
default = nsmap[None]
nsmap["default"] = default
Expand All @@ -47,7 +48,6 @@ def __init__(self, oval_file_path: str, logger: logging.Logger):
self.definitions.append(definition)
except Exception as ex:
self.logger.warning(f"skipping definition element in {oval_file_path} due to {ex}")
pass

self.tests_by_id = {}
for test_element in etree.XPath("//linux-def:rpminfo_test", namespaces=nsmap)(root):
Expand Down
2 changes: 1 addition & 1 deletion src/vunnel/providers/wolfi/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__( # noqa: PLR0913
url: str,
namespace: str,
download_timeout: int = 125,
logger: logging.Logger = None, # noqa: PLR0913
logger: logging.Logger | None = None, # noqa: PLR0913
):
self.download_timeout = download_timeout
self.secdb_dir_path = os.path.join(workspace.input_path, self._secdb_dir_)
Expand Down
3 changes: 2 additions & 1 deletion src/vunnel/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
logger.exception(f"failed after {retries} retries")
raise

sleep = backoff_in_seconds * 2**attempt + random.uniform(0, 1) # nosec
# explanation of S311 disable: random number is not used for cryptography
sleep = backoff_in_seconds * 2**attempt + random.uniform(0, 1) # noqa: S311
logger.warning(f"{f} failed. Retrying in {int(sleep)} seconds (attempt {attempt+1} of {retries})")
time.sleep(sleep)
attempt += 1
Expand Down

0 comments on commit 7cc7e5b

Please sign in to comment.