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

CLI: Add --ignore-local-config flag #2061

Merged
merged 4 commits into from
Dec 8, 2021
Merged

CLI: Add --ignore-local-config flag #2061

merged 4 commits into from
Dec 8, 2021

Conversation

jpy-git
Copy link
Contributor

@jpy-git jpy-git commented Dec 6, 2021

Brief summary of the change made

This is a follow up to #1986 (The code changes are near identical, just for a different flag).
This PR adds a --ignore-local-config flag to the CLI that serves 2 main purposes:

  1. Allow a user to run a command with the default config. Useful for debugging whether issues are config specific.
  2. When used in conjunction with the --config flag the user is able to use a custom config without the local config override behaviour.

The idea was from a discussion with @tunetheweb when making the original PR.
image

Are there any other side effects of this change that we should be aware of?

No

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with python test/generate_parse_fixture_yml.py or by running tox locally).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

@jpy-git jpy-git changed the title CLI: Add --ignore-default-config flag CLI: Add --ignore-local-config flag Dec 6, 2021
@jpy-git
Copy link
Contributor Author

jpy-git commented Dec 7, 2021

@barrywhart @tunetheweb this option allows for non-override behaviour when specifying the config via the CLI 👍

Looking to get this + the config simple API option finished before the next release

@codecov
Copy link

codecov bot commented Dec 7, 2021

Codecov Report

Merging #2061 (79590d6) into main (2325fd0) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #2061   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          148       148           
  Lines        10508     10510    +2     
=========================================
+ Hits         10508     10510    +2     
Impacted Files Coverage Δ
src/sqlfluff/cli/commands.py 100.00% <100.00%> (ø)
src/sqlfluff/core/config.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2325fd0...79590d6. Read the comment docs.

Copy link
Member

@tunetheweb tunetheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Does seem a lot of repetition in these config changes. Wonder if there is any refactor possible to avoid having to make so many similar lines to so many places if this changes again in future? But outside of scope for this PR so happy to approve it.

@jpy-git
Copy link
Contributor Author

jpy-git commented Dec 8, 2021

@tunetheweb yeah it's definitely something to look into. Most of the lines in this and #1986 are because they're specifically to do with loading the config. Most other config changes should be fairly lightweight 😄

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

Successfully merging this pull request may close these issues.

None yet

2 participants