Skip to content

Code refactor to enhance readability and maintainability#2

Open
AlbertoVargasMoreno wants to merge 2 commits intostefanofranco:mainfrom
AlbertoVargasMoreno:main
Open

Code refactor to enhance readability and maintainability#2
AlbertoVargasMoreno wants to merge 2 commits intostefanofranco:mainfrom
AlbertoVargasMoreno:main

Conversation

@AlbertoVargasMoreno
Copy link
Contributor

This pull request includes two refactoring changes to improve the codebase:

  1. Create the params validations function:

    • Replaced returns with exceptions to unify error response handling.
    • Used try-catch blocks to handle and report errors consistently.

    This change moves the validations logic into a modular function

  2. Enhance readability of extractStats function:

    • Implemented early returns to improve the overall readability of the function.
    • Defined queries before execution, making the code more readable and easier to understand.

    These changes make the extractStats function more concise and easier to follow, enhancing the code's overall quality and maintainability.

The goal of these refactoring changes is to improve the codebase's structure, error handling, and readability, making it easier for other developers to understand and work with the code in the future.

- replace returns by exceptions
- use catch to unify error response
- implement early return to improve readibility
- define queries previous to execution, improving readibility of queries
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