Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule L059 bug with IF #2824

Merged
merged 4 commits into from Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sqlfluff/rules/L059.py
Expand Up @@ -108,9 +108,9 @@ def _eval(self, context: RuleContext) -> Optional[LintResult]:
# Ignore the segments that are not of the same type as the defined policy above.
# Also TSQL has a keyword called QUOTED_IDENTIFIER which maps to the name so
# need to explicity check for that.
if (
context.segment.name not in context_policy
or context.segment.raw.lower() in ("quoted_identifier", "naked_identifier")
if context.segment.name != context_policy or context.segment.raw.lower() in (
"quoted_identifier",
"naked_identifier",
):
return None

Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/rules/std_rule_cases/L059.yml
Expand Up @@ -277,3 +277,11 @@ test_pass_ignore_lists_mixed_case:
rules:
L059:
ignore_words: foo

test_pass_ignore_if:
pass_str:
DROP TABLE IF EXISTS "example";
configs:
rules:
L059:
prefer_quoted_identifiers: True