Skip to main content

Useful classes extending langchain library

Project description

AI code reviewer

AI 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_principles folder 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 to set up OPENAI account and 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 .py files 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 line

  1. Get your OPENAI_API_KEY from https://platform.openai.com/api-keys
  2. pip install ai_code_reviewer
  3. cd to you git repository dir
  4. Root of your repository should contain non-empty .coding_principles folder. Populate it with coding principles you want to check for during code review. You can copy principles from the library of ready to use coding principles or create your own by creating a new file with proper format.
  5. Run ai_code_reviewer:
    1. To check not committed changed files run in terminal OPENAI_API_KEY=sk-your-openai-key ai_code_reviewer
    2. To 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/develop

Privacy

ai_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 terms before using ai_code_reviewer with sensitive content.

Custom-principles

The 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 .yaml file consisting of following fields:

  1. principle_name
  2. principle_description - here describe what you want this reviewer to check.
  3. review_required_examples - provide examples when you want this reviewer to trigger
  4. review_not_required_examples - provide negative examples, when you do not want it to review

Contribution

If you like the project you could donate you time or money for its development. Sponsor button works and if you want to contribute your code, lets communicate via email dimitree54@gmail.com.

Development plan

  • CLI
  • Project structure understanding
  • GitHub pull request reviewer bot
  • GitLab merge request reviewer bot
  • PyCharm plugin

LICENSE

The 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 email dimitree54@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_code_reviewer-0.0.10.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

ai_code_reviewer-0.0.10-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file ai_code_reviewer-0.0.10.tar.gz.

File metadata

  • Download URL: ai_code_reviewer-0.0.10.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for ai_code_reviewer-0.0.10.tar.gz
Algorithm Hash digest
SHA256 e1d46a7a7653e8fd40ad8479feb5dc03d6fc0d9b62c438c3ee87a2d87242dd46
MD5 21fed08a6de39f5275ef6d1e11940849
BLAKE2b-256 1d501d532a1a9492c8bf085ecb1943a1e5140ae83c12284b4690e5628aa06fc8

See more details on using hashes here.

File details

Details for the file ai_code_reviewer-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_code_reviewer-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 6b3a1045f8502268027224ed3daee0be2163143dc77f0ac53da31b5f1083ae5d
MD5 fd29cb52ba04d20245d11440c6f2e79a
BLAKE2b-256 301067356bfb2c1adb78decf5887a40d1b67682338231d8da22e447f0692c028

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page