anaconda
anaconda copied to clipboard
Import statement text in docstring wrongly marked as invalid import
There seems to be an issue what Anaconda identifies as import statements. It should not detect strings that look "somewhat like" or even exactly like imports as imports. They are just strings, nothing more and should not be marked as errors by the linter.
Expected Behaviour
None of the lines in the docstring below should be linted as errors/invalid import statements.
def foobar():
"""This is a random docstring.
from something: marked as an error, as it starts with 'from'
import something: marked as an error, as it starts with 'import'
from datetime import datetime: valid imports still marked as error
1 from something: this is fine, as it's starting with sth. else
2 import something: this is fine, as it's starting with sth. else
"""
pass
Actual Behaviour
The lines stating that they are shown as errors are marked by the anaconda linter as invalid import statements. The exact errors are in the form: [E] ImportValidator (801): can't import ...
Steps to Reproduce
- Create any class or function with a docstring
- Add a line in the docstring that starts with either
fromorimport - Lint the file with anaconda and see the lines being marked as errors
ST3, Anaconda and OS versions
- ST3 Build 3176
- Anaconda 2.1.29
- Ubuntu 18.04
ST3 Console Logs
Nothing of interest
Anaconda's JsonServer Logs
Nothing of interest
Note: Anaconda's JsonServer logs can be found in:
- Linux: ~/.local/share/anaconda/logs
- OS X: ~/Library/Logs/anaconda
- Windows: %APPDATA\Anaconda\Logs
I experience the same behavior at the moment.