summaryrefslogtreecommitdiff
path: root/pylint/checkers
Commit message (Collapse)AuthorAgeFilesLines
* Use the new .ctx attribute for subscripts for detecting in which context the ↵Claudiu Popa2015-12-081-25/+9
| | | | node was used. Closes issue #705.
* Allow statements in if or try blocks containing imports.Laura M?dioni2015-12-021-3/+18
| | | | Closes issue #714
* Move the construction of generated_members into open.Claudiu Popa2015-12-071-10/+10
|
* Added a new error, 'relative-beyond-top-level'.Claudiu Popa2015-12-061-6/+20
| | | | | | | This is emitted when a relative import was attempted beyond the top level package. For instance, if a package has X levels, trying to climb X + n levels with a relative import, as in `from ..stuff import Stuff`, will result in an error. Closes issue #588.
* Make pylint work with new astroid exceptions, AstroidImportError and ↵Claudiu Popa2015-12-062-14/+12
| | | | AstroidSyntaxError.
* Don't emit super-on-old-class on classes with unknown bases.Claudiu Popa2015-12-061-9/+5
| | | | | | The change also removes the confidence handling for super-on-old-class, which isn't used enough to merit its existence. Closes issue #721.
* Accept only functions and methods for the deprecated-method checker.Claudiu Popa2015-12-031-3/+9
| | | | | This prevents a crash which can occur when an object doesn't have .qname() method after the inference.
* Don't emit import-self and cyclic-import for relative imports of modules ↵Claudiu Popa2015-12-011-3/+15
| | | | | | | | | | | | | | | | | with the same name as the package itself. The problem was partially the fault of astroid.modutils.get_module_part, in combination with a given context file. The function returned 'dummy' as the module part for the string `dummy.dummy.Dummy`, which is in fact true, since the first dummy is the package and the second dummy is the module from where Dummy gets loaded. But get_module_part has no way to know this semantic inference, that the second dummy is a relative import inside the first one. As such, it's better to just skip the check if the condition of being relative inside a __init__.py file is found, since there's no way to load itself in that case. Closes issues #708 and #706.
* Refactor things through the imports checkerClaudiu Popa2015-12-011-65/+80
| | | | | | | | This patch transforms some public functions / methods to private and moves some blocks of code into their own functions. Through the latter, a couple of new messages are now emitted even though the module couldn't be imported, such as reimported, which doesn't make sense to not emit in this case.
* Don't emit unsubscriptable-object if the node is found inside an abstract ↵Claudiu Popa2015-11-301-0/+3
| | | | class. Closes #685.
* Add wrong-import-position to check_messages's decorator arguments for ↵Claudiu Popa2015-11-301-1/+2
| | | | | | | | | | ImportChecker.leave_module This fixes an esoteric bug which occurs when ungrouped-imports and wrong-import-order are disabled and pylint is executed on multiple files. What happens is that without wrong-import-position in check_messages, leave_module will never be called, which means that the first non-import node from other files might leak into the current file, leading to wrong-import-position being emitted by pylint.
* Don't use .iteritems, it doesn't exist on Python 3. Change some variable ↵Claudiu Popa2015-11-291-11/+8
| | | | names and the name of the builtins module.
* Add some more comments about the limitations of this ruleLaura M?dioni2015-11-241-0/+7
| | | | related to issue #674
* Drop printLaura M?dioni2015-11-241-2/+0
| | | | related to issue #674
* Use a stack of dictionaries instead of 3 dictsLaura M?dioni2015-11-241-24/+8
| | | | | | | - This way it works with embedded classes and functions - Update the tests accordingly related to issue #674
* check if the type of a variable is redefined (at a function, class or module ↵Laura M?dioni2015-10-301-0/+88
| | | | | | scope) related to issue #674
* Added a new warning, 'unsupported-delete-operation'Claudiu Popa2015-11-262-21/+39
| | | | | It is emitted when item deletion is tried on an object which doesn't have this ability. Closes issue #592.
* Added a new warning, 'unsupported-assignment-operation'Claudiu Popa2015-11-262-9/+47
| | | | | This is emitted when item assignment is tried on an object which doesn't have this ability. Closes issue #591.
* Simplify the protocol methods, by using a common function.Claudiu Popa2015-11-261-41/+12
|
* Ignore multiple comparisons in unneeded-not ruleLaura M?dioni2015-11-251-0/+3
| | | | related to issue #703
* Make some imports external instead of considering them localClaudiu Popa2015-11-251-3/+3
| | | | | | | | | The assumption that a module which can't be imported is local rather than external isn't always correct, since the implementation of the astroid's import system should always find a module which is local in the current package, while it isn't necessary true that it can find always external modules, which just might be missing.
* Change the variable name to something more suggestiveClaudiu Popa2015-11-251-6/+7
|
* Fix some docstrings and the Python 3 testsClaudiu Popa2015-11-251-3/+5
|
* Fix new import related errors in pylint's codebase.Claudiu Popa2015-11-2512-30/+39
|
* Improve a bit wrong-import-position code and add commentsLaura M?dioni2015-11-241-7/+11
| | | | related to issue #692
* Simplify a bit the algorithm checking for ungrouped importsLaura M?dioni2015-11-241-12/+8
| | | | related to issue #692
* Remove a chunk of code that was never executedLaura M?dioni2015-11-231-3/+0
| | | | related to issue #692
* Factorize code in _record_import methodLaura M?dioni2015-11-231-9/+13
| | | | related to issue #692
* slightly change wrong-import-position message and add forgotten functional testLaura M?dioni2015-11-121-2/+2
| | | | related to issue #692
* Check imports are located at the top of the module (right after docstring ↵Laura M?dioni2015-11-101-0/+36
| | | | | | and comments) related to issue #692
* Check imports are ordered (standard, 3rd party, local) and grouped by packageLaura M?dioni2015-11-091-1/+83
| | | | related to issue #692
* Fix instances of unneeded-not in pylint's codebase.Claudiu Popa2015-11-254-4/+4
|
* Add is to the checked operatorsLaura M?dioni2015-11-241-1/+1
|
* Fix crash with 'in' operator on unneeded-notLaura M?dioni2015-10-291-1/+3
|
* improve NotCheckerLaura M?dioni2015-10-271-5/+8
| | | | | - move reverse_op declaration out of visit_unaryop - build message out of operand, instead of using replace() on node.as_string()
* improve unneeded-not messagesLaura M?dioni2015-10-271-2/+2
| | | | | - warning => convention - "One not too many" => "consider changing.."
* Check for nots too many in comparison expressionsLaura M?dioni2015-10-261-0/+31
|
* Ignore missing docstrings for decorated attribute setters and deletersMichael Kefeder2015-11-191-0/+12
| | | | Closes issue #651.
* Cleanup pylint issuesClaudiu Popa2015-11-216-23/+18
| | | | | | | | | | | This changeset also brings a couple of changes: * rrheaders and rcheaders are dropped from html_writer.Table's constructor. They weren't used at all and it was dead code. This simplified some if statements. * _is_attribute_property is used to look for a property assignment instead on relying on a different implementation.
* Added a new refactoring warning, 'simplifiable-if-statement'Claudiu Popa2015-11-211-1/+83
| | | | | | | | | | | | | | This is used when an if statement could be reduced to a boolean evaluation of its test, as seen in this example: if some_cond: return True else: return False could be reduced to `return bool(some_cond)` Closes issue #698.
* Use the correct module.Claudiu Popa2015-11-201-2/+2
|
* Simplify the unflatten algorithm in order to not use NodeNG anymore.Claudiu Popa2015-11-201-5/+7
|
* Import has_known_bases and safe_infer back into pylint from astroid, until ↵Claudiu Popa2015-11-2012-74/+106
| | | | | | | | | 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.
* Merged in anentropic/pylint/remove-E0201-references (pull request #303)Claudiu Popa2015-11-181-1/+1
|\ | | | | | | error E0201 is obsolete - now E1101
| * error E0201 is obsolete - now E1101remove-E0201-referencesAnentropic2015-11-181-1/+1
| |
* | check the number of boolean expressions in if statement is reasonnableLaura M?dioni2015-10-291-2/+42
| | | | | | | | | | | | | | --max-bool-expr option allows to configure it (by default, up to 5 are tolerated) closes issue #677
* | Use safe inference in unpacking-non-sequence checkerDmitry Pribysh2015-11-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, this fix means that we won't be able to emit an error for cases like this one: ``` def foo(): if True: return [1, 2] return [3, 4, 5] a, b = foo() ``` Well, not unless we get flow-sensitive inference. But we still need this fix to reduce the number of false-positive errors. Fixes issue #695.
* | Refactor non-iterator-returned checker to use safe inferenceDmitry Pribysh2015-11-091-8/+24
| | | | | | | | This way it won't infer all possibles values of a node, only two at most.
* | fix get_type()Laura M?dioni2015-11-061-1/+1
| | | | | | | | | | It returned erroneous number of comment lines. tok_type is set just once, here one must look at the current token
* | Reduce number of false positives emitted by non-iterator-returned checkerDmitry Pribysh2015-11-071-4/+7
|/ | | | | | | | By disabling checker for cases when there're multiple possible values infered for node. This way we lose some of the inference power, but throw a lot less false positives. Fixes issue #695.