You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When linting a file that contains a specific statement split across multiple lines, flake8-encodings raises a ValueError.
Steps to Reproduce
linting the following file:
subprocess.run(
"date"
).stdout.strip()
Actual result:
❯ flake8 scripts/repro.py
Traceback (most recent call last):
File "/home/user/code-personal/capa/.direnv/python-3.11/bin/flake8", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/main/cli.py", line 23, in main
app.run(argv)
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/main/application.py", line 198, in run
self._run(argv)
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/main/application.py", line 187, in _run
self.run_checks()
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/main/application.py", line 103, in run_checks
self.file_checker_manager.run()
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/checker.py", line 236, in run
self.run_serial()
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/checker.py", line 214, in run_serial
self.results = [
^
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/checker.py", line 219, in <listcomp>
).run_checks()
^^^^^^^^^^^^
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/checker.py", line 524, in run_checks
self.run_ast_checks()
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8/checker.py", line 426, in run_ast_checks
for (line_number, offset, text, _) in runner:
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8_encodings/__init__.py", line 363, in run
class_visitor.first_visit(self._tree, self.filename)
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8_encodings/__init__.py", line 213, in first_visit
self.visit(node)
File "/nix/store/ss7212zavvshj2wv7s4sr8np68j3ij9d-devshell-dir/lib/python3.11/ast.py", line 410, in visit
return visitor(node)
^^^^^^^^^^^^^
File "/nix/store/ss7212zavvshj2wv7s4sr8np68j3ij9d-devshell-dir/lib/python3.11/ast.py", line 418, in generic_visit
self.visit(item)
File "/nix/store/ss7212zavvshj2wv7s4sr8np68j3ij9d-devshell-dir/lib/python3.11/ast.py", line 410, in visit
return visitor(node)
^^^^^^^^^^^^^
File "/nix/store/ss7212zavvshj2wv7s4sr8np68j3ij9d-devshell-dir/lib/python3.11/ast.py", line 420, in generic_visit
self.visit(value)
File "/nix/store/ss7212zavvshj2wv7s4sr8np68j3ij9d-devshell-dir/lib/python3.11/ast.py", line 410, in visit
return visitor(node)
^^^^^^^^^^^^^
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8_encodings/__init__.py", line 319, in visit_Call
inferred_types = get_inferred_types(self.jedi_script, node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/flake8_encodings/__init__.py", line 433, in get_inferred_types
for inferred_name in jedi_script.infer(node.lineno, node.func.col_offset + len('.'.join(attr_names[:-1]))):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/code-personal/capa/.direnv/python-3.11/lib/python3.11/site-packages/jedi/api/helpers.py", line 484, in wrapper
raise ValueError('`column` parameter (%d) is not in a valid range '
ValueError: `column` parameter (21) is not in a valid range (0-15) for line 1 ('subprocess.run(\n').
the following script does not raise an exception, suggesting that perhaps the linter is relying on assumptions about some AST nodes being found on a single line:
subprocess.run("date").stdout.strip()
The text was updated successfully, but these errors were encountered:
Description
When linting a file that contains a specific statement split across multiple lines, flake8-encodings raises a ValueError.
Steps to Reproduce
linting the following file:
Actual result:
Expected result:
no stack trace.
Reproduces how often:
easily reproduced
Version
Installation source
pip
Other Additional Information:
the following script does not raise an exception, suggesting that perhaps the linter is relying on assumptions about some AST nodes being found on a single line:
The text was updated successfully, but these errors were encountered: