Comments (3)
Hahaha, I just went down a massive rabbit hole trying to figure this out, only to come out on the other side and realise there already was an issue on it :)
from flake8-sql.
@KyleKing I am able to reproduce this error using Python 3.9.9, flake8 4.0.1 and flake8-sql 0.4.1 when running python -m flake8 flake8_sql_format_check.py
on this file:
table_name = "mytable"
sql = f"SELECT id FROM {table_name} WHERE foo = 'bar'"
This gives the following traceback:
Traceback (most recent call last):
File "/Users/brox/.pyenv/versions/3.9.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/brox/.pyenv/versions/3.9.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/__main__.py", line 4, in <module>
cli.main()
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/main/application.py", line 375, in run
self._run(argv)
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/main/application.py", line 364, in _run
self.run_checks()
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/main/application.py", line 271, in run_checks
self.file_checker_manager.run()
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/checker.py", line 311, in run
self.run_serial()
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/checker.py", line 295, in run_serial
checker.run_checks()
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/checker.py", line 597, in run_checks
self.run_ast_checks()
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8/checker.py", line 500, in run_ast_checks
for (line_number, offset, text, _) in runner:
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8_sql/linter.py", line 49, in run
initial_offset = _get_initial_offset(node, self.lines)
File "/Users/brox/.pyenv/versions/sandbox/lib/python3.9/site-packages/flake8_sql/linter.py", line 178, in _get_initial_offset
first_physical_line = physical_lines[query_end_lineno - len(logical_lines)]
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
from flake8-sql.
I went back to revisit this issue, but I oddly can no longer replicate it 🤔
@thomasaarholt, can you share a snippet that fails for you? What Python version were you using?
from flake8-sql.
Related Issues (18)
- Doesn't recognise literals
- from confusion HOT 1
- Python 3.8 changes behaviour and makes noqa for multiline strings impossible
- Q449 confusion HOT 8
- Should ABS trigger Q442? HOT 4
- Failed to run Flake8-sql HOT 2
- Q447 a Q449 do not work well with group by and having
- Evaluate sqlparse
- False positive on docstring HOT 4
- TypeError NoneType - int HOT 1
- Warn Q447 on false horizontal alignment
- Consider DBMS specific keyword lists
- Unable to run flake8_sql with flake8 on Ubuntu 14.04 HOT 4
- The syntax for disabling multiple warnings in one line is too strict HOT 1
- Q440 keyword type / key is not uppercase HOT 2
- SQL queries inside f-strings (Python 3.6+) are not being checked HOT 4
- Q447 root_keywords SELECT and FROM are not right aligned HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8-sql.