smarkets / flake8-strict

Flake8 plugin that checks Python code against a set of opinionated style rules
MIT License
10 stars 8 forks source link

last_maker_element = maker.children[-1] #15

Closed agb80 closed 8 years ago

agb80 commented 8 years ago

I'm getting this error on several test running flake8-strict, please let me know how can I help to debug:

Traceback (most recent call last):
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/bin/flake8", line 34, in <module>
    sys.exit(flake8.main.main())
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/flake8-2.6.0-py2.7.egg/flake8/main.py", line 36, in main
    report = flake8_style.check_files()
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/flake8-2.6.0-py2.7.egg/flake8/engine.py", line 181, in check_files
    return self._retry_serial(self._styleguide.check_files, paths=paths)
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/flake8-2.6.0-py2.7.egg/flake8/engine.py", line 172, in _retry_serial
    return func(*args, **kwargs)
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1875, in check_files
    self.input_dir(path)
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1911, in input_dir
    runner(os.path.join(root, filename))
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/flake8-2.6.0-py2.7.egg/flake8/engine.py", line 126, in input_file
    return fchecker.check_all(expected=expected, line_offset=line_offset)
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1608, in check_all
    self.check_ast()
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1555, in check_ast
    for lineno, offset, text, check in checker.run():
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/flake8_strict-0.1.3-py2.7.egg/flake8_strict.py", line 45, in run
    for line, column, error_code in errors:
  File "/home/gitlab-runner/builds/fb89f861/0/l10n_mx/l10n_mx_payroll/buildout-cache/eggs/flake8_strict-0.1.3-py2.7.egg/flake8_strict.py", line 149, in _process_atom
    last_maker_element = maker.children[-1]
IndexError: tuple index out of range
jstasiak commented 8 years ago

Hey, thanks for the report. What I do in a situation like this usually is to first run flake8 on a more and more limited set of files so I discover what file in particular contains breaking code and then remove more and more code from that file to see what exactly is the problem (basically we need a minimal sample of code that lets us reproduce it).

agb80 commented 8 years ago

Done, the problem is caused by this part on my setup.py file:

    extras_require={
        'test': [
            'requests_mock'
        ],
    },

notice the request_mock is missing trailing comma.

EDIT: Forgot to said that adding the missing trailing comma run test without problems

jstasiak commented 8 years ago

Thanks, will be fixed soon.

agb80 commented 8 years ago

You're welcome

jstasiak commented 8 years ago

Just released 0.1.4 on PyPI - hope it solves the issue for you.

agb80 commented 8 years ago

Problem solved, thank you very much!!!