{"id":15661965,"url":"https://github.com/hunkim/gpt-py-review","last_synced_at":"2025-05-05T22:53:05.471Z","repository":{"id":66092108,"uuid":"597613131","full_name":"hunkim/gpt-py-review","owner":"hunkim","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-16T05:26:45.000Z","size":14,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T22:52:58.970Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunkim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-05T04:15:57.000Z","updated_at":"2023-02-18T01:48:57.000Z","dependencies_parsed_at":"2023-04-12T10:46:10.224Z","dependency_job_id":null,"html_url":"https://github.com/hunkim/gpt-py-review","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fgpt-py-review","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fgpt-py-review/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fgpt-py-review/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fgpt-py-review/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunkim","download_url":"https://codeload.github.com/hunkim/gpt-py-review/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590532,"owners_count":21772935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T13:29:42.138Z","updated_at":"2025-05-05T22:53:05.462Z","avatar_url":"https://github.com/hunkim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Review your code with chatgpt\n\n## Install\npip install git+https://github.com/hunkim/gpt-py-review.git\n\n## Review\nSet enviroment variables: `OPENAI_API_KEY` and `GPT_ENGINE`.\nIf necessary, also set `REVIEW_PROMPT` and/or `TESTCASE_PROMPT`.\n\n\nThen run `gpt-py-review yourcode.py`\n\nIt will create review comment in md and test cases in test.py.\n\n## Example\n### Original Code\n```python\n# Factorial of a number using recursion\n\ndef recur_factorial(n):\n   if n == 1:\n       return n\n   else:\n       return n*recur_factorial(n-1)\n\nnum = 7\n\n# check if the number is negative\nif num \u003c 0:\n   print(\"Sorry, factorial does not exist for negative numbers\")\nelif num == 0:\n   print(\"The factorial of 0 is 1\")\nelse:\n   print(\"The factorial of\", num, \"is\", recur_factorial(num))\n\n```\n\n### Reviews\n**[DOC] It would be better to include the name and the purpose of the function in the comment.**\n**Calculates the factorial of a given number using recursion**\n\n**[BUG] Test cases need to be included to make sure the function is working as expected.**\n\n**[REFACTOR] It appears that the function is checking if n is equal to 1. However, it would be better to include a condition to check if n is less than or equal to 1 in order to handle the case where the input is 0 or less which would result in an error in the current implementation.**\n\n```python\ndef recur_factorial(n):\n   if n \u003c= 1:\n      return 1\n   else:\n      return n*recur_factorial(n-1) \n```     \n**[Doc] Add test cases to verify the fixed implementation**\n```python\ndef test_recur_factorial():\n   assert recur_factorial(0) == 1 # [TEST] 0! is 1 \n   assert recur_factorial(1) == 1 # [TEST] 1! is 1\n   assert recur_factorial(2) == 2 # [TEST] 2! is 2\n   assert recur_factorial(3) == 6 # [TEST] 3! is 6\n   assert recur_factorial(5) == 120 # [TEST] 5! is 120\n\ntest_recur_factorial()\n```\n\n### Generated Test cases\n```python\n#Test case :1 the given number is  equals to 1 and output must be 1\ndef test_recur_factorial_1():\n    assert recur_factorial(1) == 1\n\n#Test case :2 the given number is  6 and output must be 720\ndef test_recur_factorial_2():\n    assert recur_factorial(6) == 720\n\n#Test case :3 the given number is  5 and output must be 120\ndef test_recur_factorial_3():\n    assert recur_factorial(5) == 120\n\n#Test case :4 the given number is  negative integer\ndef test_recur_factorial_4():\n    assert recur_factorial(-5) == \"It shoud not have negative interger\"\n    \n#Test case :5 the given number is  0 \ndef test_recur_factorial_5():\n    assert recur_factorial(0) == 1\n```\n## Content Right\nThe code and generated comments, test cases will be used by openai. Please do not use in commercial code. \n\nFrom:  https://openai.com/terms/\n(a) Your Content. You may provide input to the Services (“Input”), and receive output generated and returned by the Services based on the Input (“Output”). Input and Output are collectively “Content.” As between the parties and to the extent permitted by applicable law, you own all Input, and subject to your compliance with these Terms, OpenAI hereby assigns to you all its right, title and interest in and to Output. OpenAI may use Content as necessary to provide and maintain the Services, comply with applicable law, and enforce our policies. You are responsible for Content, including for ensuring that it does not violate any applicable law or these Terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunkim%2Fgpt-py-review","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunkim%2Fgpt-py-review","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunkim%2Fgpt-py-review/lists"}