Skip to content

refactor: resolve too-many-statements, too-many-branches, and too-man… - #1688

Open
brenogonzagacarvalho wants to merge 2 commits into
CamDavidsonPilon:masterfrom
brenogonzagacarvalho:refactor/remove-code-smell-too-many-statements
Open

refactor: resolve too-many-statements, too-many-branches, and too-man…#1688
brenogonzagacarvalho wants to merge 2 commits into
CamDavidsonPilon:masterfrom
brenogonzagacarvalho:refactor/remove-code-smell-too-many-statements

Conversation

@brenogonzagacarvalho

Copy link
Copy Markdown

Context / Contexto

This contribution is part of a project for a Software Maintenance course (Disciplina de Manutenção de Software) at university.


Description

This PR refactors several modules in lifelines to resolve static analysis code smells identified by Pylint:

  • too-many-statements (resolved by extracting sub-routines and helper functions).
  • too-many-branches (resolved by simplifying complex conditional logic flows).
  • too-many-instance-attributes (resolved by utilizing dynamic attribute assignments via setattr to keep public API compatibility).

Results

  • Pylint score increased from 4.18/10 to 5.25/10 (+25.6%).
  • Critical code smells for these three categories were reduced to 0.
  • Maximum cyclomatic complexity in plotting.py was reduced from 30 to 14 (-53.3%).
  • Test coverage remained stable at 85.04% (originally 84.81%) with all 538 tests passing successfully.

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.

1 participant