{"action":"created","issue":{"url":"https://api.github.com/repos/PyCQA/prospector/issues/294","repository_url":"https://api.github.com/repos/PyCQA/prospector","labels_url":"https://api.github.com/repos/PyCQA/prospector/issues/294/labels{/name}","comments_url":"https://api.github.com/repos/PyCQA/prospector/issues/294/comments","events_url":"https://api.github.com/repos/PyCQA/prospector/issues/294/events","html_url":"https://github.com/PyCQA/prospector/issues/294","id":382844664,"node_id":"MDU6SXNzdWUzODI4NDQ2NjQ=","number":294,"title":"Prospector changes the behaviour of pylint for what concerns absolute imports","user":{"login":"giovannipizzi","id":16132028,"node_id":"MDQ6VXNlcjE2MTMyMDI4","avatar_url":"https://avatars0.githubusercontent.com/u/16132028?v=4","gravatar_id":"","url":"https://api.github.com/users/giovannipizzi","html_url":"https://github.com/giovannipizzi","followers_url":"https://api.github.com/users/giovannipizzi/followers","following_url":"https://api.github.com/users/giovannipizzi/following{/other_user}","gists_url":"https://api.github.com/users/giovannipizzi/gists{/gist_id}","starred_url":"https://api.github.com/users/giovannipizzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giovannipizzi/subscriptions","organizations_url":"https://api.github.com/users/giovannipizzi/orgs","repos_url":"https://api.github.com/users/giovannipizzi/repos","events_url":"https://api.github.com/users/giovannipizzi/events{/privacy}","received_events_url":"https://api.github.com/users/giovannipizzi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-20T20:55:28Z","updated_at":"2018-12-03T15:44:05Z","closed_at":null,"author_association":"NONE","body":"In particular, if I am using a globally-installed module (e.g.: `tzlocal`) but I also create a folder called `tzlocal` in my source tree, prospector will complain (because it will try to load the `tzlocal` module in the path rather than the global one when it encounters `import tzlocal` in a python file in the same folder).\r\nA repository with a minimal example to reproduce the problem (thanks to @ltalirz) is here:\r\nhttps://github.com/ltalirz/prospector-pylint-absolute-import\r\n\r\nAnd we are having issues e.g. in our repo that uses prospector in pre-commit hooks, see e.g. aiidateam/aiida_core#2205\r\n\r\nIn particular:\r\n- if I do `pylint path/to/file` absolute imports are properly honored\r\n- Instead if I do `prospector path/to/file` all imports are always considered as relative\r\n\r\nApparently, this is done on purpose?\r\nhttps://github.com/PyCQA/prospector/blob/744112f8a837bf48af1f88e66a33e7dfe2368d85/prospector/tools/pylint/__init__.py#L147-L156\r\n\r\nHowever, I think this is a problem because it changes the behaviour of pylint.\r\n\r\nA (partial) workaround would be to just call `prospector` or `prospector .` (note instead `prospector pkg` would give the unexpected/unwanted behaviour described above).\r\n\r\nHowever, this is suboptimal and not a good workaround: it makes it not possible to use it with pre-commit hooks, where we can run prospector only on those few files that were changed.\r\n\r\nOne possible suggestion I have is to add a command line flag to specify the path to use (or equivalently not to extend the path with the folders of each file specified on the command line).\r\n\r\nAnother option is *not* to deprecate the `-p` option on the command line, but still honour the remaining arguments (now called checkpaths) to whitelist files to be checked.\r\n\r\nI.e., what I mean is:\r\n\r\n`prospector -p . pkg/file1.py`\r\n\r\nshould not add `pkg` to the sys.path, and check *only* the file `pkg./file1.py`.\r\n\r\nNote that now, if `-p` is specified, all the paths specified (`pkg/file1.py` in this example) are ignored, and therefore *all* files in the package are checked.\r\n\r\nIt would be great to have this feature, because right now we would need either to disable pylint errors one each file, or to refactor our code to change all folder names, that looks suboptimal..."},"comment":{"url":"https://api.github.com/repos/PyCQA/prospector/issues/comments/443755882","html_url":"https://github.com/PyCQA/prospector/issues/294#issuecomment-443755882","issue_url":"https://api.github.com/repos/PyCQA/prospector/issues/294","id":443755882,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Mzc1NTg4Mg==","user":{"login":"giovannipizzi","id":16132028,"node_id":"MDQ6VXNlcjE2MTMyMDI4","avatar_url":"https://avatars0.githubusercontent.com/u/16132028?v=4","gravatar_id":"","url":"https://api.github.com/users/giovannipizzi","html_url":"https://github.com/giovannipizzi","followers_url":"https://api.github.com/users/giovannipizzi/followers","following_url":"https://api.github.com/users/giovannipizzi/following{/other_user}","gists_url":"https://api.github.com/users/giovannipizzi/gists{/gist_id}","starred_url":"https://api.github.com/users/giovannipizzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giovannipizzi/subscriptions","organizations_url":"https://api.github.com/users/giovannipizzi/orgs","repos_url":"https://api.github.com/users/giovannipizzi/repos","events_url":"https://api.github.com/users/giovannipizzi/events{/privacy}","received_events_url":"https://api.github.com/users/giovannipizzi/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T15:44:05Z","updated_at":"2018-12-03T15:44:05Z","author_association":"NONE","body":"@carlio @chocoelho it would be great to have your feedback on this to know how to proceed. Thanks!"}}
{"actor":{"display_login":"giovannipizzi"}}