Skip to content

Commit 5c49b1c

Browse files
authored
feat: classify the checks (#9)
* update readme * update readme * fix: improved readme * fix: re-orinted the structure
1 parent a6c769a commit 5c49b1c

File tree

2 files changed

+55
-7
lines changed

2 files changed

+55
-7
lines changed

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,34 @@ class Product(models.Model):
4242
price = models.DecimalField(max_digits=10, decimal_places=2) # No MinValueValidator or MaxValueValidator!
4343
```
4444

45-
Django Model Field Checks is your secret weapon for creating robust, efficient, and consistent Django applications. By catching potential issues early and providing actionable recommendations, this library empowers you to build high-quality projects that stand the test of time.
45+
The tool is designed to help developers identify and prevent potential issues in their Django models. We have classified the checks implemented in the tool according to the types of issues they can catch: data loss, data corruption, data inconsistency, and other. Understanding these categories will help developers better address the issues detected by the tool and improve the overall quality and integrity of their Django applications.
4646

47-
Are you ready to take your Django projects to the next level? Start using Django Model Field Checks today and unlock the full potential of your models!
47+
## Data Loss
48+
49+
- **ReverseCascade**: Ensures that a ForeignKey or OneToOneField is not set to CASCADE delete and allows null values, preventing unintended data loss when related records are deleted.
50+
- **CascadeForFKOneToOne**: Checks if a ForeignKey or OneToOneField uses CASCADE delete and does not allow null values, preventing unintended data loss when related records are deleted.
51+
- **InappropriateCascade**: Verifies that CASCADE is not being used inappropriately on ForeignKey fields, preventing unintended data loss when related records are deleted.
52+
53+
## Data Corruption
54+
55+
- **MissingDefault**: Ensures that fields with null=False have a default value specified to avoid potential data corruption.
56+
- **UniqueWithoutIndex**: Verifies that unique constraints are created with indexes to prevent data corruption due to slow queries.
57+
58+
## Data Inconsistency
59+
60+
- **MinMaxValidator**: Checks if MinValueValidator and MaxValueValidator are applied to numeric fields, ensuring data consistency and preventing out-of-range values.
61+
- **ExcessiveNulls**: Ensures that fields are not unnecessarily set to allow null values, preventing data inconsistency.
62+
- **NullableUniqueFields**: Checks if unique fields are set to allow null values, preventing data inconsistency.
63+
- **UnboundedAutoIncrementPK**: Verifies that models with auto-incrementing primary keys have a maximum value set, preventing data inconsistency due to running out of primary key values.
64+
- **CascadeOnForeignKey**: Ensures that ForeignKey fields have appropriate on_delete behavior to maintain data consistency.
65+
- **LargeCharField**: Verifies that CharField maximum lengths are set to reasonable values to maintain data consistency.
66+
- **ExcessiveBlanks**: Ensures that fields are not unnecessarily set to allow blank values, preventing data inconsistency.
67+
68+
## Other
69+
70+
- **ReservedSQLKeywords**: Verifies that model and field names do not use reserved SQL keywords, preventing potential naming conflicts and issues.
71+
- **ForeignKeyNaming**: Ensures that the naming convention for ForeignKey fields follows the format: "{related_model_name.lower()}\_id".
72+
- **MissingHelpText**: Checks if fields have help_text specified, improving user experience and reducing confusion.
4873

4974
# Installation and Usage
5075

altimate_django/docs/index.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,34 @@
22

33
# Welcome to Altimate Django Library
44

5-
Altimate Django is a powerful library designed to help you maintain consistent data and prevent common issues in your Django projects. By analyzing your models' fields, this library identifies potential data inconsistencies, performance issues, and other pitfalls that could negatively impact your application.
5+
Altimate Django is a powerful library designed to help you maintain consistent data and prevent common issues in your Django projects. By analyzing your models' fields, this library identifies potential data inconsistencies, performance issues, and other pitfalls that could negatively impact your application. The tool is designed to help developers identify and prevent potential issues in their Django models. We have classified the checks implemented in the tool according to the types of issues they can catch: data loss, data corruption, data inconsistency, and other. Understanding these categories will help developers better address the issues detected by the tool and improve the overall quality and integrity of their Django applications.
6+
7+
## Data Loss
8+
9+
- **ReverseCascade**: Ensures that a ForeignKey or OneToOneField is not set to CASCADE delete and allows null values, preventing unintended data loss when related records are deleted.
10+
- **CascadeForFKOneToOne**: Checks if a ForeignKey or OneToOneField uses CASCADE delete and does not allow null values, preventing unintended data loss when related records are deleted.
11+
- **InappropriateCascade**: Verifies that CASCADE is not being used inappropriately on ForeignKey fields, preventing unintended data loss when related records are deleted.
12+
13+
## Data Corruption
14+
15+
- **MissingDefault**: Ensures that fields with null=False have a default value specified to avoid potential data corruption.
16+
- **UniqueWithoutIndex**: Verifies that unique constraints are created with indexes to prevent data corruption due to slow queries.
17+
18+
## Data Inconsistency
19+
20+
- **MinMaxValidator**: Checks if MinValueValidator and MaxValueValidator are applied to numeric fields, ensuring data consistency and preventing out-of-range values.
21+
- **ExcessiveNulls**: Ensures that fields are not unnecessarily set to allow null values, preventing data inconsistency.
22+
- **NullableUniqueFields**: Checks if unique fields are set to allow null values, preventing data inconsistency.
23+
- **UnboundedAutoIncrementPK**: Verifies that models with auto-incrementing primary keys have a maximum value set, preventing data inconsistency due to running out of primary key values.
24+
- **CascadeOnForeignKey**: Ensures that ForeignKey fields have appropriate on_delete behavior to maintain data consistency.
25+
- **LargeCharField**: Verifies that CharField maximum lengths are set to reasonable values to maintain data consistency.
26+
- **ExcessiveBlanks**: Ensures that fields are not unnecessarily set to allow blank values, preventing data inconsistency.
27+
28+
## Other
29+
30+
- **ReservedSQLKeywords**: Verifies that model and field names do not use reserved SQL keywords, preventing potential naming conflicts and issues.
31+
- **ForeignKeyNaming**: Ensures that the naming convention for ForeignKey fields follows the format: "{related_model_name.lower()}\_id".
32+
- **MissingHelpText**: Checks if fields have help_text specified, improving user experience and reducing confusion.
633

734
## Real-life Examples
835

@@ -41,7 +68,3 @@ from django.db import models
4168
class Product(models.Model):
4269
price = models.DecimalField(max_digits=10, decimal_places=2) # No MinValueValidator or MaxValueValidator!
4370
```
44-
45-
Django Model Field Checks is your secret weapon for creating robust, efficient, and consistent Django applications. By catching potential issues early and providing actionable recommendations, this library empowers you to build high-quality projects that stand the test of time.
46-
47-
Are you ready to take your Django projects to the next level? Start using Django Model Field Checks today and unlock the full potential of your models!

0 commit comments

Comments
 (0)