Skip to content

Conversation

sei-aderr
Copy link
Contributor

@sei-aderr sei-aderr commented Sep 11, 2025

Refactor of parse_diffoscope_json function. Mainly followed the suggestions from Sebastian from a while ago that I saved in the issue

  • Made the functionality be contained within a class
  • Made a _check_flags function, and made each separate check into its own function
  • Made the recursion a separate function
  • Moved all handling of recursive iteration into the recursion function
  • Renamed _process_and_save_results to _process_and_write_results
  • Renamed is_path to is_abs_path and added tests
  • Removed no longer used parent_source parameters and class variables from Diff

Would appreciate a quick review of how it looks now, to see if there are other changes that should be made before I write unit tests for each sub function if they were to change.

Copy link
Contributor

@sei-secheverria sei-secheverria left a comment

Choose a reason for hiding this comment

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

Very good improvements, several comments below

@sei-aderr
Copy link
Contributor Author

Consider renaming plus_line and minus_line variables and any other references to them.

@sei-aderr
Copy link
Contributor Author

Ready for another review. Lihan fixed the other tests in test_diff_command which will be pushed shortly. Once these pieces look good I will flesh out the unit tests for the new code.

@sei-lzhan
Copy link
Contributor

diff_command unit test fixed, ready for review

Copy link
Contributor

@sei-secheverria sei-secheverria left a comment

Choose a reason for hiding this comment

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

Looks good, a couple of very minor points

Copy link
Contributor

@sei-kpitstick sei-kpitstick left a comment

Choose a reason for hiding this comment

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

Tested, results line up.

@sei-kpitstick sei-kpitstick merged commit c2ce6ea into main Sep 22, 2025
2 checks passed
@sei-kpitstick sei-kpitstick deleted the refactor/parse-diffoscope branch September 22, 2025 17:32
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.

4 participants