Skip to content

Commit 0f18209

Browse files
Capitalize first letter automatically
1 parent fffde57 commit 0f18209

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+395
-395
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ repos:
9696
args: [--prose-wrap=always, --print-width=88]
9797
exclude: tests(/.*)*/data
9898
- repo: https://github.com/DanielNoord/pydocstringformatter
99-
rev: v0.2.0
99+
rev: 28db19b1da1bcfffae02371d8feecaba242678f1
100100
hooks:
101101
- id: pydocstringformatter
102102
exclude: *fixtures

examples/custom_raw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class MyRawChecker(BaseChecker):
13-
"""check for line continuations with '\' instead of using triple
13+
"""Check for line continuations with '\' instead of using triple
1414
quoted string or parenthesis
1515
"""
1616

@@ -30,7 +30,7 @@ class MyRawChecker(BaseChecker):
3030
options = ()
3131

3232
def process_module(self, node: nodes.Module) -> None:
33-
"""process a module
33+
"""Process a module
3434
3535
the module's content is accessible via node.stream() function
3636
"""

pylint/checkers/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2020
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
2121

22-
"""utilities methods and classes for checkers
22+
"""Utilities methods and classes for checkers
2323
2424
Base id of standard checkers (used in msg and report ids):
2525
01: base
@@ -66,7 +66,7 @@ def table_lines_from_stats(
6666
old_stats: Optional[LinterStats],
6767
stat_type: Literal["duplicated_lines", "message_types"],
6868
) -> List[str]:
69-
"""get values listed in <columns> from <stats> and <old_stats>,
69+
"""Get values listed in <columns> from <stats> and <old_stats>,
7070
and return a formatted list of values, designed to be given to a
7171
ureport.Table object
7272
"""
@@ -129,7 +129,7 @@ def table_lines_from_stats(
129129

130130

131131
def initialize(linter):
132-
"""initialize linter with checkers in this package"""
132+
"""Initialize linter with checkers in this package"""
133133
register_plugins(linter, __path__[0])
134134

135135

pylint/checkers/base.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6969
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
7070

71-
"""basic checker for Python code"""
71+
"""Basic checker for Python code"""
7272
import collections
7373
import itertools
7474
import re
@@ -266,7 +266,7 @@ def in_loop(node: nodes.NodeNG) -> bool:
266266

267267

268268
def in_nested_list(nested_list, obj):
269-
"""return true if the object is an element of <nested_list> or of a nested
269+
"""Return true if the object is an element of <nested_list> or of a nested
270270
list
271271
"""
272272
for elmt in nested_list:
@@ -401,7 +401,7 @@ def report_by_type_stats(
401401
stats: LinterStats,
402402
old_stats: Optional[LinterStats],
403403
):
404-
"""make a report of
404+
"""Make a report of
405405
406406
* percentage of different types documented
407407
* percentage of different types with a bad name
@@ -438,7 +438,7 @@ def report_by_type_stats(
438438

439439

440440
def redefined_by_decorator(node):
441-
"""return True if the object is a method redefined via decorator.
441+
"""Return True if the object is a method redefined via decorator.
442442
443443
For example:
444444
@property
@@ -843,7 +843,7 @@ def _check_else_on_loop(self, node):
843843
)
844844

845845
def _check_in_loop(self, node, node_name):
846-
"""check that a node is inside a for or while loop"""
846+
"""Check that a node is inside a for or while loop"""
847847
for parent in node.node_ancestors():
848848
if isinstance(parent, (nodes.For, nodes.While)):
849849
if node not in parent.orelse:
@@ -861,7 +861,7 @@ def _check_in_loop(self, node, node_name):
861861
self.add_message("not-in-loop", node=node, args=node_name)
862862

863863
def _check_redefinition(self, redeftype, node):
864-
"""check for redefinition of a function / method / class name"""
864+
"""Check for redefinition of a function / method / class name"""
865865
parent_frame = node.parent.frame()
866866

867867
# Ignore function stubs created for type information
@@ -938,7 +938,7 @@ def _check_redefinition(self, redeftype, node):
938938

939939

