Package: ai-code-reviewer
AI code reviewerAI tool for automated code review. It is designed to review you code changes (for example before commit or creating pull request) for programming principles you specify. You have to provide coding principle you are interested in by populating.coding_principlesfolder in your repo and then GPT-4-Turbo model will check your changed files for these principles. The tool has CLI (similar to flake8).Pricing warning:ai_code_reviewer uses openai GPT-4-Turbo model for review which is quite expensive. You need toset up OPENAI accountand will be charged there based on the model usage.For example, checking single 100-lines long file with single 100-lines long principle will cost you around 0.03$.To reduce price ai_code_reviewer reviews only changed files and ignores unchanged ones. But if the file is changed, all of its lines will be processed by reviewer, so be careful running ai_code_reviewer if your files are very long. Also, only.pyfiles will be reviewed.For example, if you are checking for 5 principles and have changed 20 files, each ai_code_reviewer run would cost around 3$Plan your budget accordingly, developers of ai_code_reviewer are not responsible for your unexpected expenses.Usage with command lineGet your OPENAI_API_KEY fromhttps://platform.openai.com/api-keyspip install ai_code_reviewercd to you git repository dirRoot of your repository should contain non-empty.coding_principlesfolder. Populate it with coding principles you want to check for during code review. You can copy principles fromthe library of ready to use coding principlesor create your own by creating a new file withproper format.Run ai_code_reviewer:To check not committed changed files run in terminalOPENAI_API_KEY=sk-your-openai-key ai_code_reviewerTo check you local code version compared to some specific repository revision (for example, before creating pull request):OPENAI_API_KEY=sk-your-openai-key ai_code_reviewer --compare_with origin/developPrivacyai_code_reviewer does not collect or process your code. Your code will be directly uploaded to openai api using your api key.Check their privacy termsbefore using ai_code_reviewer with sensitive content.Custom-principlesThe idea of ai_code_reviewer is to be highly customisable and check only those principles you need. So if you have tried some ready-to-use principle, but it did not work for you (for example it does not review where you want it to review or otherwise, reviews code you consider good), we encourage you to modify principle file, fine-tuning it for your needs.The principle is.yamlfile consisting of following fields:principle_nameprinciple_description - here describe what you want this reviewer to check.review_required_examples - provide examples when you want this reviewer to triggerreview_not_required_examples - provide negative examples, when you do not want it to reviewContributionIf you like the project you could donate you time or money for its development.Sponsor buttonworks and if you want to contribute your code, lets communicate via emaildimitree54@gmail.com.Development planCLIProject structure understandingGitHub pull request reviewer botGitLab merge request reviewer botPyCharm pluginLICENSEThe ai_code_reviewer is subject of custom license terms, check license file for details. But in short, you can use it to review code of only non-commercial open-source projects. To use it for commercial code, contact me by emaildimitree54@gmail.com