-
Notifications
You must be signed in to change notification settings - Fork 987
Refactor/gitingest structure #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cyclotruc
merged 11 commits into
coderamp-labs:main
from
filipchristiansen:refactor/gitingest-structure
Dec 29, 2024
Merged
Refactor/gitingest structure #66
cyclotruc
merged 11 commits into
coderamp-labs:main
from
filipchristiansen:refactor/gitingest-structure
Dec 29, 2024
Conversation
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
- Add .pre-commit-config.yaml and pyproject.toml for Black and isort - Add missing type hints throughout the code (Dict[...] for Python 3.8 compatibility) - Added badges and convert existing badges to use <a><img></a> format - Lint Markdown files - Lint Jinja templates with djlint
…to resolve installation errors.
…bility, and functionality. - **Introduced the `CloneConfig` dataclass** to encapsulate cloning parameters, including `url`, `local_path`, `commit`, and `branch`. - **Enhanced documentation** by adding detailed docstrings to the functions `check_repo_exists`, `run_git_command`, and `clone_repo`. - **Improved error handling** by refining exception management processes. - **Streamlined repository existence checks** for increased reliability. - **Added the `run_git_command` function** to centralize and simplify the execution of Git commands. - **Refactored code structure** to enhance readability and maintainability. --- - **Replaced manual hexadecimal comparison (`"0123456789abcdefABCDEF"`)** with the `string` module by defining `HEX_DIGITS = set(string.hexdigits)`. - **Revised the construction of the `parsed` dictionary** in the `parse_url` function for clarity. - **Refactored the `parse_patterns` function** to store patterns in a list (`patterns`) instead of repeatedly joining and splitting them. - **Enhanced documentation** by adding docstrings to the `override_ignore_patterns` and `parse_query` functions. - **Removed redundant `pattern.strip()` call** in `normalize_pattern`, as this is now handled within `parse_patterns`. - **Optimized the `override_ignore_patterns` function** by implementing set difference for unordered comparisons. - **Improved the `parse_query` function's structure** for better readability and maintainability. --- - **Refined `print_query`, `print_error`, and `print_success` functions** to accept only the `url` parameter, removing the dependency on the entire `query` object. - **Eliminated the unused `request` argument** from the above functions. - **Integrated the `CloneConfig` dataclass** for improved parameter handling. --- - **Adopted the `CloneConfig` dataclass** for consistent parameter management. --- - **Removed the unused `files` argument** from the `create_summary_string` function to reduce unnecessary complexity. --- - **Simplified the `AsyncTimeoutError` class** by removing a redundant `pass` statement. --- - **Updated tests** to utilize the `CloneConfig` dataclass and align with the newly introduced `run_git_command` function for encapsulated Git command execution. --- - **Aligned comparison with `DEFAULT_IGNORE_PATTERNS`** to use a set difference, ensuring unordered existence comparison.
…bility - **Revised the construction of the parsed dictionary** in the `parse_url` function for clarity. - **Improved the `parse_query` function's structure** for better readability and maintainability.
cyclotruc
reviewed
Dec 28, 2024
cyclotruc
reviewed
Dec 28, 2024
Member
cyclotruc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waaay cleaner than the previous code, thank you 🙏
cyclotruc
approved these changes
Dec 29, 2024
FOLKS-Tech
pushed a commit
to FOLKS-Tech/gitingest
that referenced
this pull request
Sep 5, 2025
Refactor and enhance gitingest module for improved clarity, maintainability, and functionality.
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.
Refactor and enhance gitingest module for improved clarity, maintainability, and functionality.
gitingest/clone.pyCloneConfigdataclass to encapsulate cloning parameters, includingurl,local_path,commit, andbranch.check_repo_exists,run_git_command, andclone_repo.run_git_commandfunction to centralize and simplify the execution of Git commands.gitingest/parse_query.py"0123456789abcdefABCDEF") with thestringmodule by definingHEX_DIGITS = set(string.hexdigits).parse_patternsfunction to store patterns in a list (patterns) instead of repeatedly joining and splitting them.override_ignore_patternsandparse_queryfunctions.pattern.strip()call innormalize_pattern, as this is now handled withinparse_patterns.override_ignore_patternsfunction by implementing set difference for unordered comparisons.parseddictionary in theparse_urlfunction for clarity.parse_queryfunction's structure for better readability and maintainability.process_query.pyprint_query,print_error, andprint_successfunctions to accept only theurlparameter, removing the dependency on the entirequeryobject.requestargument from the above functions.CloneConfigdataclass for improved parameter handling.gitingest/ingest.pyCloneConfigdataclass for consistent parameter management.gitingest/ingest_from_query.pyfilesargument from thecreate_summary_stringfunction to reduce unnecessary complexity.gitingest/utils.pyAsyncTimeoutErrorclass by removing a redundantpassstatement.gitingest/tests/test_clone.pyCloneConfigdataclass and align with the newly introducedrun_git_commandfunction for encapsulated Git command execution.gitingest/tests/test_parse_query.pyDEFAULT_IGNORE_PATTERNSto use a set difference, ensuring unordered existence comparison.