Refactor code and add tests#21
Open
bawahakim wants to merge 38 commits intoThe-Commit-Company:mainfrom
Open
Conversation
…running during setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Realized the package did not have tests, so wanted to take a stab at it. This brought me down a long rabbit hole of refactoring. Hope you don't mind! I did use a bit of LLM for the refactoring, comments and boilerplate
This PR should not bring any breaking changes, as I left the original public functions that were used (either whitelist, commands, or hooks) and wrapped it with the new
TypeGeneratorclassAdded github workflow to run the tests. I also added default linter from bench and linted the package
Note: I needed to add a new global
include_custom_doctypes, otherwise it would create a test doctype in code and made cleanup a bit messy. It defaults to false to avoid breaking changes. Similarly addedbase_output_pathbut as a hidden field, which defaults to../apps, which was necessary to keep tests clean and output generation to/tmp, also non breaking.Questions:
create_type_definition_fileseems to be called on doctype update. Would it make sense to rename itupdate_type_definition_file? I did so in the new classcreate_type_definition_filehas a few differences from the generate method:Is there a reason to have this only in this method and not the generator methods?