From 333c4e18de3e34cc9dd31ec07b72a81c7aca1934 Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 07:56:58 +0000 Subject: [PATCH 1/5] [Penify]: Documentation for commit - 41294a8 --- penify_hook/api_client.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/penify_hook/api_client.py b/penify_hook/api_client.py index 04e500d..7adb1fc 100644 --- a/penify_hook/api_client.py +++ b/penify_hook/api_client.py @@ -75,17 +75,7 @@ def generate_commit_summary(self, git_diff, instruction: str = "", repo_details return None def get_supported_file_types(self) -> list[str]: - """Retrieve the supported file types from the API. - - This function sends a request to the API endpoint - `/v1/file/supported_languages` to obtain a list of supported file types. - If the API call is successful (status code 200), it parses the JSON - response and returns the list of supported file types. If the API call - fails, it returns a default list of common file types. - - Returns: - list[str]: A list of supported file types, either from the API or a default set. - """ + """Retrieve a default list of supported file types.""" return ["py", "js", "ts", "java", "kt", "cs", "c", 'cpp', 'go', 'php', 'tsx','jsx'] def generate_commit_summary_with_llm(self, diff, message, generate_description: bool, repo_details, llm_client : LLMClient, jira_context=None): From 279fe4b109b4cece434201d6389f1a84b987dd83 Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 07:56:58 +0000 Subject: [PATCH 2/5] [Penify]: Documentation for commit - 41294a8 --- penify_hook/commands/auth_commands.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/penify_hook/commands/auth_commands.py b/penify_hook/commands/auth_commands.py index b156b7f..64eadde 100644 --- a/penify_hook/commands/auth_commands.py +++ b/penify_hook/commands/auth_commands.py @@ -10,25 +10,8 @@ def save_credentials(api_key): # Try to save in .env file in git repo first - """Save the API key in a priority-based manner. - - This function attempts to save the API key in two locations, based on priority: - 1. In a `.env` file located in the root of the Git repository if one is found. - 2. In a global `.penify` file located in the user's home directory as a - fallback. The function first tries to locate the Git repository using - `recursive_search_git_folder`. If a Git repository is found, it reads the - existing `.env` file (if present), updates or adds the API key under the key - `PENIFY_API_TOKEN`, and writes the updated content back. If any error occurs - during this process, it falls back to saving the credentials in the global - `.penify` file. The function handles exceptions and prints appropriate error - messages. - - Args: - api_key (str): The API key to save. - - Returns: - bool: True if the API key is saved successfully, False otherwise. - """ + """Save the API key in a `.env` file in the Git repository if found, otherwise in + the global `.penify` file.""" try: from ..utils import recursive_search_git_folder current_dir = os.getcwd() @@ -103,7 +86,7 @@ def login(api_url, dashboard_url): class TokenHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): - """Handle a GET request to process login token and redirect or display error + """Handle a GET request to process login token and display success or error message.""" query = urllib.parse.urlparse(self.path).query query_components = urllib.parse.parse_qs(query) @@ -170,7 +153,7 @@ def do_GET(self): thread.start() def log_message(self, format, *args): # Suppress log messages - """Suppress log messages.""" + """Suppresses log messages.""" return with socketserver.TCPServer(("", redirect_port), TokenHandler) as httpd: From 1a85ce688b539673e9e7e6fcab5b2cea6df98c52 Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 07:56:59 +0000 Subject: [PATCH 3/5] [Penify]: Documentation for commit - 41294a8 --- penify_hook/commands/doc_commands.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/penify_hook/commands/doc_commands.py b/penify_hook/commands/doc_commands.py index 66edc9a..8bc4cf2 100644 --- a/penify_hook/commands/doc_commands.py +++ b/penify_hook/commands/doc_commands.py @@ -6,20 +6,7 @@ import time def generate_doc(api_url, token, location=None): - """Generates documentation based on the given parameters. - - This function initializes an API client using the provided API URL and token. - It then generates documentation by analyzing the specified location, which can - be a folder, a file, or the current working directory if no location is - provided. The function handles different types of analysis based on the input - location and reports any errors encountered during the process. - - Args: - api_url (str): The URL of the API to connect to for documentation generation. - token (str): The authentication token for accessing the API. - location (str?): The path to a specific file or folder to analyze. If not provided, - the current working directory is used. - """ + """Generates documentation using an API client by analyzing a specified location.""" t1 = time.time() from ..api_client import APIClient api_client = APIClient(api_url, token) From 0b7b30e2529378fb757563a1a2bdf1ae2bac513b Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 07:57:00 +0000 Subject: [PATCH 4/5] [Penify]: Documentation for commit - 41294a8 --- penify_hook/commit_analyzer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/penify_hook/commit_analyzer.py b/penify_hook/commit_analyzer.py index 6fe0d04..06a8ccf 100644 --- a/penify_hook/commit_analyzer.py +++ b/penify_hook/commit_analyzer.py @@ -19,7 +19,7 @@ def __init__(self, repo_path: str, api_client: APIClient, llm_client=None, jira_ self.jira_client: JiraClient = jira_client # Add JIRA client as an optional parameter def get_summary(self, instruction: str, generate_description: bool) -> dict: - """Generate a summary for the commit based on the staged changes.""" + """Generate a summary for the commit based on staged changes.""" diff = self.repo.git.diff('--cached') if not diff: raise ValueError("No changes to commit") @@ -113,7 +113,7 @@ def process_jira_integration(self, title: str, description: str, msg: str) -> tu return title, description def _amend_commit(self): - """Open the default git editor to amend the last commit message.""" + """Amend the last commit message in the repository.""" try: # Change to the repository directory os.chdir(self.repo_path) From 3b066063e8b818c640bd3f257db47f35ad3f17d7 Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 07:57:00 +0000 Subject: [PATCH 5/5] [Penify]: Documentation for commit - 41294a8 --- penify_hook/file_analyzer.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/penify_hook/file_analyzer.py b/penify_hook/file_analyzer.py index 363b87d..7a04f86 100644 --- a/penify_hook/file_analyzer.py +++ b/penify_hook/file_analyzer.py @@ -106,13 +106,7 @@ def print_processing(self, file_path): def run(self): # Create a progress bar with appropriate stages - """Runs the documentation process with a progress bar. - - This method orchestrates the documentation process by creating a progress bar, - processing the file, and handling exceptions to ensure the progress bar - completes properly. It updates the progress bar through various stages and - provides feedback based on the result of the file processing. - """ + """Runs the documentation process with a progress bar.""" stages = ["Validating", "Reading content", "Documenting", "Writing changes", "Completed"] pbar, _ = create_stage_progress_bar(stages, f"Starting documenting") logger.debug(f"Processing file: {self.file_path}")