Skip to content

Commit

Permalink
Merge branch 'main' into consider-iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Sep 14, 2021
2 parents 0b40b49 + bc95cd3 commit 07889c8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/asottile/pyupgrade
rev: v2.25.0
rev: v2.26.0
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand Down Expand Up @@ -88,7 +88,7 @@ repos:
["platformdirs==2.2.0", "types-pkg_resources==0.1.3", "types-toml==0.1.3"]
exclude: tests/functional/|tests/input|tests(/.*)*/data|tests/regrtest_data/|tests/data/|tests(/.*)+/conftest.py|doc/|bin/
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.2
rev: v2.4.0
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ Release date: TBA

Closes #4069

* Non symbolic messages with the wrong capitalisation now correctly trigger ``use-symbolic-message-instead``

Closes #5000


What's New in Pylint 2.10.3?
============================
Expand Down
2 changes: 1 addition & 1 deletion pylint/message/message_id_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __repr__(self):

def get_symbol(self, msgid: str) -> str:
try:
return self.__msgid_to_symbol[msgid]
return self.__msgid_to_symbol[msgid.upper()]
except KeyError as e:
msg = f"'{msgid}' is not stored in the message store."
raise UnknownMessageError(msg) from e
Expand Down
3 changes: 2 additions & 1 deletion requirements_test_min.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-e .
astroid==2.7.3 # Pinned to a specific version for tests
# astroid dependency is also defined in setup.cfg
astroid==2.8.0 # Pinned to a specific version for tests
pytest~=6.2
pytest-benchmark~=3.4
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ project_urls =
packages = find:
install_requires =
platformdirs>=2.2.0
astroid>=2.7.3,<2.8 # (You should also upgrade requirements_test_min.txt)
astroid>=2.8.0,<2.9 # (You should also upgrade requirements_test_min.txt)
isort>=4.2.5,<6
mccabe>=0.6,<0.7
toml>=0.7.1
Expand Down
7 changes: 7 additions & 0 deletions tests/functional/d/dataclass_with_default_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# - https://github.com/PyCQA/pylint/issues/2698
from dataclasses import dataclass, field
import dataclasses as dc
from typing import cast


@dataclass
Expand Down Expand Up @@ -41,3 +42,9 @@ class Test2:


Test2.int_prop["key"] = "value" # [unsupported-assignment-operation]


@dc.dataclass
class TEST3:
"""Test dataclass that puts call to field() in another function call"""
attribute: int = cast(int, field(default_factory=dict))
4 changes: 2 additions & 2 deletions tests/functional/d/dataclass_with_default_factory.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
not-an-iterable:39:9::Non-iterable value Test2.int_prop is used in an iterating context:HIGH
unsupported-assignment-operation:43:0::'Test2.int_prop' does not support item assignment:HIGH
not-an-iterable:40:9::Non-iterable value Test2.int_prop is used in an iterating context:HIGH
unsupported-assignment-operation:44:0::'Test2.int_prop' does not support item assignment:HIGH
2 changes: 1 addition & 1 deletion tests/functional/u/use/use_symbolic_message_instead.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pylint: disable=C0111,R0903,T1234 # [bad-option-value,use-symbolic-message-instead,use-symbolic-message-instead]
# pylint: enable=C0111 # [use-symbolic-message-instead]
# pylint: enable=c0111,w0223 # [use-symbolic-message-instead,use-symbolic-message-instead]

def my_function(arg): # [missing-function-docstring]
return arg or True
Expand Down
27 changes: 14 additions & 13 deletions tests/functional/u/use/use_symbolic_message_instead.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
bad-option-value:1:0::Bad option value 'T1234'
use-symbolic-message-instead:1:0::"'C0111' is cryptic: use '# pylint: disable=missing-docstring' instead"
use-symbolic-message-instead:1:0::"'R0903' is cryptic: use '# pylint: disable=too-few-public-methods' instead"
use-symbolic-message-instead:2:0::"'C0111' is cryptic: use '# pylint: enable=missing-docstring' instead"
missing-function-docstring:4:0:my_function:Missing function or method docstring
use-symbolic-message-instead:7:0::"'C0111' is cryptic: use '# pylint: disable=missing-docstring' instead"
use-symbolic-message-instead:8:0::"'R0903' is cryptic: use '# pylint: enable=too-few-public-methods' instead"
use-symbolic-message-instead:9:0::"'R0903' is cryptic: use '# pylint: disable=too-few-public-methods' instead"
use-symbolic-message-instead:12:0::"'C0102' is cryptic: use '# pylint: disable=blacklisted-name' instead"
use-symbolic-message-instead:16:0::"'C0102' is cryptic: use '# pylint: disable=blacklisted-name' instead"
use-symbolic-message-instead:16:0::"'R1711' is cryptic: use '# pylint: disable=useless-return' instead"
missing-function-docstring:20:0:test_enabled_by_id_msg:Missing function or method docstring
use-symbolic-message-instead:20:0::"'C0111' is cryptic: use '# pylint: enable=missing-docstring' instead"
bad-option-value:1:0::Bad option value 'T1234':HIGH
use-symbolic-message-instead:1:0::"'C0111' is cryptic: use '# pylint: disable=missing-docstring' instead":HIGH
use-symbolic-message-instead:1:0::"'R0903' is cryptic: use '# pylint: disable=too-few-public-methods' instead":HIGH
use-symbolic-message-instead:2:0::"'c0111' is cryptic: use '# pylint: enable=missing-docstring' instead":HIGH
use-symbolic-message-instead:2:0::"'w0223' is cryptic: use '# pylint: enable=abstract-method' instead":HIGH
missing-function-docstring:4:0:my_function:Missing function or method docstring:HIGH
use-symbolic-message-instead:7:0::"'C0111' is cryptic: use '# pylint: disable=missing-docstring' instead":HIGH
use-symbolic-message-instead:8:0::"'R0903' is cryptic: use '# pylint: enable=too-few-public-methods' instead":HIGH
use-symbolic-message-instead:9:0::"'R0903' is cryptic: use '# pylint: disable=too-few-public-methods' instead":HIGH
use-symbolic-message-instead:12:0::"'C0102' is cryptic: use '# pylint: disable=blacklisted-name' instead":HIGH
use-symbolic-message-instead:16:0::"'C0102' is cryptic: use '# pylint: disable=blacklisted-name' instead":HIGH
use-symbolic-message-instead:16:0::"'R1711' is cryptic: use '# pylint: disable=useless-return' instead":HIGH
missing-function-docstring:20:0:test_enabled_by_id_msg:Missing function or method docstring:HIGH
use-symbolic-message-instead:20:0::"'C0111' is cryptic: use '# pylint: enable=missing-docstring' instead":HIGH

0 comments on commit 07889c8

Please sign in to comment.