B903 reword message when a subclass is involved
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 123
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
The current B903 message reads:
B903 Data class should either be immutable or use slots to save memory. Use collections.namedtuple to generate an immutable class, or enumerate the attributes in a slot declaration in the class to leave attributes mutable.
However, this lint message is not totally correct if the data class in question inherits from another class; e.g., Exception; in this case, use of namedtuple is inappropriate (actually, I'm not sure if there's any other way to do it.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the B903 implementation and any tests covering its diagnostic message. Start by tracing where the message is defined and how subclass cases are handled. Reword the diagnostic so it does not recommend namedtuple when the data class inherits from another class, then run the relevant tests to confirm the updated wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100