netbox-acls
netbox-acls copied to clipboard
Add model tests
Pull Request
Related Issue
Closes #47 Closes #133
New Behavior
- Adds tests to models.
- Addresses a bug found in the AccessList model discovered while adding tests.
Contrast to Current Behavior
No tests for models A bug does not allow hyphens in access-list names
Discussion: Benefits and Drawbacks
...
Changes to the Documentation
...
Proposed Release Note Entry
...
Double Check
- [x] I have explained my PR according to the information in the comments or in a linked issue.
- [x] My PR targets the
dev
branch.
Sourcery Code Quality Report
β Β Merging this PR will increase code quality in the affected files by 0.78%.
Quality metrics | Before | After | Change |
---|---|---|---|
Complexity | 11.01 π | 10.74 π | -0.27 π |
Method Length | 106.73 π | 105.04 π | -1.69 π |
Working memory | 8.86 π | 8.76 π | -0.10 π |
Quality | 57.62% π | 58.40% π | 0.78% π |
Other metrics | Before | After | Change |
---|---|---|---|
Lines | 755 | 768 | 13 |
Changed files | Quality Before | Quality After | Quality Change |
---|---|---|---|
netbox_acls/forms/models.py | 48.09% π | 48.09% π | 0.00% |
netbox_acls/graphql/schema.py | 86.70% β | 86.70% β | 0.00% |
netbox_acls/graphql/types.py | 72.73% π | 72.73% π | 0.00% |
netbox_acls/migrations/0002_alter_accesslist_options_and_more.py | 61.79% π | 61.79% π | 0.00% |
netbox_acls/migrations/0003_netbox_acls.py | 75.10% β | 75.10% β | 0.00% |
netbox_acls/models/access_lists.py | 94.10% β | 90.78% β | -3.32% π |
Here are some functions in these files that still need a tune-up:
File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
---|---|---|---|---|---|---|
netbox_acls/forms/models.py | ACLInterfaceAssignmentForm.clean | 15 π | 282 β | 15 π | 31.91% π | Try splitting into smaller methods. Extract out complex expressions |
netbox_acls/forms/models.py | AccessListForm.clean | 21 π | 236 β | 13 π | 32.23% π | Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions |
netbox_acls/forms/models.py | AccessListForm.__init__ | 27 π | 194 π | 8 π | 40.82% π | Refactor to reduce nesting. Try splitting into smaller methods |
netbox_acls/forms/models.py | ACLExtendedRuleForm.clean | 15 π | 121 π | 6 β | 61.28% π | Try splitting into smaller methods |
Legend and Explanation
The emojis denote the absolute quality of the code:
- β excellent
- π good
- π poor
- β very poor
The π and π indicate whether the quality has improved or gotten worse with this pull request.
Please see our documentation here for details on how these metrics are calculated.
We are actively working on this report - lots more documentation and extra metrics to come!
Help us improve this quality report!
@abhi1693 as discussed, I started pulling out the various fixes from my enormous branch.
This PR will focus on tests for models and any bugs in the model it may uncover.
SonarCloud Quality Gate failed.Β Β
0 Bugs
0 Vulnerabilities
1 Security Hotspot
24 Code Smells
No Coverage information
0.0% Duplication