Commit Graph

1057 Commits

Author SHA1 Message Date
Pierre Sassoulas
65fb74d78a [missing-docstring] Break down into class, function, and module
Also fixed spelling in C0112 to C0116 messages following the review
of pull-request #2036 by Ashley Whetter.

See also #2075, #2077, #2262, #2654, #2805, #2809, #2844, #2992
and #3013 for full historical context.
2019-09-10 15:07:01 +02:00
Ashley Whetter
eeca6cf0ba Allow f-strings as a valid logging string formatting choice
Closes #2395
2019-09-10 12:18:46 +02:00
Pierre Sassoulas
4c2e1a5acf [changelog] Add 'multiple message with the same old name' 2019-09-10 11:14:38 +02:00
Robert Schweizer
fb81d1ade4 Report unnecessary else after continue and break
Close #2327
2019-09-10 10:50:08 +02:00
Sushobhit
6b3afd4f6d Added a new check, consider-using-sys-exit, close #2925 (#3062)
Close #2925
2019-08-22 15:16:48 +02:00
Eric Froemling
8271816027 useless-suppression detection now ignores cyclic-import (#3071)
Tweaked useless-suppression detection to ignore cyclic-import since cycles may not be detected until after it fires.
2019-08-22 14:37:03 +02:00
Pierre Sassoulas
122049b58c [changelog] Add the 1:1 relation between msgid and symbol 2019-08-19 13:54:52 +02:00
mattlbeck
4bf6f03c84 Add a new check arguments-out-of-order
The implementation successfully warns against the most obvious cases
where named variables are supplied to a function that all match a
function's positional argument, but are in the wrong order.

There are some additional corner cases that need to be addresses, such
as call sites that are not typical function calls.

Added additional checking for the presence of `self` arguments when
calling instance attributes.

Refactored the check into its own function so that we can bail out
cleanly with a return if needed.

Close #2975
2019-08-16 17:31:22 +02:00
Danny Hermes
7100b3949f Allow a . as a prefix for Sphinx name resolution. (#3058)
For context see https://github.com/PyCQA/pylint/issues/1502#issuecomment-448535694

In this issue it was agreed that `re.error`, `~re.error` and `!re.error` would all be accepted. However, it's also common in Sphinx to use a `.` prefix for local references.
2019-08-16 17:15:43 +02:00
Niko Wenselowski
3b18105c7b W0199: Change description to use the term 2-item-tuple (#3033) 2019-08-06 16:44:05 +02:00
hippo91
5309e1d6da Don't emit protected-acces for single underscore prefixed attributes in special methods
This PR prevents the emission of protected-access message when a single
underscore prefixed attribute is accessed inside a special  method.

Close #1802
2019-08-06 15:51:39 +02:00
Andres Perez Hortal
41c95225fe Fix number of statements in by_module stats (#3023)
Previously, self.stats['by_module'][modname]["statement"] was
initialized to 0 and never updated once the module was processed.
2019-07-29 15:53:55 +02:00
Claudiu Popa
558e5b10d1 Added a new check, `invalid-overridden-method`
This check is emitted when we detect that a method is overridden
as a property or a property is overridden as a method. This can indicate
a bug in the application code that will trigger a runtime error.

Close #2670
2019-07-18 10:34:28 +02:00
Claudiu Popa
f38bd0d1b5 Added a new check, `redeclared-assigned-name`
This check is emitted when ``pylint`` detects that a name
was assigned one or multiple times in the same assignment,
which indicate a potential bug.
Close #2898
2019-07-17 11:04:36 +02:00
Claudiu Popa
99ce3cdfd3 Ignore lambda calls with variadic arguments without a context.
Inferring variadic positional arguments and keyword arguments
will result into empty Tuples and Dicts, which can lead in
some cases to false positives with regard to no-value-for-parameter.
In order to avoid this, until we'll have support for call context
propagation, we're ignoring such cases if detected.
We already did that for function calls, but the previous fix
was not taking in consideration ``lambdas``

Close #2918
2019-07-17 10:23:00 +02:00
Claudiu Popa
26e11c0145 Added a new check, `self-assigning-variable`
This check is emitted when we detect that a variable is assigned
to itself, which might indicate a potential bug in the code application.
Close #2930
2019-07-17 09:58:25 +02:00
Claudiu Popa
a636569b9c Added a new check, `property-with-parameters`.
This check is emitted when we detect that a defined property also
has parameters, which are useless.
Close #3006
2019-07-16 11:30:21 +02:00
Claudiu Popa
4bcbe9b6a1 Excluded protocol classes from a couple of checks. Close #3002. 2019-07-16 09:46:06 +02:00
PHeanEX
18d9e992b3 Add new checker (unnecessary-comprehension) (close #2905) 2019-07-16 07:55:08 +02:00
Claudiu Popa
1ce0bbb1bd Excluded PEP 526 instance and class variables from `no-member`. Close #2945 2019-07-10 10:33:05 +02:00
Peter Kolbus
af45f55d86 Improve help for options (#2986) 2019-07-09 09:48:06 +03:00
Claudiu Popa
02297960ac Excluded attrs from too-few-public-methods check. Close #2988. 2019-07-06 18:38:19 +03:00
Andrzej Klajnert
0eeb67749b Fix - add __post_init__ into defining-attr-methods to avoid attribute-defined-outside-init in dataclasses. 2019-07-05 17:21:08 +03:00
Claudiu Popa
927db96bbd Dropped support for Python 3.4
It reached EoL a while ago an our typed_ast dependency also stopped working
for 3.4. Ideally just use a more recent Python version, which also helps
us as we don't have to maintain support for multiple minor versions at once.
2019-06-20 09:49:48 +02:00
Claudiu Popa
8582756731 Ignore `consider-using-dict-comprehension` for constructions that can't be converted to a comprehension
Close #2963
2019-06-20 09:23:44 +02:00
Ashley Whetter
1669bc3868 Fixed false positives for function stubs (#2927)
Close #1581
2019-05-26 09:29:11 +02:00
Claudiu Popa
3bfec9f63b `unused-import` emitted for the right import names in function scopes.
Close #2928
2019-05-23 08:54:25 +02:00
Claudiu Popa
b657df6644 Mention the name of the new signature-mutators option 2019-05-23 08:20:42 +02:00
Ashley Whetter
f90b223a5e Can choose decorators that mutate a function's signature (#2926)
Close #259
2019-05-23 08:17:33 +02:00
Claudiu Popa
f4fc3a1bbc `assignment-from-no-return` not triggered for async methods.
Close #2902
2019-05-23 08:15:36 +02:00
Claudiu Popa
f9e99fd5f3 Don't emit `attribute-defined-outside-init` for variables defined in setters.
Close #409
2019-05-21 09:22:23 +02:00
Ashley Whetter
5d0c0fa73b Fixed pragmas on their own line after a backlash being ignored (#2923)
Closes #199
2019-05-21 08:49:29 +02:00
Ashley Whetter
b38a7c8021 Fixed false positive for undefined-loop-variable
Closes #202
2019-05-20 10:30:10 -07:00
Claudiu Popa
44248e9f67 Syntax errors report the column number.
Close #2914
2019-05-20 09:48:48 +02:00
Claudiu Popa
07d5e37b9d Support fully qualified typing imports for type annotations.
Close #2915
2019-05-20 09:36:51 +02:00
Nick Smith
312dde3946 Fix misspellings in documentation (#2922) 2019-05-19 12:13:09 +02:00
Claudiu Popa
b488ce54e3 Exclude `__dict__ from attribute-defined-outside-init`
Close #2909
2019-05-19 10:04:43 +02:00
agutole
eb3761504b Correct word pointed when the same word has more than one error in the same line
Fixes #2895
2019-05-14 11:24:15 +02:00
Martin Vielsmaier
7054204c68 Fix crash in callable check (#2901) 2019-05-05 10:16:07 +02:00
Tyler Thieding
8d237a0ae3 Add broad try clause extension. (#2890)
Add an extension checker (pylint.extensions.broad_try_clause) that enforces a
configurable maximum number of statements inside of a try clause.
This facilitates enforcing PEP 8's guidelines about try/except statements and
the amount of code in the try clause:

"Additionally, for all try/except clauses, limit the try clause to the absolute minimum
amount of code necessary. Again, this avoids masking bugs."
2019-04-29 10:21:52 +02:00
Zeb Nicholls
b1ee3854ab Add 'of' to GoogleDocstring multiple type (#2884)
A docstring of the following form should pass (see https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html, search for ':obj:list of :obj:str')

def my_func(self):
    """This is a docstring.

    Returns
    -------
    :obj:`list` of :obj:`str`
        List of strings
    """
    return ["hi", "bye"] #@
2019-04-29 10:18:25 +02:00
fadedDexofan
fdc97772f4 Added subprocess.run explicit set check argument checker. Closes #2848 2019-04-19 12:14:21 +02:00
Claudiu Popa
474f4082a9 When we can't infer bare except handlers, skip `try-except-raise`
Close #2853
2019-04-09 15:52:11 +02:00
Claudiu Popa
c8db761f5f Handle more unnecessary-lambda cases when dealing with additional kwargs in wrapped calls
Close #2845
2019-04-03 11:22:27 +02:00
Claudiu Popa
b4721fb339 Better postponed evaluation of annotations handling
Close #2847
2019-04-03 10:51:43 +02:00
Claudiu Popa
af7eda4a62 Support postponed evaluation of annotations for variable annotations.
Close #2838
2019-03-29 09:19:04 +01:00
Claudiu Popa
95232ca07a `epylint.py_run defaults to python` in case the current executable is not a Python one.
Close #2837
2019-03-28 09:33:20 +01:00
Paul Renvoisé
3228bc4184 Add preferred-modules option and check
This allow users to specify a set of preferred modules that
should be used instead of other modules.
2019-03-27 14:47:11 +01:00
Taewon D. Kim
8acc80f7f3 Add ChangeLog entry for ignoring raw docstring in Similarities checker 2019-03-27 14:31:04 +01:00
Nathan Marrow
40b71e6f6d Don't recurse in inherit_from_std_ex
Commit 79c71de changed inherit_from_std_ex to pass recurs=True to the
call to ancestors. Since the ancestors call now recurses, there is no
need for the inherit_from_std_ex function to recurse as well, especially
since ancestors handles circular references (A inherits from B which
inherits from A).
2019-03-22 09:59:09 +01:00