Skip to content

[Technical Debt]: Refactor duplicated code in Controllers and Models #4490

Open

Description

@coderabbitai

Overview

Deal with duplicated code fragments across the codebase. In many cases, duplicated logic should be extracted into a shared function. Several Controller and Model functions are also too large and should be broken down.

Background

This was identified as a follow-up task from PR #4485 (Update to CodeIgniter 4.7.2).

Tasks

  • Identify all duplicated code fragments across Controllers and Models
  • Extract repeated logic into reusable functions/methods
  • Refactor overly large Controller and Model functions into smaller, more focused units
  • Ensure all refactored code is covered by tests

References

Activity

  1. added a commit that references this issue on Apr 15, 2026
    62236ae
  2. changed the title [-]Refactor duplicated code fragments in Controllers and Models[/-] [+][Technical Debt]: Refactor duplicated code in Controllers and Models[/+] on Apr 20, 2026
  3. objecttothis commented on Oct 26, 2026

    @objecttothis
    Member

    Claude Issue Checker Agent (cc @objecttothis)

    Investigated against current master.

    Status: Still present (fix not yet merged).

    There is an open PR addressing this directly: #4505 "refactor: Extract duplicated code into reusable components" (closes #4490), which adds app/Traits/Controller/Shared.php, app/Traits/Models/Reports/ReportDateFilter.php, app/Traits/Models/Reports/SaleTypeFilter.php, and app/Traits/Database/SalesTaxMigration.php, removing 39 TODO: Duplicated code comments across 19 files. However, as of this check PR #4505 is still open/unmerged (merged: false), so none of those traits or refactors exist on master yet — the duplicated code and TODO: Duplicated code markers this issue describes remain in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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