-
Notifications
You must be signed in to change notification settings - Fork 15
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
Make it possible to also check if token values are from expected pool #141
Conversation
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.
@jhutar thanks for working on this. Looks good overall.
But one issue I have is that this new method is quite similar to already existing validate_docstring_report
. It seems to duplicate some code, too. I wonder if we could incorporate changes into validate_docstring_report
instead of creating whole new command. What do you think?
If you don't want to work on this PR anymore, I can take your commits and submit new PR with this change. But I would like to get your opinion first.
Other than that, there are also some variable names not exactly to my liking, but I'll leave them up to @elyezer to decide.
tests/test_testimony.sh
Outdated
echo "= validate_values report =" | ||
echo "==========================" | ||
echo | ||
testimony -n --tokens="Status,Feature" --minimum-tokens="Status,Feature" --token-values=tests/validate-values.yaml validate-values tests |
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.
As a next step it would be great to have a yaml config file for entire testimony. So the tokens, minimum tokens and the validation rules could live on a single place.
Thank you for bringing the initial version of this
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.
It @Mirzal agrees here (and whoever else could be considered a stakeholder for testimony), we can create a issue and I can ask one or our interns to work on it.
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.
Sounds good. I can create the issue if you want.
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.
Regarding "roadmap" for Testimony, I would put following things:
- full implementation of Improve Testimony token validation #121 (add support for
type
like unique, int, ranges etc.) config.py:TokenConfig
begs for factory pattern (each type should have their own subclass, with customvalidate
implementation)- printing reports (
__init__.py
lines 419 to 472) is a mess. Probably each check should be their own method, and we should just run them in a loop.
I believe these to be nice examples for CS students who would like to try out some design patterns and cleaning up code, but, honestly, I would consider them very low on Satellite priorities list. @jhutar do you think this is something we can assign to interns, or could be better use their help elsewhere?
@Mirzal Ad "incorporate values validation into |
I prefer to run all checks at once. There are couple of reasons:
---
CaseImportance:
required: true
CaseAutomation:
Component:
required: true If you also want to check if correct values are provided, then you may use config file like this: ---
CaseImportance:
required: true
type: choice
choices:
- Critical
- High
- Medium
- Low
CaseAutomation:
Component:
required: true If you want to do atomic checks, you only need to keep bunch of config files around. If you want to have all checks done in single pass, you dump everything in single config file.
I am happy to take this PR over from here and working on this further. You did a great deal of very valuable work already. |
@Mirzal OK, thank you! I consider it done from my point of view then. |
I agree with @Mirzal about having a single command to validate. I kinda see Testimony as a linter for docstrings, that said usually the linters will check everything with a single command. For testimony that command would be the |
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 this needs a couple more changes and then we should be fine to merge. Can you please update?
Also about having a single command to validate everything like @Mirzal said. Maybe worth improving the validate command to report on the values and avoid adding a new command that may go away in the future.
Edit: I meant to request the changes here but I am also approving that it is really close to be able to merge.
token, testcase.tokens[token]) | ||
) | ||
invalid_token_value_count += 1 | ||
if missing_token_count_local > 0: |
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.
What about instead of counting creating a list of missing tokens so the message could provide which tokens are missing?
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 believe this is done in #142 :
ConfigurationFileTestCase::test_multiple_invalid_keys:202
---------------------------------------------------------
* Tokens with invalid values:
Caseimportance: Lowest (type: 'choice')
Status: Invalid (type: 'choice')
If I misunderstood, please let me know in other PR.
@elyezer I will take these changes, update it according to your latest review and incorporate other changes that we discussed earlier (i.e. let's do everything as part of So, let's not merge this yet. We can close this once new PR is submitted. |
@Mirzal sounds good. Please let me know if you need any help and thank you very much for handling it. |
Closing, as these changes were merged as part of #142 . |
No description provided.