-
Notifications
You must be signed in to change notification settings - Fork 1.3k
config: forbid setting core.no_scm outside repo #3598
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
Conversation
Raise a ConfigError when setting core.no_scm on a global or system level. Fix #3427
shcheklein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be doing this check on the schema level. Even if I edit config manually we should be raising an exception.
|
@shcheklein , roger that. π The current We could validate each configuration file separately, something like: diff --git a/dvc/config.py b/dvc/config.py
index 6e1ccd7f..eba2768a 100644
--- a/dvc/config.py
+++ b/dvc/config.py
@@ -281,10 +281,12 @@ class Config(dict):
conf = {}
for level in self.LEVELS:
if level in self.files:
- _merge(conf, self.load_one(level))
+ level_conf = self.load_one(level)
- if validate:
- conf = self.validate(conf)
+ if validate:
+ level_conf = self.validate(level_conf, level)
+
+ conf = _merge(conf, level_conf)What do you think? |
|
@MrOutis it's a strong assumption. What if we have a section with two required fields and they are defined separately now in two configs. After your change it will start failing, right? Also, question is how we define this rule on the SCHEMA level? |
|
In my opion, only those config in lower levels can affect the validation process .Maybe something like I had got a simliar problem in pr3628 |
|
Closing as stale π |
|
@shcheklein, regarding
Schema and levels ( |
It might be, @ribitskiyb . I was not trying to dictate any specific solution, to be honest. Rather convey the problem and brainstorm together here.
it depends, I guess. How would it look like? How would the access interface look like? |
|
@shcheklein how about simply |
|
@ribitskiyb sounds good to me! Should if be part of the |
|
@shcheklein yea would be reasonable to put the check itself inside |

Raise a
ConfigErrorwhen settingcore.no_scmon a global or system level.Close #3427
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.
β I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)
Thank you for the contribution - we'll try to review it as soon as possible. π