patched-codes / patchwork

Automate development gruntwork like code reviews, patching and documentation with LLM workflows.
https://patched.codes
GNU Affero General Public License v3.0
813 stars 47 forks source link

Patchflow builder #602

Closed CTY-git closed 3 weeks ago

patched-codes[bot] commented 3 weeks ago
## File Changed: `patchwork/steps/JoinListPB/JoinListPB.py` Details: Use raw characters instead of HTML escape characters in string literals. Affected Code Snippet: ```python "list": [item.get(self.key) for item in self.list if item.get(self.key) is not None], ``` Start Line: 18 End Line: 18 ## File Changed: `patchwork/steps/ModifyCodePB/ModifyCodePB.py` Details: The code uses clear and descriptive naming conventions. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ------------- Details: The code uses class inheritance for organizing related components. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ------------- Details: Type annotations are used for improved code clarity. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ------------- Details: Type hints are used for function parameters and return values. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ------------- Details: The code uses consistent double quotes for dictionary keys. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ------------- Details: The code uses raw characters instead of HTML escape characters in string literals. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ------------- ## File Changed: `patchwork/steps/PRPB/PRPB.py` Details: Use consistent quotes for dictionary keys (single or double). Affected Code Snippet: ```python key_map = dict(path=inputs["path_key"]) if inputs.get("title_key") is not None: key_map["commit_message"] = inputs["comment_title_key"] if inputs.get("message_key") is not None: key_map["patch_message"] = inputs["comment_message_key"] ``` Start Line: 9 End Line: 13 ------------- Details: Use type annotations for improved code clarity. Affected Code Snippet: ```python def __init__(self, inputs): super().__init__(inputs) key_map = dict(path=inputs["path_key"]) ``` Start Line: 7 End Line: 9 ------------- Details: Use type hints for function parameters and return values. Affected Code Snippet: ```python def run(self): pr = PR({**self.inputs, "modified_code_files": self.modified_files}) pr_outputs = pr.run() return pr_outputs ``` Start Line: 21 End Line: 25 ## File Changed: `patchwork/steps/PRPB/typed.py` Details: HTML escape character used instead of raw character Affected Code Snippet: ```python class __PRPBInputsRequired(TypedDict): # CommitChangesInputs & PreparePRInputs modified_files: List[Dict] path_key: str ``` Start Line: 7 End Line: 11 ## File Changed: `patchwork/steps/SimplifiedLLMOncePB/SimplifiedLLMOncePB.py` Details: The function name `__json_schema_as_suffix` violates the snake_case naming convention. Affected Code Snippet: ```python def __json_schema_as_suffix(self, prompt: str): return f"""\ {prompt} Respond with the following json format but minified: {json.dumps(self.json_schema, indent=2)} """ ``` Start Line: 19 End Line: 24 ------------- Details: The file is missing docstrings for the class and methods. Affected Code Snippet: ```python class SimplifiedLLMOncePB(Step, input_class=SimplifiedLLMOncePBInputs): def __init__(self, inputs): super().__init__(inputs) self.user = inputs["prompt_user"] self.system = inputs.get("prompt_system") self.prompt_value = inputs["prompt_value"] self.json_schema = inputs["json_schema"] self.inputs = inputs def __json_schema_as_suffix(self, prompt: str): return f"""\ {prompt} Respond with the following json format but minified: {json.dumps(self.json_schema, indent=2)} """ def run(self) -> dict: if self.system is not None: prompt_dict = dict( prompt_system=self.__json_schema_as_suffix(self.system), prompt_user=self.user, ) else: prompt_dict = dict( prompt_user=self.__json_schema_as_suffix(self.user), ) llm = SimplifiedLLM( { **self.inputs, **prompt_dict, "prompt_values": [self.prompt_value], "json": True, } ) llm_output = llm.run() return dict( **llm_output.get("extracted_responses")[0], ) ``` Start Line: 9 End Line: 49 ------------- Details: The code is missing type hints for function parameters and return values. Affected Code Snippet: ```python def __init__(self, inputs): super().__init__(inputs) self.user = inputs["prompt_user"] self.system = inputs.get("prompt_system") self.prompt_value = inputs["prompt_value"] self.json_schema = inputs["json_schema"] self.inputs = inputs ``` Start Line: 10 End Line: 17 ------------- Details: The code uses f-strings with potentially untrusted user input. Affected Code Snippet: ```python def __json_schema_as_suffix(self, prompt: str): return f"""\ {prompt} Respond with the following json format but minified: {json.dumps(self.json_schema, indent=2)} """ ``` Start Line: 19 End Line: 24 ## File Changed: `patchwork/steps/__init__.py` Details: The code follows the rule by importing new modules and updating the __all__ list. Affected Code Snippet: N/A Start Line: N/A End Line: N/A ## File Changed: `pyproject.toml` Details: The version number follows the correct development version convention. Affected Code Snippet: ```toml version = "0.0.49.dev6" ``` Start Line: 3 End Line: 3 ------------- Details: The dependency versions use semantic versioning and are up-to-date. Affected Code Snippet: ```toml pydantic = "~2.8.2" ``` Start Line: 34 End Line: 34