earwig / bitshift

A semantic search engine for source code
https://bitshift.benkurtovic.com/
MIT License
30 stars 5 forks source link

Parsers giving NULL for symbol row locations. #64

Closed earwig closed 10 years ago

earwig commented 10 years ago

This isn't valid. While columns and end_row can be null, the row should be giving some actual line number. I don't know if this is related to #62.

earwig commented 10 years ago

No, I'm talking about the start row, not the end row. Unless I'm missing something, 335027b won't fix that.

benattal commented 10 years ago

Can you give me an example of when the start row becomes None?

On Sun, Jun 8, 2014 at 1:03 PM, Ben Kurtovic notifications@github.com wrote:

Reopened #64 https://github.com/earwig/bitshift/issues/64.

— Reply to this email directly or view it on GitHub https://github.com/earwig/bitshift/issues/64#event-129161273.

benattal commented 10 years ago

I haven't seen it.

On Sun, Jun 8, 2014 at 3:39 PM, Benjamin Attal attal.benjamin@gmail.com wrote:

Can you give me an example of when the start row becomes None?

On Sun, Jun 8, 2014 at 1:03 PM, Ben Kurtovic notifications@github.com wrote:

Reopened #64 https://github.com/earwig/bitshift/issues/64.

— Reply to this email directly or view it on GitHub https://github.com/earwig/bitshift/issues/64#event-129161273.

earwig commented 10 years ago

Okay, I will find an example repo.

earwig commented 10 years ago

It happens when parsing test/configs/test.rb in https://github.com/mojombo/god:

14-06-08 15:53:05 INFO bitshift.crawler.indexer.GitIndexer:_insert_repository_codelets parsing: https://github.com/mojombo/god, test/configs/test.rb
14-06-08 15:53:05 ERROR bitshift.crawler.indexer.GitIndexer:_index_repository Exception raised while indexing:
Traceback (most recent call last):
  File "bitshift/crawler/indexer.py", line 132, in _index_repository
    self._insert_repository_codelets(repo)
  File "bitshift/crawler/indexer.py", line 178, in _insert_repository_codelets
    self.database.insert(codelet)
  File "bitshift/database/__init__.py", line 223, in insert
    self._insert_symbols(cursor, code_id, sym_type, symbols)
  File "bitshift/database/__init__.py", line 155, in _insert_symbols
    cursor.executemany(query2, params)
  File "cursor.pyx", line 138, in oursql.Cursor.executemany (oursqlx/oursql.c:17073)
  File "statement.pyx", line 402, in oursql._Statement.execute (oursqlx/oursql.c:10904)
  File "statement.pyx", line 127, in oursql._Statement._raise_error (oursqlx/oursql.c:8082)
ProgrammingError: (1048, "Column 'sloc_row' cannot be null", None)
benattal commented 10 years ago

I thought I had to offset the line numbers, but it turns out I was making row numbers negative, which python interpreted as None.