Closed noel closed 1 year ago
It works correctly for me:
(sqlfluff-3.10.8) ➜ my-dbt git:(2.0.0a4) ✗ curl -X POST 'localhost:8581/lint?sql_path=/Users/barry/dev/sqlfluff/my-dbt/models/osmosis_issue_44.sql&extra_config_path=/Users/barry/dev/sqlfluff/my-dbt/.sqlfluff'
{"result":[{"code":"L016","description":"Line is too long (25 > 14).","line_no":1,"line_pos":1},{"code":"L016","description":"Line is too long (21 > 14).","line_no":3,"line_pos":9},{"code":"L016","description":"Line is too long (21 > 14).","line_no":4,"line_pos":9},{"code":"L016","description":"Line is too long (15 > 14).","line_no":6,"line_pos":9},{"code":"L028","description":"Qualified reference 's.year' found in single table select.","line_no":6,"line_pos":9},{"code":"L016","description":"Line is too long (21 > 14).","line_no":7,"line_pos":9},{"code":"L016","description":"Line is too long (70 > 14).","line_no":8,"line_pos":13},{"code":"L016","description":"Line is too long (23 > 14).","line_no":9,"line_pos":9},{"code":"L016","description":"Line is too long (54 > 14).","line_no":10,"line_pos":5},{"code":"L066","description":"Aliases should be at least 7 character(s) long.","line_no":10,"line_pos":54},{"code":"L016","description":"Line is too long (20 > 14).","line_no":11,"line_pos":5},{"code":"L016","description":"Line is too long (17 > 14).","line_no":15,"line_pos":5},{"code":"L016","description":"Line is too long (17 > 14).","line_no":16,"line_pos":5},{"code":"L016","description":"Line is too long (20 > 14).","line_no":19,"line_pos":1},{"code":"L016","description":"Line is too long (18 > 14).","line_no":21,"line_pos":5},{"code":"L016","description":"Line is too long (19 > 14).","line_no":22,"line_pos":5},{"code":"L009","description":"Files must end with a single trailing newline.","line_no":23,"line_pos":1}]}%
I suspect the issue lies somewhere in the specifics of the other .sqlfluff
file(s) in the environment and how they are interacting. In order to debug this, I need a more detailed scenario to reproduce it, primarily a zipped-up directory (or directories) including:
.sql
file, possibly a .sqlfluff
file.sqlfluff
files involvedSQLFluff is very flexible and powerful in allowing multiple .sqlfluff
files, e.g. one per directory, and the files overlay in particular ways. The downside of this flexibility and power is that it's sometimes unclear which .sqlfluff
files are involved when linting, and what the final combined configuration is from those files.
Also, note that where you run the sqlfluff lint
command from (i.e. the current directory) affects which .sqlfluff
files are used. On the other hand, the osmosis server works differently. IIRC, it lints or fixes as if the command were run from the root directory of the dbt project. Additional, temporary logging in the SQLFluff code which loads the .sqlfluff
files could help understand what's happening.
Another possible approach -- delete all the .sqlfluff
files on the system except the one specified as extra_config_path
. With only one .sqlfluff
file, there should be no possibility of confusing configuration overlay.
this is due to us using sqlfluff 2.0.0a4 and osmosis being locked to < version 2.
Given this file
using sqlfluff 2.0.0a4 with this .sqlfluff config
running this on the command line
/config/.local/bin/sqlfluff lint --format json --config /config/workspace/transform/.sqlfluff transform/models/L2_bays/country_demographics/current_population.sql
outputs
whereas, running this
curl -X POST localhost:8581/lint?sql_path=/config/workspace/transform/models/L2_bays/country_demographics/current_population.sql&extra_config_path=/config/workspace/transform/.sqlfluff
returns this