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

[Improvement Suggestion][sqlfluff] Allow other config file other than .sqlfluff #4554

Open
keatmin opened this issue Jul 16, 2023 · 3 comments · May be fixed by #4562
Open

[Improvement Suggestion][sqlfluff] Allow other config file other than .sqlfluff #4554

keatmin opened this issue Jul 16, 2023 · 3 comments · May be fixed by #4562

Comments

@keatmin
Copy link

keatmin commented Jul 16, 2023

sqlfluff looks for the list of these files here automatically and should not require a hardcoded .sqlfluff to be looked up in the linter and in the fixer. Users of other config file and in my case pyproject.toml have no choice but to migrate to .sqlfluff

I want to suggest that we remove the constraint on allowing only .sqlfluff file as config file and let sqlfluff search for it.

@pbnj
Copy link
Contributor

pbnj commented Jul 20, 2023

Hi @keatmin - thank you for the suggestion. This seems like a good change to me, but I am not a sqlfluff user.

The sqlfluff fixer is defined here and the linter is defined here

Seems that removing these blocks is all that is needed?

Are you able to test this change locally and submit a PR if it works?

@keatmin
Copy link
Author

keatmin commented Jul 25, 2023

Hey @pbnj,

More than happy to submit a PR, just wanted to create an issue first.

I removed the block and it didn't work mainly because that we had %t in this and this which caused the tool to search for the config file in the temp folder instead of the buffer.

So what I will do is I can add a new variable to allow user to list their own config file via g:ale_sql_sqlfluff_config_file instead.

@pbnj
Copy link
Contributor

pbnj commented Jul 25, 2023

@keatmin -

Thank you for testing it and reporting back.

So what I will do is I can add a new variable to allow user to list their own config file via g:ale_sql_sqlfluff_config_file instead.

Adding a config option may be nice. You may also default it to the same list of configuration files that sqlfluff expects, because later config values may override previous config values, according to the docs you linked earlier:

For file based configuration SQLFluff will look for the following files in order. Later files will (if found) will be used to overwrite any values read from earlier files.

  • setup.cfg
  • tox.ini
  • pep8.ini
  • .sqlfluff
  • pyproject.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants