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 b97a150 commit 0193831
Show file tree
Hide file tree
Showing 11 changed files with 25 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
6 changes: 5 additions & 1 deletion loki/loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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 @@ -82,6 +82,10 @@ 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:
raise RuntimeError(f"Unsupported data size: {data_size}")

Check warning on line 86 in loki/loki.py

View check run for this annotation

Codecov / codecov/patch

loki/loki.py#L86

Added line #L86 was not covered by tests
else:
raise AssertionError(f"Invalid fuzz op: {fuzz_op}")

Check warning on line 88 in loki/loki.py

View check run for this annotation

Codecov / codecov/patch

loki/loki.py#L88

Added line #L88 was not covered by tests

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 0193831

Please sign in to comment.