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

last_maker_element = maker.children[-1] #15

Closed
agb80 opened this issue Sep 22, 2016 · 6 comments
Closed

last_maker_element = maker.children[-1] #15

agb80 opened this issue Sep 22, 2016 · 6 comments

Comments

@agb80
Copy link

agb80 commented Sep 22, 2016

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
Copy link
Contributor

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
Copy link
Author

agb80 commented Sep 22, 2016

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
Copy link
Contributor

Thanks, will be fixed soon.

@agb80
Copy link
Author

agb80 commented Sep 23, 2016

You're welcome

jstasiak pushed a commit that referenced this issue Sep 23, 2016
Previously it'd crash with something like:

Traceback (most recent call last):
  File "flake8", line 34, in <module>
    sys.exit(flake8.main.main())
  File ".../buildout-cache/eggs/flake8-2.6.0-py2.7.egg/flake8/main.py", line 36, in main
    report = flake8_style.check_files()
  File ".../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 ".../buildout-cache/eggs/flake8-2.6.0-py2.7.egg/flake8/engine.py", line 172, in _retry_serial
    return func(*args, **kwargs)
  File ".../buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1875, in check_files
    self.input_dir(path)
  File ".../buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1911, in input_dir
    runner(os.path.join(root, filename))
  File ".../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 ".../buildout-cache/eggs/pycodestyle-2.0.0-py2.7.egg/pycodestyle.py", line 1608, in check_all
    self.check_ast()
  File ".../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 ".../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 ".../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

Fixes #15
@jstasiak
Copy link
Contributor

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

@agb80
Copy link
Author

agb80 commented Sep 26, 2016

Problem solved, thank you very much!!!

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

No branches or pull requests

2 participants