940940
class BasicChecker(_BasicChecker):
941-
"""checks for :
941+
"""Checks for :
942942
* doc strings
943943
* number of arguments, local variables, branches, returns and statements in
944944
functions, methods
@@ -1088,7 +1088,7 @@ def __init__(self, linter):
10881088
self._tryfinallys = None
10891089

10901090
def open(self):
1091-
"""initialize visit variables and statistics"""
1091+
"""Initialize visit variables and statistics"""
10921092
py_version = get_global_option(self, "py-version")
10931093
self._py38_plus = py_version >= (3, 8)
10941094
self._tryfinallys = []
@@ -1162,11 +1162,11 @@ def _check_using_constant_test(self, node, test):
11621162
self.add_message("using-constant-test", node=node)
11631163

11641164
def visit_module(self, _: nodes.Module) -> None:
1165-
"""check module name, docstring and required arguments"""
1165+
"""Check module name, docstring and required arguments"""
11661166
self.linter.stats.node_count["module"] += 1
11671167

11681168
def visit_classdef(self, _: nodes.ClassDef) -> None:
1169-
"""check module name, docstring and redefinition
1169+
"""Check module name, docstring and redefinition
11701170
increment branch counter
11711171
"""
11721172
self.linter.stats.node_count["klass"] += 1
@@ -1305,7 +1305,7 @@ def visit_lambda(self, node: nodes.Lambda) -> None:
13051305

13061306
@utils.check_messages("dangerous-default-value")
13071307
def visit_functiondef(self, node: nodes.FunctionDef) -> None:
1308-
"""check function name, docstring, arguments, redefinition,
1308+
"""Check function name, docstring, arguments, redefinition,
13091309
variable names, max locals
13101310
"""
13111311
if node.is_method():
@@ -1369,7 +1369,7 @@ def visit_return(self, node: nodes.Return) -> None:
13691369

