Skip to content

Conversation

Hell1213
Copy link

Description

This PR improvess the pylint score for the accounts module as part of issue #4557.

#=> Changes Made

  • Fix __str__ method in UserStatus model to return str(self.name) instead of self.name
  • Rename conflicting admin classes to avoid redefinition errors:
    • UserAdmin -> CustomUserAdmin
    • TokenAdmin -> CustomTokenAdmin
    • EmailAddressAdmin -> CustomEmailAddressAdmin
  • Replace old-style string formatting with f-strings in views.py
  • Fix typo: recieve_newsletter -> receive_newsletter
  • Improve search fields in ProfileAdmin

#=> Pylint Score Improvements

  • Accounts module: Improved from ~8.17 to 9.58/10
  • Overall pylint score: Improved to 8.20/10 (above target of 7.5)

#=> Testing

  • All models import successfully
  • No error-level pylint issues remaining
  • Local testing passed

Fixes #4557

- Fix __str__ method in UserStatus modell to return str(self.name) instead of self.name
- Rename conflicting admin classes to avoid redefinition errors:
  - UserAdmin -> CustomUserAdmin
  - TokenAdmin -> CustomTokenAdmin
  - EmailAddressAdmin -> CustomEmailAddressAdmin
- Replace old-style string formatting with f-strings in views.py
- Fix typo: recieve_newsletter -> receive_newsletter
- Improve search fields in ProfileAdmin

Pylint score improved from ~8.17 to 9.58/10 for accounts module.
Overall pylint score improved to 8.20/10 (above target of 7.5).

Fixes Cloud-CV#4557
- Revert admin field name from 'receive_newsletter' to 'recieve_newsletter'
- This matches the actual field name in the Profile model
- Fixes Django system check errors that were causing CI to fail

The field name in the model still has the typo, but changing it would require
a database migration. For now, keeping the admin consistent with the model.
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (e9e38e9) to head (e5255a4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4792   +/-   ##
=======================================
  Coverage   91.87%   91.87%           
=======================================
  Files          85       85           
  Lines        7105     7105           
=======================================
  Hits         6528     6528           
  Misses        577      577           
Flag Coverage Δ
backend 96.66% <100.00%> (ø)
frontend 87.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Accounts & Authentication 100.00% <100.00%> (ø)
Challenges Management 95.34% <ø> (ø)
Job Processing 98.19% <ø> (ø)
Participants & Teams 100.00% <ø> (ø)
Challenge Hosts 100.00% <ø> (ø)
Analytics 100.00% <ø> (ø)
Web Interface 100.00% <ø> (ø)
Frontend (Gulp) 87.14% <ø> (ø)
All Models 97.58% <100.00%> (ø)
All Views 100.00% <ø> (ø)
All Serializers 98.82% <ø> (ø)
Utility Functions 96.79% <ø> (ø)
Core Configuration 82.35% <ø> (ø)
Files with missing lines Coverage Δ
apps/accounts/admin.py 100.00% <100.00%> (ø)
apps/accounts/models.py 100.00% <100.00%> (ø)
Files with missing lines Coverage Δ
apps/accounts/admin.py 100.00% <100.00%> (ø)
apps/accounts/models.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9e38e9...e5255a4. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase Pylint Score for the current codebase
1 participant