-
Notifications
You must be signed in to change notification settings - Fork 150
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
Config Error Messages Replace "-" With "_" #480
Comments
Thank you for raising this issue @rgajason, we will look into this. |
Is it ok if I try to fix this one, if it's not taken yet? |
Sure, you're welcome to fix this! Do you have any idea in mind? I am not sure what would be the best way to fix it 🤔 |
I'm thinking of modyfing |
I think that's not what this issue is about 😕. For historical reasons, ggshield accepts config keys written using both The problem of this feature is: if a user adds a This problem is potentially complicated to fix because at the point we find a non-existing key, we do not have the original key name anymore, so we can't report it. |
I came up with possible solution: We can pass optionally This will possibly separate checking and alerting from filtering uknown names, as it is now in |
I would prefer if
For consistency, it would be good to remove the call to We do not need to worry about the impact of the changes on other callers of Does this sound like a good plan to you @karo-fox? (Looking at your initial answer, maybe this is what you had in mind and I did not get it 😅) |
It sounds great. I tried implementing something similar at first on my forked repository. I encountered some failed functional tests with github actions and changed the solution I had in mind. Then I read that those fails can be related to GitHub actions not having access to gitguardian api key. Anyway, your idea sounds great. I can try implementing it if you don't mind. I am not really experienced with open source contributions and would like to resolve this issue. I also have a question: if functional tests pass on my local machine, is it ok to open pull request, in case those tests fail with github actions on my fork? |
Sure, you are more than welcome to work on it 👍🏻. The problem with the API key not being available for forks is annoying indeed but it's not a blocker (There is an issue for it: #374, we need to look into it on our side). Until that is fixed, we can run the functional tests manually with a valid key and merge your work if all tests pass. |
Reading the date of the last check from update_check.yaml failed because the name of the key is `check-at`, not `check_at`. This used to work until now because `load_yaml_dict()` transparently turned `-` into `_`, but it does not do this anymore now that we fixed #480.
Reading the date of the last check from update_check.yaml failed because the name of the key is `check-at`, not `check_at`. This used to work because `load_yaml_dict()` transparently turned `-` into `_`, but it does not do this anymore now that we fixed #480.
Reading the date of the last check from update_check.yaml failed because the name of the key is `check-at`, not `check_at`. This used to work because `load_yaml_dict()` transparently turned `-` into `_`, but it does not do this anymore now that we fixed #480. - Fix the key name. - Move loading and saving to separate functions to make the code easier to test. - Add more tests.
Reading the date of the last check from update_check.yaml failed because the name of the key is `check-at`, not `check_at`. This used to work because `load_yaml_dict()` transparently turned `-` into `_`, but it does not do this anymore now that we fixed #480. - Fix the key name. - Move loading and saving to separate functions to make the code easier to test. - Add more tests.
Environment
Describe the bug
The "Unrecognized key in config" error message displays an underscore instead of hyphen when an invalid configuration is present.
Steps to reproduce:
Create an invalid configuration file such as (note
ignored-matches
misspelled):.gitguardian.yml
Execute a
git commit
that includes the secret you wish to ignore (with GGShield configured as a pre-commit hook).Actual result:
Error message:
Note the underscore when the configuration has a hyphen.
Expected result:
Error message:
(hyphen instead of underscore)
The text was updated successfully, but these errors were encountered: