How It Works

Whenever a team member opens a pull request, Kody performs a Code Review directly in your code management tool, such as GitHub or GitLab. Kody analyzes the code, provides detailed feedback, and highlights potential issues, just as a human reviewer would. This ensures code quality and speeds up the review process.

Additionally, you can use the command @kody start-review directly in Git to have Kody initiate a code review on any pull request. This command bypasses branch and naming configurations, so Kody will review any PR where the command is used.

Code Review Settings

Customize Kody’s Code Review to align with your team’s specific needs.

Code Style Guide

Set up your style guide to ensure consistent standards across the codebase.

Style Guide per Path

Path-specific instructions allow you to set additional, file-specific code review conditions based on file paths. These guide Kody’s code review automation to apply specific guidelines only where they’re most relevant.

Examples:

  • Special Rules for Certain Files or Directories:

    • Projects often contain files or folders that require particular attention due to sensitivity or complexity, such as configuration files, deployment scripts, or security-related code.
    • Example: For files in config/, ensure they follow strict security checks to prevent hardcoded sensitive information.
  • Code Review Customization:

    • Tailor review practices for different code areas, ensuring specific guidelines are followed in relevant sections.
    • Example: In the api/ directory, emphasize input validation and error handling.
  • Enhancing Code Quality:

    • Example: In UI-related files, focus on accessibility and responsiveness best practices.

Automatic Review

Choose whether you want reviews to trigger automatically or only when you issue the command @kody start-review in a pull request.

Types of Analysis

Select the types of analysis you’d like Kody to perform. Options include:

  • Performance Optimization: Identifies improvements for code efficiency, performance, and resource usage.

    // Original code
    let result = [];
    for (let i = 0; i < items.length; i++) {
      result.push(items[i] * 2);
    }
    
    // Optimized code using map (more efficient and readable)
    const result = items.map((item) => item * 2);
    
  • Security: Detects vulnerabilities and improves code security.

    // Original code
    function getUserData(username) {
      return db.query(`SELECT * FROM users WHERE username = '${username}'`);
    }
    
    // Improved code with enhanced security (using prepared statements)
    function getUserData(username) {
      return db.query("SELECT * FROM users WHERE username = ?", [username]);
    }
    
  • Error Handling: Enhances how errors and exceptions are managed.

    // Original code
    const data = JSON.parse(input);
    
    // Improved code with error handling
    try {
      const data = JSON.parse(input);
    } catch (error) {
      console.error("Error parsing JSON:", error);
    }
    
  • Refactoring: Restructures code to improve readability, maintainability, or modularity.

    // Original code
    function calculateDiscount(price, discount) {
      if (discount) {
        return price - (price * discount) / 100;
      } else {
        return price;
      }
    }
    
    // Refactored code to reduce duplicated logic
    function calculateDiscount(price, discount = 0) {
      return price - (price * discount) / 100;
    }
    
  • Maintainability: Enhances code to simplify future maintenance and extension.

    // Original code
    function processOrder(order) {
      // order proce