Get Python and Django suggestions right inside your Pull Request or check your entire codebase for tech debt and bugs.
344 | + | from dataclasses import dataclass | |
345 | + | ||
346 | + | @dataclass |
Use frozen=True
to make the dataclasses
immutable and hashable.
347 | + | class FooBarClass: | |
348 | + | pass |
344 | + | class TestFeature(unittest.TestCase): | |
345 | + | def test_feature(self): | |
346 | + | self.assertTrue(value is not None) |
assertIsNone
and assertIsNotNone
provide more helpful failure messages than assertTrue
or assertFalse
.
- | self.assertTrue(value is not None) |
+ | self.assertIsNotNone(value) |
344 | + | class Migration(migrations.Migration): | |
345 | + | dependencies = [("core", "0001_initial.py")] | |
346 | + | operations = [RunPython(forwards)] |
It's good to, as a minimum, specify noop
in RunPython
so the migration can be skipped when going backwards, and even better to specify a function that undoes the migration.
- | operations = [RunPython(forwards)] |
+ | operations = [RunPython(forwards, RunPython.noop)] |
344 | + | values = ( | |
345 | + | 'yes', | |
346 | + | 'correct' |
Missing commas in tuples results in implicit string concatenation. Probably not what you intended to do.
Read more347 | + | 'agreed', | |
348 | + | ) |
We've improved thousands of codebases including
Chrome
PyTorch
Sentry
Tensorflow
Firefox
It caught malformed test assertions that were incorrect. The automated codebase audit tool is so handy!
Jared Lockhart, Senior Software Engineer at MozillaExtremely positive. Suggested useful changes, giving our senior developers time back.
Jon Atkinson, Technical Director at GiantUncovered some bugs in the tests - thanks a lot!
Patrick von Platen, Research Engineer at Hugging FaceSecurity of your code is our top priority. We handle your codebase with care: