Skip to content

refactor: reduce contour function complexity - functions exceed 50-line target #403

@krystophny

Description

@krystophny

Problem

Functions in fortplot_matplotlib.f90 exceed the 50-line target for maintainability:

  • contour_filled() (lines 86-150): 65 lines
  • add_contour_filled() (lines 441-505): 65 lines

Root Cause

The conditional parameter forwarding logic introduced in PR #402 creates extensive if/else chains to handle 16 possible parameter combinations safely.

Solution Options

  1. Extract parameter forwarding logic to helper subroutine
  2. Create parameter struct/type to reduce combinations
  3. Use polymorphic interfaces to reduce branching

Impact

  • Code maintainability affected by repetitive conditional chains
  • Functions exceed QADS 50-line target (but within 100-line hard limit)
  • Logic is correct but verbose

Priority

MINOR - Functions work correctly, refactoring improves maintainability only

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions