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

CV06 not properly parsing file with multiple statments on oracle dialect #5987

Open
2 of 3 tasks
Tiaguituh05 opened this issue Jun 26, 2024 · 0 comments
Open
2 of 3 tasks
Labels
bug Something isn't working oracle

Comments

@Tiaguituh05
Copy link

Search before asking

  • I searched the issues and found no similar issues.

What Happened

The issue I'm facing is, if I set multiline_newline to true, it detects a missing ";" on the lines 6, 17, and 29. Which is not accurate
If I set it to false, it detects that the last line is missing a ";" which is correct, but it does not complaing about the other ones missing.

Expected Behaviour

CV06 | Statements must end with a semi-colon - Should be detected on lines 13, 21, 25 and 29.

Observed Behaviour

if I set multiline_newline to true , it detects a missing ";" on the lines 6, 17, and 29. Which is not accurate, line 6 and 17 already end with a semi-colon.

If I set multiline_newline to false, it only detects the missing semi-colon on the last line, 29.

How to reproduce

Create a sample.sql with the following:

DELETE
  FROM code_detail
 WHERE code_type IN ('PLTQ',
                     'RSCD',
                     'SLBK',
                     'PLTM');
--
DELETE
  FROM code_head
 WHERE code_type IN ('PLTQ',
                     'RSCD',
                     'SLBK',
                     'PLTM')
--
-- Plot quality
INSERT INTO code_head(code_type, code_desc)
VALUES('PLTQ', 'Plot Quality');
--
--Reason codes
INSERT INTO code_head(code_type, code_desc)
VALUES('RSCD', 'Reason codes')
--
-- Sales status - Inventory bucket
INSERT INTO code_head(code_type, code_desc)
VALUES('SLBK', 'Sales Status')
--
-- Plot Movements
INSERT INTO code_head(code_type, code_desc)
VALUES('PLTM', 'Movement type')

Run:
sqlfluff lint sample.sql

Dialect

oracle

Version

3.0.7

Configuration

[sqlfluff]
# verbose is an integer (0-2) indicating the level of log output
verbose = 0
# Turn off color formatting of output
nocolor = False
# Supported dialects https://docs.sqlfluff.com/en/stable/dialects.html
# Or run 'sqlfluff dialects'
dialect = oracle
# One of [raw|jinja|python|placeholder]
templater = jinja
# Comma separated list of rules to check, default to all
rules = all
# Comma separated list of rules to exclude, or None
exclude_rules = LT01,LT02
# The depth to recursively parse to (0 for unlimited)
#recurse = 0
# Below controls SQLFluff output, see max_line_length for SQL output
output_line_length = 80
# Number of passes to run before admitting defeat
runaway_limit = 10
# Ignore errors by category (one or more of the following, separated by commas: lexing,linting,parsing,templating)
ignore = None
# Warn only for rule codes (one of more rule codes, seperated by commas: e.g. L001,L002)
# Also works for templating and parsing errors by using TMP or PRS
warnings = None
# Ignore linting errors found within sections of code coming directly from
# templated code (e.g. from within Jinja curly braces. Note that it does not
# ignore errors from literal code found within template loops.
ignore_templated_areas = True
# can either be autodetect or a valid encoding e.g. utf-8, utf-8-sig
encoding = autodetect
# Ignore inline overrides (e.g. to test if still required)
disable_noqa = False
# Comma separated list of file extensions to lint
# NB: This config will only apply in the root folder
sql_file_exts = .sql,.sql.j2,.dml,.ddl
# Allow fix to run on files, even if they contain parsing errors
# Note altering this is NOT RECOMMENDED as can corrupt SQL
fix_even_unparsable = False
# Very large files can make the parser effectively hang.
# The more efficient check is the byte limit check which
# is enabled by default. The previous character limit check
# is still present for backward compatibility. This will be
# removed in a future version.
# Set either to 0 to disable.
large_file_skip_char_limit = 0
large_file_skip_byte_limit = 20000
# CPU processes to use while linting.
# If positive, just implies number of processes.
# If negative or zero, implies number_of_cpus - specified_number.
# e.g. -1 means use all processors but one. 0 means all cpus.
processes = 1

      [sqlfluff:rules:convention.terminator]
      # Semi-colon formatting approach
      multiline_newline = True
      require_final_semicolon = True

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@Tiaguituh05 Tiaguituh05 added the bug Something isn't working label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working oracle
Projects
None yet
Development

No branches or pull requests

1 participant