13701370
@utils.check_messages("unreachable")
13711371
def visit_continue(self, node: nodes.Continue) -> None:
1372-
"""check is the node has a right sibling (if so, that's some unreachable
1372+
"""Check is the node has a right sibling (if so, that's some unreachable
13731373
code)
13741374
"""
13751375
self._check_unreachable(node)
@@ -1388,7 +1388,7 @@ def visit_break(self, node: nodes.Break) -> None:
13881388

13891389
@utils.check_messages("unreachable")
13901390
def visit_raise(self, node: nodes.Raise) -> None:
1391-
"""check if the node has a right sibling (if so, that's some unreachable
1391+
"""Check if the node has a right sibling (if so, that's some unreachable
13921392
code)
13931393
"""
13941394
self._check_unreachable(node)
@@ -1418,7 +1418,7 @@ def _check_misplaced_format_function(self, call_node):
14181418
"eval-used", "exec-used", "bad-reversed-sequence", "misplaced-format-function"
14191419
)
14201420
def visit_call(self, node: nodes.Call) -> None:
1421-
"""visit a Call node -> check if this is not a disallowed builtin
1421+
"""Visit a Call node -> check if this is not a disallowed builtin
14221422
call and check for * or ** use
14231423
"""
14241424
self._check_misplaced_format_function(node)
@@ -1436,7 +1436,7 @@ def visit_call(self, node: nodes.Call) -> None:
14361436

14371437
@utils.check_messages("assert-on-tuple", "assert-on-string-literal")
14381438
def visit_assert(self, node: nodes.Assert) -> None:
1439-
"""check whether assert is used on a tuple or string literal."""
1439+
"""Check whether assert is used on a tuple or string literal."""
14401440
if (
14411441
node.fail is None
14421442
and isinstance(node.test, nodes.Tuple)
@@ -1453,7 +1453,7 @@ def visit_assert(self, node: nodes.Assert) -> None:
14531453

14541454
@utils.check_messages("duplicate-key")
14551455
def visit_dict(self, node: nodes.Dict) -> None:
1456-
"""check duplicate key in dictionary"""
1456+
"""Check duplicate key in dictionary"""
14571457
keys = set()
14581458
for k, _ in node.items:
14591459
if isinstance(k, nodes.Const):
@@ -1467,15 +1467,15 @@ def visit_dict(self, node: nodes.Dict) -> None:
14671467
keys.add(key)
14681468

14691469
def visit_tryfinally(self, node: nodes.TryFinally) -> None:
1470-
"""update try...finally flag"""
1470+
"""Update try...finally flag"""
14711471
self._tryfinallys.append(node)
14721472

14731473
def leave_tryfinally(self, _: nodes.TryFinally) -> None:
1474-
"""update try...finally flag"""
1474+
"""Update try...finally flag"""
14751475
self._tryfinallys.pop()
14761476

14771477
def _check_unreachable(self, node):
1478-
"""check unreachable code"""
1478+
"""Check unreachable code"""
14791479
unreach_stmt = node.next_sibling()
14801480
if unreach_stmt is not None:
14811481
if (
@@ -1491,7 +1491,7 @@ def _check_unreachable(self, node):
14911491
self.add_message("unreachable", node=unreach_stmt)
14921492

14931493
def _check_not_in_finally(self, node, node_name, breaker_classes=()):
1494-
"""check that a node is not inside a 'finally' clause of a
1494+
"""Check that a node is not inside a 'finally' clause of a
14951495
'try...finally' statement.
14961496
If we find a parent which type is in breaker_classes before
14971497
a 'try...finally' block we skip the whole check.
@@ -1510,7 +1510,7 @@ def _check_not_in_finally(self, node, node_name, breaker_classes=()):
15101510
_parent = _node.parent
15111511

15121512
def _check_reversed(self, node):
1513-
"""check that the argument to `reversed` is a sequence"""
1513+
"""Check that the argument to `reversed` is a sequence"""
15141514
try:
15151515
argument = utils.safe_infer(utils.get_argument_from_call(node, position=0))
15161516
except utils.NoSuchArgumentError:
@@ -1967,7 +1967,7 @@ def visit_global(self, node: nodes.Global) -> None:
19671967
"disallowed-name", "invalid-name", "assign-to-new-keyword", "non-ascii-name"
19681968
)
19691969
def visit_assignname(self, node: nodes.AssignName) -> None:
1970-
"""check module level assigned names"""
1970+
"""Check module level assigned names"""
19711971
self._check_assign_to_new_keyword_violation(node.name, node)
19721972
frame = node.frame()
19731973
assign_type = node.assign_type()
@@ -2006,7 +2006,7 @@ def visit_assignname(self, node: nodes.AssignName) -> None:
20062006
self._check_name("class_attribute", node.name, node)
20072007

20082008
def _recursive_check_names(self, args):
2009-
"""check names in a possibly recursive list <arg>"""
2009+
"""Check names in a possibly recursive list <arg>"""
20102010
for arg in args:
20112011
if isinstance(arg, nodes.AssignName):
20122012
self._check_name("argument", arg.name, arg)
@@ -2054,7 +2054,7 @@ def _name_disallowed_by_regex(self, name: str) -> bool:
20542054
)
20552055

20562056
def _check_name(self, node_type, name, node, confidence=interfaces.HIGH):
2057-
"""check for a name using the type's regexp"""
2057+
"""Check for a name using the type's regexp"""
20582058
non_ascii_match = self._non_ascii_rgx_compiled.match(name)
20592059
if non_ascii_match is not None:
20602060
self._raise_name_warning(
@@ -2273,7 +2273,7 @@ def _check_docstring(
22732273

22742274

22752275
class PassChecker(_BasicChecker):
2276-
"""check if the pass statement is really necessary"""
2276+
"""Check if the pass statement is really necessary"""
22772277

22782278
msgs = {
22792279
"W0107": (

pylint/checkers/base_checker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BaseChecker(OptionsProviderMixIn):
4848
enabled: bool = True
4949

5050
def __init__(self, linter=None):
51-
"""checker instances should have the linter as argument
51+
"""Checker instances should have the linter as argument
5252
5353
:param ILinter linter: is an object implementing ILinter.
5454
"""
@@ -189,10 +189,10 @@ def get_message_definition(self, msgid):
189189
raise InvalidMessageError(error_msg)
190190

191191
def open(self):
192-
"""called before visiting project (i.e. set of modules)"""
192+
"""Called before visiting project (i.e. set of modules)"""
193193

194194
def close(self):
195-
"""called after visiting project (i.e set of modules)"""
195+
"""Called after visiting project (i.e set of modules)"""
196196

197197

198198
class BaseTokenChecker(BaseChecker):

0 commit comments

Comments
 (0)