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

Support Removed warning on configs #3874

Merged
merged 2 commits into from
Sep 25, 2022
Merged

Conversation

alanmcruickshank
Copy link
Member

This is a fairly separable part of #3847, and can be merged separately. It will also simplify the review of that PR to take these changes out of it.

This allows particular config values to be marked as deprecated, prompting the user to remove them if they are set in a config. Optionally it also allows a configurable message to be set, informing the user how to update their config accordingly.

@codecov
Copy link

codecov bot commented Sep 25, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (aadf207) compared to base (f68159d).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #3874   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          179       179           
  Lines        13782     13800   +18     
=========================================
+ Hits         13782     13800   +18     
Impacted Files Coverage Δ
src/sqlfluff/core/config.py 100.00% <100.00%> (ø)
src/sqlfluff/core/plugin/lib.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@barrywhart barrywhart left a comment

Choose a reason for hiding this comment

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

Looks good overall. One question about the term "deprecated" and/or behavior of it.

if k in DEPRECATED_CONFIGS:
formatted_key = ":".join(k)
raise SQLFluffUserError(
f"Config file {file_path} set deprecated config "
Copy link
Member

Choose a reason for hiding this comment

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

The typical pattern I've seen for deprecation is to warn the user, then in a future release to remove it or raise an error. Wondering if we want to consider changing the behavior and/or use a term other than "deprecate".

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmmm - good idea. I'm going to change the wording. I think the more "brutal" approach is good because otherwise users may get strange linting results which they look at before any raised warnings.

@alanmcruickshank alanmcruickshank changed the title Support Deprecation on configs Support Removed warning on configs Sep 25, 2022
@alanmcruickshank alanmcruickshank merged commit d96f23e into main Sep 25, 2022
@alanmcruickshank alanmcruickshank deleted the ac/deprecate_configs branch September 25, 2022 14:01
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