Show HN: A Django code review bot for GitHub pull requests
django.doctor
django.doctor
It's also open source and self-hostable for folks who like the idea but don't trust that automation to a third party.
edit: Or even a paid alternative as those at least seem to have a business model.
- finds Django anti patterns. pretty sweet.
- suggests the fix in the PR. One click fix? yes pls.
- Check your entire codebase in seconds via https://django.doctor with no need to install or sign up for anything? hell yeah.
- has a fox as a mascot
Which is a pretty standard arrangement for SaaS dev tools that I think makes it pretty clear your data isn't the business model. What I like about that model it is a reasonable balance of customers actually paying for the thing they use (so the business owner isn't beholden to advertising or tempted to abuse data access), and supporting the open source community (without which most of the modern web couldn't exist). I won't say it's entirely without risk - you need enough paid use to cover the costs of the open source use. But I think it's an ethical and sustainable approach if you can achieve that.
And, again, restyled is open source - if you don't trust the owner, you can run it yourself.
btw, we dont actually have any of the user's data. We literally do not have a user database. All we have is a link to a public repo. It currently works only on public repos. So no danger of Django Doctor doing anything odd with your code because the code is already public. No risk of Django Doctor doing anything strange with your personal data because we don't have any :)
When I worked on solo projects, sanity checks like these would be very helpful since you don’t have a teammate to help spot “brain fart” situations.
The only reason you'd release a tool like this as a github integration and not an open source library (optionally with a CLI tool) is that you want to get money from it - nothing wrong with that, but that is very much an either/or question.
With the advantage that if the dev likes the advice, all they need to do is click "commit"
But yes, SaaS is not a silver bullet. If you like convenience and getting updates, bug fixes, and quick set up with no overhead then it's for you. If you want to run things yourself then understandable have a great day :)
Sure, configuration management is hard, it doesn't mean you don't have to do it. If anything, in an organization that big, you should have someone creating a process for managing dependency upgrades. There will always be critical security vulnerabilities and other use cases for package upgrades that need to be patched across all of your repos.
The suggestion that you don't have to do it for this particular feature is kicking the can down the road.
I see manually updating libraries as a feature that allows for deterministic linting.
I wouldn't want my linter to always be updated to the latest version because that might introduce warnings or deprecation errors that aren't warnings or errors in the version of the tools used in the code I'm linting.
Most linters also don't require manual changes but do automatic fixing, ie: black[0].
Non-user initiated updates to QA tools will only lead to alert fatigue because people will write it off as an update to to tool.
Similarly they way Django Doctor works is more convenient:
- it's suggests a change that can be applied in one click - it's suggestion can be ignored - no overhead cost because it's SaaS
but yes, if you don't value SaaS in this context then that's fair enough :)
That said, if you live in Github and other SaaS services this fits really well. In the past I've setup similar workflow to cater to people who never dared to touch a terminal or Git itself. So there is certainly enablement this tool brings to some people.
What will Django Doctor say about your code? Check now for free at https://django.doctor
If you dig this then you may like to install the bot on your GitHub pull requests
The closest to existing tools are: https://github.com/lamby/django-lint/ https://github.com/PyCQA/pylint-django
but- you have to set those up yourself in a CI and update them manually and not have the cool feature like PR integration, "fix it for me" (you would have to fix it yourself like a barbarian), the slick companion website with the beautiful blue progress bar :)
With Django Doctor you just click "install on GitHub" and boom, you get updates at no effort, and if you like the suggestion Django Doctor makes you just click commit
> Avoid using null on string-based fields such as CharField and TextField. If a string-based field has null=True, that means it has two possible values for “no data”: NULL, and the empty string. In most cases, it’s redundant to have two possible values for “no data;” the Django convention is to use the empty string, not NULL. One exception is when a CharField has both unique=True and blank=True set. In this situation, null=True is required to avoid unique constraint violations when saving multiple objects with blank values.
[0] https://docs.djangoproject.com/en/3.1/ref/models/fields/#nul...
From chatting to folks, most applications just YOLO this, and accept downtime on every such DB operation; you might not even notice that this is happening at first because you'd need to have a create _during_ your DB migration. It'll bite you sooner or later though. I'm sure for many apps a client-side retry is totally acceptable, assuming it's safe to do so.
because while Django Doctor suggests potential improvements, I acknowledge they're not guaranteed to be correct according to the context
The idea that empty string and none are equivalent is distasteful.
Nobody makes this argument for int fields right? "Just use 0"?
I hate having different conventions for different field types and losing a potentially meaningful distinction between empty string and 0.
The idea seems to be born out of truthy & falsey values. (A big source of gotchas and bugs in my experience)
I'd say it's the role of django forms to clean data into a normalized form. So converting null to empty string there might make sense.
Soon we will be adding a config file so you can mute the things that ar vexatious
Also suggested reordering of methods within the class, which could be a nice convention to follow for large projects.
Sort of an extra checking step to my CI.
It's a github app, rather than an action. Actions still require you to update a yaml file to use.
Regarding CI: I don't think Django Doctor should block or fail builds. Django Doctor looks suggests improvements, but it's up to the dev to decide to commit them. Plus, no bot should be commiting changes without dev approval. Hello Skynet!
For example, I have a project where I pass back CI info to a slack channel so the dev can look at things easy and go to relevant links based on the notification.
If I was committing a feature branch and DD had a suggestion it would be fine to know at time of commit.
I agree it shouldn’t make it commit changes in this workflow, though. Just point them out.
In summary: - we dont' collect ANY personal data because we don't need ay. we don't even have a database, We can't misuse your persona data if we don't have it!
- we don't create any non-essential cookies on browser
- your code is deleted as soon as it's checked
- the servers are hosted in USA/London