summaryrefslogtreecommitdiff
path: root/pylint/checkers/python3.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a Python 3 checker for calls to `encode` or `decode` with non-text ↵Roy Williams2016-11-231-2/+46
| | | | | | | codecs. (#1172) These codecs were removed from the type restricted convenience methods on `str`, `bytes`, and `bytearray` in Python 3.4 and produce inconsistent output with their counterparts in `codecs`
* Implemented support to warn when overlappling exceptions in same handlerErik2016-10-311-1/+1
|
* Add a checker for accessing `Exception.message` in Python 2. (#1147)Roy Williams2016-10-311-0/+25
| | | | This attribute has been removed in Python 3.
* Issue a warning on methods implementing `__rdiv__` as well.Roy Williams2016-10-221-0/+7
| | | | Unfortunately I forgot about this in f194bcd5b989ea03bf264572bac25326e7db1fe7
* Add a warning when declaring `__div__` or `__idiv__` in Python 2. (#1121)Roy Williams2016-10-051-0/+14
| | | | | | * Add a warning when declaring `__div__` or `__idiv__` in Python 2. These methods are removed in Python 3 in favor of `__floordiv__` and `__truediv__`
* Add a Python 3 warning for implementing `__eq__` without also implementing ↵Roy Williams2016-09-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `__hash__` I've been exploring transitioning our codebase to Python 3, and I've been using the immensely helpful `-3` flag when running tests as described here: https://docs.python.org/3/howto/pyporting.html#prevent-compatibility-regressions Unfortunately, one of the most common issues I'm finding is around classes implementing `__eq__` but not `__hash__`. The behavior around this changed in Python 3. See below: ```python class JustEq(object): def __init__(self, x): self.x = x def __eq__(self, other): return self.x == other.x class Neither(object): def __init__(self, x): self.x = x class HashAndEq(object): def __init__(self, x): self.x = x def __eq__(self, other): return self.x == other.x def __hash__(self): return hash(self.x) {Neither(1), Neither(2)} # OK {HashAndEq(1), HashAndEq(2)} # OK {JustEq(1), JustEq(2)} # Works in Python 2, throws in Python 3 as_set = {JustEq(1), JustEq(2)} print(JustEq(1) in as_set) # prints False print(JustEq(1) in list(as_set)) # prints True ``` In general this is bad practice for the reasons above, so I'd actually love to havet this warn both as a general warning and as a Python 3 warning, but I don't see a clean way to have the same rule apply in multiple contexts.
* Even more granular copyrights (thanks to copyrite)Claudiu Popa2016-07-231-1/+3
|
* Keep a consistent copyright notice across the board.Claudiu Popa2016-07-191-0/+1
| | | | | This was changed automatically in #894, but apparently we need to have the copyright notice somewhere.
* Add the new shorter license header, including to missing files. Close #894.Claudiu Popa2016-06-011-13/+3
|
* Fix typos (#916)Jakub Wilk2016-05-251-1/+1
| | | | | | | | * Split words that were inadvertently glued together * Fix typos in the documentation * Fix typos in message descriptions
* Let visit_importfrom from Python 3 porting checker be called when everything ↵Claudiu Popa2016-03-181-4/+5
| | | | | | | | | | is disabled Because the visit method was filtering the patterns it was expecting to be activated, it didn't run when everything but one pattern was disabled, leading to spurious false positives Close #852
* Import has_known_bases and safe_infer back into pylint from astroid, until ↵Claudiu Popa2015-11-201-3/+2
| | | | | | | | | the latter stabilizes its API. Currently astroid goes into a total revamp, having a couple of development branches with partially incompatible APIs, which means that pylint can't rely on the exact location of has_known_bases and safe_infer until astroid reaches a new major release. With this in mind, these two functions are backported in pylint again.
* Make pylint work with Python 3.5 changes in astroid.Claudiu Popa2015-09-181-1/+1
|
* Use the new node names for the visit and leave methodsClaudiu Popa2015-08-261-5/+5
| | | | | Also, emit a PendingDeprecationWarning if the old names are still used, this support being removed in pylint 2.0.
* Update pylint to use the new astroid AST names and methodsClaudiu Popa2015-08-251-4/+4
| | | | | | | Also improve a couple of imports and added support for the old visit_ names. Priority will have the old visit_ names, such as visit_discard over visit_expr, visit_callfunc over visit_call etc.
* Use the new CallFunc.keywords instead of filtering out Keyword from ↵Claudiu Popa2015-08-081-6/+6
| | | | CallFunc.args.
* Fix a typo.Claudiu Popa2015-07-161-1/+1
|
* Use safe_infer and has_known_bases from astroid.helpers. Closes issue #593.Claudiu Popa2015-07-061-2/+4
|
* Add a new error for the Python 3 porting checker, `import-star-module-level`.Claudiu Popa2015-06-251-1/+9
| | | | | | This error is used when a star import is detected in another scope than the module level, which is an error on Python 3. Using this will emit a SyntaxWarning on Python 2.
* Fix some pylint warnings over pylint's codebase.Claudiu Popa2015-05-161-2/+2
|
* issue-422 solved some pylint warnings when running pylint on pylint code baseSimu Toni2015-03-281-1/+1
|
* Fix a couple of doc warnings, use string continuation.Claudiu Popa2015-03-021-3/+3
|
* Add a new warning for the Python 3 porting checker, 'using-cmp-argument'.Claudiu Popa2015-02-281-0/+39
| | | | | This warning is emitted when the `cmp` argument for the `list.sort` or `sorted builtin` is encountered, since it was removed in Python 3. This is part of the issue #376.
* Backed out changeset c1f2f0c187b0Claudiu Popa2015-02-271-0/+5
| | | | This is actually used by the test, which aren't calling visit_module.
* Remove Python3Checker constructor, visit_module() does all its jobPavel Roskin2015-02-261-5/+0
|
* Clear Python3Checker state on every new modulePavel Roskin2015-02-251-0/+5
| | | | | This fixes detection of missing __future__ imports when processing multiple files.
* Don't emit not-iterating warnings when the builtin is used in an unpacking.Claudiu Popa2015-02-211-0/+6
|
* Fix a false positive with dict and not-iterating warnings.Claudiu Popa2015-02-211-1/+1
| | | | | | dict accepts iterators, as much as set and list does. This patch fixes this and adds tests for the other callables for which we shouldn't emit.
* Remove visit_discard for map-builtin-not-iterating, since it is already ↵Claudiu Popa2015-02-211-9/+0
| | | | caught by visit_callfunc.
* Set old_names for map-builtin-not-iterating since it replaced ↵Brett Cannon2015-02-201-2/+3
| | | | implicit-map-evaluation
* merge with defaultBrett Cannon2015-02-201-28/+79
|
* Move all package files to a pylint package.Ionel Cristian Maries2015-02-141-0/+488