-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: lint sources #78
feat: lint sources #78
Conversation
woops thought that I opened this PR against my own fork - will move out of draft when I've added the rest of the feature 🙂 |
No problem, sounds good! |
@matthieucan - let me know if you think this is heading in the right direction |
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 looks very good already! 🚀 Just a couple of things we need to think about:
- Filters cannot be applied to sources now
- Code has
model
references almost everywhere (oops 😅, that was me probably), we should change that. E.g.scorer.py
even has methods likescore_model
that will now be applied tosources
as well. - Can we distinguish source and model in the formatters?
- Needs some documentation in
/docs
!
Let me know what you think about it, I am happy to help if needed!
For the human-readable formatter, my thought was to prefix models with Example:
|
I like the idea, keeps it concise! 👍 |
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.
This has become a huge PR with all the renaming and stuff, great effort 🙌 I have played around with the code locally and everything works perfectly! Just left some comments about getting rid of all mentions of model
in the code.
Also, all of the documentation needs to be updated as well, I am happy to assist with this one, please let me know!
Thanks for a thorough review @jochemvandooren ! Will address remaining feedback, update the formatters, and take a first stab at some of the docs shortly! I will definitely take up your offer for support on the docs. |
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.
Incredible work @otosky !
I played a bit with it and it works fine! Very much looking forward to have this 💪
Next week I will help you on the docs and further review the PR, thanks for all the amazing work already 🙌 |
@otosky The code looks perfect! As promised I did a final check and tried to find all occurrences of I also added a |
Thank you @jochemvandooren! Fixed the line lengths in a2c0924 and made some tweaks to the changelog in f88aa7c. One final Q: I made use of two functions from more-itertools - first and first_true. |
Ah, good point! If it can be prevented easily, I'd like to keep the number of dependencies low. But I can imagine having to rewrite the function is a hassle, I will leave it up to you! |
I went the vendoring route, since it's really just the function |
I believe |
🤦 totally right - just pushed it up! |
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.
Amazing 🤩 , just needs a rebase on master!
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.
Minor nitpicks.
Incredible work @otosky, I'm really keen to start using this feature. Thanks a lot! 💪
Co-authored-by: Matthieu Caneill <[email protected]>
manifest["nodes"][model_id]["meta"]["score"] = model_score.value | ||
manifest["nodes"][model_id]["meta"]["badge"] = model_score.badge | ||
for evaluable_id, evaluable_score in self._evaluable_scores.items(): | ||
manifest["nodes"][evaluable_id]["meta"]["score"] = evaluable_score.value |
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.
Noticing after taking another pass at the diff that sources need to be pushed into manifest["sources"]
instead of manifest["nodes"]
. Let me fix that quickly.
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.
Oh good one, we should have a test for that
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.
updated in cc6b707
It seems |
@jochemvandooren I'll take an initial stab at it! |
There are still a bunch of Liskov violations being raised from mypy that I'm not entirely sure how to fix without having to introduce Generics into the API.
Is there any other workaround besides adding an ignore here? This essentially means that mypy will fail for any downstream users if they use the class-based workflow while developing their rules. |
I also spent some time looking into this, and there's no easy solution indeed 😞 Considering this will only affect the class-based rules, I suggest we add an ignore for now. I am aware it will introduce the warnings downstream, which isn't ideal. To solve this in a nice way, we might need to restructure some things if we want to keep the API as is, so we might consider this in a follow-up PR. What do you think? I think it's the most pragmatic option! |
makes sense to me @jochemvandooren! - updated in 0732e15 |
Well done @otosky! Great contribution 🙌 |
Also it's available in version |
Overview
Extends rules so that they can be used to against dbt sources in addition to models.
Usage
A rule defines what resource-type it acts against in the type signature of the function it wraps or in a class-based
evaluate
method:The
Evaluation
handler is then responsible for applying source-rules to Source objects and model-rules to Model objects.closes #76