Skip to content

Commit

Permalink
Fix typecheck after making it mandatory in CI and make sure (#77)
Browse files Browse the repository at this point in the history
* Fix typecheck after making it mandatory in CI and make sure

* Reformat code after black upgrade

* Linting fixes after pylint upgrade
  • Loading branch information
marcospri committed Jun 7, 2024
1 parent 67a412d commit 80ed02f
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .cookiecutter/includes/mypy/disables
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"no-redef",
"assignment",
"import-not-found",
3 changes: 3 additions & 0 deletions .cookiecutter/includes/pylint/disables
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Lots of false positives
"no-value-for-parameter",

3 changes: 3 additions & 0 deletions .cookiecutter/includes/tests/pylint/disables
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Lots of false positives
"no-value-for-parameter",

7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ disable = [

# Issues to disable this for false positives, disabling it globally in the meantime https://github.com/PyCQA/pylint/issues/214
"duplicate-code",

# Lots of false positives
"no-value-for-parameter",

]

good-names = [
Expand All @@ -147,6 +151,9 @@ warn_unused_ignores = true
disable_error_code = [
# https://mypy.readthedocs.io/en/stable/error_code_list.html#code-import-untyped
"import-untyped",
"no-redef",
"assignment",
"import-not-found",
]

[[tool.mypy.overrides]]
Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The public interface class for comparing with things."""

from h_matchers.matcher import collection
from h_matchers.matcher import number as _number
from h_matchers.matcher.anything import AnyThing
Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/anything.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A matcher that matches anything."""

from h_matchers.matcher.core import Matcher


Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/collection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Flexible matchers for various collection types in a fluent style."""

from types import GeneratorType

from h_matchers.exception import NoMatch
Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/collection/_mixin/contains.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A mixin for AnyCollection which lets you check for specific items."""

from types import GeneratorType

from h_matchers.decorator import fluent_entrypoint
Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/combination.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matchers formed of combinations of other things."""

from h_matchers.matcher.core import Matcher


Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/object.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matchers for simple objects."""

from h_matchers.decorator import fluent_entrypoint
from h_matchers.matcher.core import Matcher

Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/web/request.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A matcher that matches various request objects in HTTP type libraries."""

from copy import deepcopy

from h_matchers.decorator import fluent_entrypoint
Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/web/url/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
Any.url(path="/foo") == "foo" # True
Any.url(path="foo") == "/foo" # True
"""

import re
from collections import Counter
from urllib.parse import parse_qsl, urlparse
Expand Down
1 change: 1 addition & 0 deletions src/h_matchers/matcher/web/url/fluent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A fluent interface over AnyURLCore for matching URLs."""

from h_matchers.decorator import fluent_entrypoint
from h_matchers.matcher.collection import AnyMapping
from h_matchers.matcher.strings import AnyString
Expand Down
4 changes: 4 additions & 0 deletions tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ disable = [

# Issues to disable this for false positives, disabling it globally in the meantime https://github.com/PyCQA/pylint/issues/214
"duplicate-code",

# Lots of false positives
"no-value-for-parameter",

]

# Just disable PyLint's name style checking for the tests, because we
Expand Down
1 change: 1 addition & 0 deletions tests/unit/data_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data types for testing the matchers."""

import enum
from decimal import Decimal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test_it_complains_with_incorrect_size(self):
def test_it_matches_maximum_size(self):
matcher = HostClass.of_size(at_most=2)

# pylint:disable=use-implicit-booleaness-not-comparison
assert matcher == []
assert matcher == [1, 2]
assert matcher != [1, 2, 3]
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class TestTypeMixin:
def test_it_matches_specific_class(self):
matcher = HostClass.of_type(list)

# pylint:disable=use-implicit-booleaness-not-comparison
assert matcher == []
assert [] == matcher
assert matcher != set()
Expand Down

0 comments on commit 80ed02f

Please sign in to comment.