Shopify / shopify_python

Python development standards at Shopify
MIT License
66 stars 13 forks source link

Linter fails on `is` keyword #77

Closed actgardner closed 7 years ago

actgardner commented 7 years ago

When we upgraded to the 0.4.1 version of the package, we started getting exceptions from the linter:

Linting all the things...
Traceback (most recent call last):
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
    Run(sys.argv[1:])
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/lint.py", line 1300, in __init__
    linter.check(args)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/lint.py", line 726, in check
    self._do_check(files_or_modules)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/lint.py", line 855, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/lint.py", line 934, in check_astroid_module
    walker.walk(ast_node)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/utils.py", line 973, in walk
    self.walk(child)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/utils.py", line 973, in walk
    self.walk(child)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/utils.py", line 973, in walk
    self.walk(child)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/utils.py", line 973, in walk
    self.walk(child)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/utils.py", line 973, in walk
    self.walk(child)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/pylint/utils.py", line 970, in walk
    cb(astroid)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/shopify_python/google_styleguide.py", line 145, in visit_lambda
    self.__lambda_func(node)
  File "/Users/alangardner/.pyenv/virtualenvs/panama/2.7.13/lib/python2.7/site-packages/shopify_python/google_styleguide.py", line 309, in __lambda_func
    operator = self.BINARY_OPERATORS[node.ops[0][0]]

KeyError: 'is'
actgardner commented 7 years ago

Once this is fixed we should revert this commit in Panama to re-enable shopify_python linting: https://github.com/Shopify/panama/commit/675eaa0e25185e88dd90b59482e4629684f756de

JasonMWhite commented 7 years ago

/cc @cfournie @sabidib @solackerman

cfournie commented 7 years ago

This appears to be fixed by #79 as tested by https://github.com/Shopify/panama/pull/82.