Code Monkey home page Code Monkey logo

Comments (3)

thomasaarholt avatar thomasaarholt commented on June 13, 2024 1

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.

brox avatar brox commented on June 13, 2024 1

@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.

KyleKing avatar KyleKing commented on June 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.