summaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorJames Addison <55152140+jayaddison@users.noreply.github.com>2023-01-20 14:23:42 +0000
committerGitHub <noreply@github.com>2023-01-20 14:23:42 +0000
commit14f74d5c703e54bfd0ed1f48435f7a60a674f1ea (patch)
treeba876ca99f33b40b5a8ed54d6723fa22c40100c2 /tests/functional
parentb08f99a6ee3affed01ef7b6f1847a49865e9b2ad (diff)
downloadpylint-git-14f74d5c703e54bfd0ed1f48435f7a60a674f1ea.tar.gz
pointless-exception-statement: filter call inference for better performance on large codebases (#8078)
Filtering to to names that begin with an uppercase character seems to be sufficient, See the full conversation on Github for details. Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/s/statement_without_effect.py7
-rw-r--r--tests/functional/s/statement_without_effect.txt11
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/functional/s/statement_without_effect.py b/tests/functional/s/statement_without_effect.py
index 0c6586e36..c459b242f 100644
--- a/tests/functional/s/statement_without_effect.py
+++ b/tests/functional/s/statement_without_effect.py
@@ -38,6 +38,9 @@ GOOD_ATTRIBUTE_DOCSTRING = 42
class ClassLevelAttributeTest:
""" test attribute docstrings. """
+ class ClassLevelException(Exception):
+ """Exception defined for access as a class attribute."""
+
good_attribute_docstring = 24
""" class level attribute docstring is fine either. """
second_good_attribute_docstring = 42
@@ -90,3 +93,7 @@ def unraised_exception():
"""Test that instantiating but not raising an exception is flagged as a pointless statement"""
ValueError("pointless-statement") # [pointless-exception-statement]
ValueError(to_be()) # [pointless-exception-statement]
+ ClassLevelAttributeTest.ClassLevelException(to_be()) # [pointless-exception-statement]
+ ValueError("another-pointless-statement") # [pointless-exception-statement]
+ instance = ClassLevelAttributeTest()
+ instance.ClassLevelException(to_be()) # [pointless-exception-statement]
diff --git a/tests/functional/s/statement_without_effect.txt b/tests/functional/s/statement_without_effect.txt
index 39f86f33b..4d6e071be 100644
--- a/tests/functional/s/statement_without_effect.txt
+++ b/tests/functional/s/statement_without_effect.txt
@@ -8,7 +8,10 @@ expression-not-assigned:23:0:23:18::"Expression ""list() and tuple()"" is assign
expression-not-assigned:30:0:30:17::"Expression ""ANSWER == to_be()"" is assigned to nothing":UNDEFINED
expression-not-assigned:32:0:32:22::"Expression ""to_be() or not to_be()"" is assigned to nothing":UNDEFINED
expression-not-assigned:33:0:33:13::"Expression ""to_be().title"" is assigned to nothing":UNDEFINED
-pointless-string-statement:58:8:58:43:ClassLevelAttributeTest.__init__:String statement has no effect:UNDEFINED
-pointless-string-statement:65:8:65:55:ClassLevelAttributeTest.test:String statement has no effect:UNDEFINED
-pointless-exception-statement:91:4:91:37:unraised_exception:Exception statement has no effect:INFERENCE
-pointless-exception-statement:92:4:92:23:unraised_exception:Exception statement has no effect:INFERENCE
+pointless-string-statement:61:8:61:43:ClassLevelAttributeTest.__init__:String statement has no effect:UNDEFINED
+pointless-string-statement:68:8:68:55:ClassLevelAttributeTest.test:String statement has no effect:UNDEFINED
+pointless-exception-statement:94:4:94:37:unraised_exception:Exception statement has no effect:INFERENCE
+pointless-exception-statement:95:4:95:23:unraised_exception:Exception statement has no effect:INFERENCE
+pointless-exception-statement:96:4:96:56:unraised_exception:Exception statement has no effect:INFERENCE
+pointless-exception-statement:97:4:97:45:unraised_exception:Exception statement has no effect:INFERENCE
+pointless-exception-statement:99:4:99:41:unraised_exception:Exception statement has no effect:INFERENCE