Skip to content

Commit

Permalink
[ci] Update linters
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Jun 7, 2024
1 parent aacfa41 commit a75bfdb
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 14 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: ['--py38-plus']
- repo: https://github.com/ambv/black
rev: 23.11.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -41,16 +41,16 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
exclude_types: [json]
- repo: https://github.com/marco-c/taskcluster_yml_validator
rev: v0.0.10
rev: v0.0.11
hooks:
- id: taskcluster_yml
- repo: https://github.com/MozillaSecurity/orion
rev: v0.0.7
- repo: https://github.com/MozillaSecurity/orion-ci
rev: v0.0.8
hooks:
- id: orion_ci
- repo: meta
Expand Down
2 changes: 1 addition & 1 deletion grizzly/common/status_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def from_file(
ignore_kbi: Skip/ignore KeyboardInterrupt.
Returns:
TracebackReport containing data from givin log file.
TracebackReport containing data from given log file.
"""
token = b"Traceback (most recent call last):"
assert len(token) < cls.READ_LIMIT
Expand Down
8 changes: 7 additions & 1 deletion loki/loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _fuzz_data(in_data: bytes, byte_order: str) -> bytes:

fuzz_op = randint(0, 4)
if fuzz_op == 0: # boundary
out_data = (2 ** randint(2, data_size * 8)) + randint(-2, 2)
out_data: int = (2 ** randint(2, data_size * 8)) + randint(-2, 2)
elif fuzz_op == 1: # arithmetic
out_data = unpack(pack_unit, in_data)[0] + randint(-10, 10)
elif fuzz_op == 2: # interesting byte, short or int
Expand All @@ -80,6 +80,12 @@ def _fuzz_data(in_data: bytes, byte_order: str) -> bytes:
out_data = randint(1, 0x1FFF) * 8
elif data_size == 4: # multiple of 8
out_data = randint(1, 0x1FFFFFFF) * 8
else: # pragma: no cover
# this should be unreachable
raise RuntimeError(f"Unsupported data size: {data_size}")
else: # pragma: no cover
# this should be unreachable
raise AssertionError(f"Invalid fuzz op: {fuzz_op}")

return pack(pack_unit, out_data & mask)

Expand Down
5 changes: 3 additions & 2 deletions loki/test_loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,16 @@ def test_loki_fuzz_02(mocker):
def test_loki_stress_01():
"""test Loki._fuzz_data() with random input"""
orders = ("<", ">")
sizes = (1, 2, 4)
for _ in range(3000):
size = choice(sizes)
size = choice((1, 2, 4))
if size == 1:
in_data = pack("B", getrandbits(8))
elif size == 2:
in_data = pack("H", getrandbits(16))
elif size == 4:
in_data = pack("I", getrandbits(32))
else:
raise AssertionError(f"invalid size: {size}")
assert len(Loki._fuzz_data(in_data, choice(orders))) == size


Expand Down
1 change: 1 addition & 0 deletions sapphire/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sapphire HTTP server
"""

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down
1 change: 1 addition & 0 deletions sapphire/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sapphire unit test fixtures
"""

import socket
from hashlib import sha1
from http.client import BadStatusLine
Expand Down
1 change: 1 addition & 0 deletions sapphire/test_connection_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
ConnectionManager unit tests
"""

# pylint: disable=protected-access

from itertools import count
Expand Down
1 change: 1 addition & 0 deletions sapphire/test_job.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Job unit tests
"""

# pylint: disable=protected-access
from pathlib import Path
from platform import system
Expand Down
1 change: 1 addition & 0 deletions sapphire/test_sapphire.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sapphire unit tests
"""

# pylint: disable=protected-access

import socket
Expand Down
1 change: 1 addition & 0 deletions sapphire/test_worker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sapphire unit tests
"""

# pylint: disable=protected-access

import socket
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ usedevelop = true
commands =
pylint -j 0 {posargs}
deps =
pylint==3.0.2
pylint==3.2.3
usedevelop = true

[testenv:pypi]
Expand Down

0 comments on commit a75bfdb

Please sign in to comment.