Skip to content

Commit

Permalink
[linter] Try to match more keyword args for objects.extra()
Browse files Browse the repository at this point in the history
this will find other usages of raw sql statements but may also
lead to some false positives.
  • Loading branch information
atodorov committed Jan 6, 2019
1 parent 00bb244 commit 2f8b694
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kiwi_lint/raw_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def visit_attribute(self, node):
# looking for .extra(select={}) patterns
if node.attrname == 'extra' and isinstance(node.parent, astroid.Call):
for keyword in node.parent.keywords:
if keyword.arg == 'select':
if keyword.arg in ['select', 'where', 'params',
'tables', 'order_by', 'select_params']:
self.add_message('avoid-raw-sql', node=node)
break

0 comments on commit 2f8b694

Please sign in to comment.