From f0e05f4dad318e29fe9a85cde9e6f4f434fd597c Mon Sep 17 00:00:00 2001 From: nigel brown Date: Tue, 4 Mar 2025 11:26:10 +0000 Subject: [PATCH 1/3] Disable suspicious commands for now This is not quite the right place for the code check to go. Signed-off-by: nigel brown --- src/codegate/pipeline/comment/output.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/codegate/pipeline/comment/output.py b/src/codegate/pipeline/comment/output.py index 4583a659..56b57f70 100644 --- a/src/codegate/pipeline/comment/output.py +++ b/src/codegate/pipeline/comment/output.py @@ -12,7 +12,7 @@ ) from codegate.pipeline.base import PipelineContext from codegate.pipeline.output import OutputPipelineContext, OutputPipelineStep -from codegate.pipeline.suspicious_commands.suspicious_commands import check_suspicious_code +# from codegate.pipeline.suspicious_commands.suspicious_commands import check_suspicious_code from codegate.storage import StorageEngine from codegate.utils.package_extractor import PackageExtractor @@ -52,15 +52,15 @@ async def _snippet_comment(self, snippet: CodeSnippet, context: PipelineContext) """Create a comment for a snippet""" comment = "" - if ( - snippet.filepath is None - and snippet.file_extension is None - and "filepath" not in snippet.code - and "existing code" not in snippet.code - ): - new_comment, is_suspicious = await check_suspicious_code(snippet.code, snippet.language) - if is_suspicious: - comment += new_comment + # if ( + # snippet.filepath is None + # and snippet.file_extension is None + # and "filepath" not in snippet.code + # and "existing code" not in snippet.code + # ): + # new_comment, is_suspicious = await check_suspicious_code(snippet.code, snippet.language) + # if is_suspicious: + # comment += new_comment snippet.libraries = PackageExtractor.extract_packages(snippet.code, snippet.language) From 98f3b1a65f428b369e513b3870512997a7e4d2a9 Mon Sep 17 00:00:00 2001 From: nigel brown Date: Tue, 4 Mar 2025 11:30:32 +0000 Subject: [PATCH 2/3] Make black happy Signed-off-by: nigel brown --- src/codegate/pipeline/comment/output.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/codegate/pipeline/comment/output.py b/src/codegate/pipeline/comment/output.py index 56b57f70..654b99a3 100644 --- a/src/codegate/pipeline/comment/output.py +++ b/src/codegate/pipeline/comment/output.py @@ -12,7 +12,6 @@ ) from codegate.pipeline.base import PipelineContext from codegate.pipeline.output import OutputPipelineContext, OutputPipelineStep -# from codegate.pipeline.suspicious_commands.suspicious_commands import check_suspicious_code from codegate.storage import StorageEngine from codegate.utils.package_extractor import PackageExtractor From 20f544dea53c74d1ea330efab33e68a9e17d7fc4 Mon Sep 17 00:00:00 2001 From: nigel brown Date: Tue, 4 Mar 2025 11:34:19 +0000 Subject: [PATCH 3/3] Feeling ruff... Signed-off-by: nigel brown --- src/codegate/pipeline/comment/output.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/codegate/pipeline/comment/output.py b/src/codegate/pipeline/comment/output.py index 654b99a3..3a17b551 100644 --- a/src/codegate/pipeline/comment/output.py +++ b/src/codegate/pipeline/comment/output.py @@ -57,7 +57,8 @@ async def _snippet_comment(self, snippet: CodeSnippet, context: PipelineContext) # and "filepath" not in snippet.code # and "existing code" not in snippet.code # ): - # new_comment, is_suspicious = await check_suspicious_code(snippet.code, snippet.language) + # new_comment, is_suspicious = await check_suspicious_code(snippet.code, + # snippet.language) # if is_suspicious: # comment += new_comment