Skip to content

Conversation

@jqnatividad
Copy link
Collaborator

first pass of adding weighted frequencies resulted in a lot of duplicate code.

first pass of adding weighted frequencies resulted in a lot of duplicate code.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the frequency command to reduce code duplication that was introduced when the --weight option was added. The refactoring extracts common logic into reusable helper functions while maintaining the same behavior for both weighted and unweighted frequency calculations.

  • Extracted ranking strategy application logic into separate functions for weighted and unweighted cases
  • Extracted limit application logic into dedicated helper functions
  • Consolidated JSON output field building into a reusable closure
  • Created helper functions for grouping values by count/weight

jqnatividad and others added 3 commits December 27, 2025 09:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 8 comments.

jqnatividad and others added 8 commits December 27, 2025 10:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…stion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ount

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…smith docstrings; apply GH Copilot recommendation
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

jqnatividad and others added 5 commits December 27, 2025 10:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jqnatividad jqnatividad merged commit 593ef6e into master Dec 27, 2025
@jqnatividad jqnatividad deleted the frequency-refactor-reduce-duplication branch December 27, 2025 15:36
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.

2 participants