Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined-variable false positives with async/await #767

Closed
belak opened this issue Jan 6, 2016 · 1 comment
Closed

undefined-variable false positives with async/await #767

belak opened this issue Jan 6, 2016 · 1 comment
Assignees
Labels

Comments

@belak
Copy link

belak commented Jan 6, 2016

https://travis-ci.org/belak/python-seabird/builds/100674977

https://github.com/belak/python-seabird/blob/async-metar/seabird/plugins/metar.py

pylint dep versions:
astroid-1.4.3 colorama-0.3.5 lazy-object-proxy-1.2.1 pylint-1.5.2 wrapt-1.10.6

It also errors with pylint==1.4.5, but I think it ends up being astroid errors there.

The relevant portion of the code for the lazy:

    async def metar_callback(self, cmd):
        resp = await aiohttp.get(METAR_URL.format(cmd.remainder.upper()))
        if resp.status == 404:
            cmd.mention_reply('{} is not a valid METAR code'.format(
                cmd.remainder))
            return
        elif resp.status != 200:
            cmd.mention_reply('Unable to get METAR for {}'.format(
                cmd.remainder))
            return

        try:
            data = await resp.text()
            cmd.mention_reply(data.split('\n')[1])
        except KeyError:
            cmd.mention_reply('Malformed METAR data for {}'.format(
                cmd.remainder))

And the log:

************* Module seabird.plugins.metar
E: 21,50: Undefined variable 'cmd' (undefined-variable)
E: 22,11: Undefined variable 'resp' (undefined-variable)
E: 23,12: Undefined variable 'cmd' (undefined-variable)
E: 24,16: Undefined variable 'cmd' (undefined-variable)
E: 26,13: Undefined variable 'resp' (undefined-variable)
E: 27,12: Undefined variable 'cmd' (undefined-variable)
E: 28,16: Undefined variable 'cmd' (undefined-variable)
E: 32,25: Undefined variable 'resp' (undefined-variable)
E: 33,12: Undefined variable 'cmd' (undefined-variable)
E: 33,30: Undefined variable 'data' (undefined-variable)
E: 35,12: Undefined variable 'cmd' (undefined-variable)
E: 36,16: Undefined variable 'cmd' (undefined-variable)
@PCManticore PCManticore self-assigned this Jan 6, 2016
PCManticore added a commit that referenced this issue Jan 9, 2016
When support for Python 3.5 was added, AsyncFunctionDef
wasn't handled properly in terms of FunctionDef, which meant
that most of the checks which involved a function were never
called for AsyncFunctionDef. This led to spurious false positives
which occurred when AsyncFunctionDef were analyzed.
Closes #767
@PCManticore
Copy link
Contributor

Thanks for the report. The fix will be released as part of 1.5.3 in the following days (I hope on Monday).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants