Commit Graph

271 Commits

Author SHA1 Message Date
Pierre Sassoulas
3fffdf03d5 Fix trailing whitespaces and trailing newlines 2020-05-03 18:24:25 +02:00
Pierre Sassoulas
67adbe09fe Update changelog for mixed-indentation removal
Python3 raises:
TabError: inconsistent use of tabs and spaces in indentation
2020-05-03 11:00:18 +02:00
Pierre Sassoulas
0a7a4d4aad Remove the space_check option and its code 2020-05-03 10:38:06 +02:00
Pierre Sassoulas
28a5c2e417 Update documentation for bad-whitespace removal
And take review into account see https://github.com/PyCQA/pylint/pull/3578#discussion_r419063519
2020-05-03 10:38:06 +02:00
Pierre Sassoulas
7885d56f33 Update documentation for bad-continuation removal 2020-05-02 20:02:01 +02:00
Claudiu Popa
4bae2af51e master is now 2.6.0 2020-04-28 08:50:16 +02:00
Claudiu Popa
01345546f6 Prepare 2.5.0 release for pylint 2020-04-27 10:51:53 +02:00
Ashley Whetter
fb59ed86d5 Brought back logging-fstring-interpolation 2020-04-27 10:34:18 +02:00
anubh-v
d340900080 Add --list-extensions command
Closes #3303
2020-03-25 09:38:30 +01:00
Claudiu Popa
bd85d3b70d Refresh the docs a bit in preparation for the release 2020-03-13 12:20:02 +01:00
bernie gray
762e1a1360
Allow non-ASCII characters in identifiers in the invalid-name rule and add non-ascii-name check
Non-ASCII characters are now allowed by ``invalid-name`` check. 
Also this commit adds a new check ``non-ascii-name``, which is used
to detect identifiers with non-ASCII characters.
2020-03-11 14:13:26 +01:00
Anubhav
88895ea8ea
Add warning for the case where second argument to isinstance is not a type (#3404)
The second argument to isinstance must be either a type or a tuple of types.

Close #3308 

Co-authored-by: Claudiu Popa <pcmanticore@gmail.com>
2020-02-13 10:12:07 +01:00
Benny
8956979db8
Add notes-rgx option for fixme checker (#3394)
This commit adds a new `notes-rgx` which is used by the "fixme" check for more
granular control over the what fixme messages to emit.

Co-authored-by: Claudiu Popa <pcmanticore@gmail.com>
2020-02-13 09:30:43 +01:00
Anubhav
f2f4e6f424 Add a check for asserts on string literals (#3346)
This check is emitted whenever **pylint** finds an assert statement
with a string literal as its first argument. Such assert statements
are probably unintended as they will always pass.

Close #3284
2020-01-14 17:06:47 +01:00
Wes Turner
06d5287318 Adds a new check 'inconsistent-quotes'.
Quoting PEP-8:

In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability.

For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.

Features:

Accounts for strings where the delimiter is swapped so an internal quote doesn't need to be escaped
Only errors on those lines that represent the module's minority delimiter.
Ignores longstrings (they could be docstrings, and checking those delimiters is someone else's responsibility)
2020-01-05 12:27:09 +01:00
Andy Palmer
dc83a86bc5 Add check to make sure only strings are assigned to __name__ (#3271)
Close #583
2019-12-16 09:38:21 +01:00
Claudiu Popa
04e72bc0f9 Add the new protocol checks to the documentation 2019-11-27 16:03:28 +01:00
craig-sh
c6322018ab Enhance the protocol checker (#3259)
This commit adds multiple checks for various Python protocols

  E0304 (invalid-bool-returned): __bool__ did not return a bool
  E0305 (invalid-index-returned): __index__ did not return an integer
  E0306 (invalid-repr-returned): __repr__ did not return a string
  E0307 (invalid-str-returned): __str__ did not return a string
  E0308 (invalid-bytes-returned): __bytes__ did not return a string
  E0309 (invalid-hash-returned): __hash__ did not return an integer
  E0310 (invalid-length-hint-returned): __length_hint__ did not return a non-negative integer
  E0311 (invalid-format-returned): __format__ did not return a string
  E0312 (invalid-getnewargs-returned): __getnewargs__ did not return a tuple
  E0313 (invalid-getnewargs-ex-returned): __getnewargs_ex__ did not return a tuple of the form (tuple, dict)

Close #560
2019-11-27 16:00:08 +01:00
syutbai
1601769019 Add support for --fail-under flag
Add a --fail-under <score> flag, also configurable in a `.pylintrc`file

If the final score is more than the specified score, it's considered a
success and pylint exits with exit code 0. Otherwise, it's considered
a failure and pylint exits with its current exit code based on the
messages issued.

Close #2242
2019-11-21 09:07:25 +01:00
hippo91
9bdae8b82f Add support for disabling line-too-long for multilines strings
This commit adds support for disabling `line-too-long` messages
for multilines strings such as docstrings.

When a pylint disable pragma is present at the end of the docstring, it is taken
in account for the entire docstring.

Close #2957
2019-11-19 09:16:54 +01:00
Daniel Draper
96b3892506 Add regexs for bad- and good-names to enable better white- or blacklisting (#3186)
To enable better handling of whitelisting/blacklisting names, we added two new
config options: `good-names-rgxs` and `bad-names-rgxs`. They both
are a comma-separated list of regexes, where the former is used for exempting
names from name checking while the latter is used for always marking a name
as blacklisted.
2019-10-30 10:06:19 +01:00
Ville Skyttä
6df0b3e2a4 Flag various collections as dangerous defaults (#3183) (#3194) 2019-10-16 21:11:35 +02:00
Claudiu Popa
141873adae A new check `f-string-without-interpolation` was added
Close #3190
2019-10-16 12:28:35 +02:00
Ashley Whetter
3fc8c98d0f Can read setup.cfg and pyproject.toml files
Closes #617
2019-10-09 20:39:13 -07:00
Claudiu Popa
15209f6642 Prepare release 2019-09-24 10:02:02 +02:00
Nick Drozd
8bf8fe1d2a New check: import-outside-toplevel (close #3067) (#3079) 2019-09-17 03:30:41 -05:00
Trevor Bekolay
20e432ebc0 Add a command to list enabled/disabled messages
When enabling/disabling several messages and groups in a config
file, it can be unclear which messages are actually enabled and
which are disabled. This new command produces the final resolved
lists of enabled/disabled messages, sorted by symbol but with the
ID provided for use with `--help-msg`.

This commit includes a test, documentation, and adding myself to
the contributors list, as this is my first contribution.
2019-09-12 14:23:19 +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
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
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
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
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
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
PHeanEX
18d9e992b3 Add new checker (unnecessary-comprehension) (close #2905) 2019-07-16 07:55:08 +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
5f658150ff Add a what's new entry for the new extension 2019-04-29 10:24:39 +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
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
Pierre Sassoulas
3ff17ae9e3 Feat - Makes C0412 (ungrouped-imports) compatible with isort (#2824)
Closes #2806.
2019-03-22 09:03:58 +01:00
yory8
a138a1a8f4 Add new linter: dict-iter-missing-items
Add a new linter to check against forgotten calls to `.items()` when
iterating through a dictionary in a `for` loop.

Close #2761
2019-03-20 09:41:16 +01:00
hippo91
8d2f5d090b Add a new `missing-parentheses-for-call-in-test` check
This is emitted in case a call to a function is made inside a test but it misses parentheses.
It is a more specialised form of `using-constant-test`, but tailored specifically to callables.

Close #2658
2019-03-19 10:45:09 +01:00
Paul Renvoise
4714a65529 Make `len-as-condition only fire when a len(x)` call is made without an explicit comparison
This commit reduce the scope of `len-as-condition` to only care when a
`len(SEQUENCE)` call is made without an explicit comparison, as stated
in PEP8.
2019-03-19 10:16:07 +01:00
Claudiu Popa
097227b612 Added a new check class-variable-slots-conflict
This check is emitted when ``pylint`` finds a class variable that conflicts with a slot
name, which would raise a ``ValueError`` at runtime.
2019-03-03 13:27:37 +01:00
Claudiu Popa
55de04f2b0 Move the --from-stdin changelog to 2.4 2019-03-02 14:30:08 +01:00
Thomas Hisch
fb5a2a6dd7 Add support for reading from stdin (#2746)
pylint gained a new `--from-stdin` flag which activates stdin linting, useful for editors and similar use cases.

Closes: #1187
2019-03-02 14:28:31 +01:00