circle-exclamation
Deeplint is still in the MVP development phase and not yet available for use.

Git Integration

This guide will help you understand how DeepLint works with Git and how to integrate it into your Git workflow.

circle-info

This is part of the Getting Started series:

  1. Git Integration (current page)

Git Integration Overview

DeepLint is designed to work with Git repositories, analyzing changes in your codebase. By default, DeepLint analyzes staged changes, but you can also configure it to include unstaged changes.

The Git integration allows DeepLint to:

  • Detect staged and unstaged changes in your repository

  • Parse Git diffs to understand what has changed

  • Build context for analysis based on these changes

  • Focus analysis on the parts of your codebase that have changed

Running DeepLint on Git Changes

To run DeepLint on your Git changes:

Configuration Options

You can configure Git integration through your DeepLint configuration file:

Setting includeUnstaged to true will make DeepLint include unstaged changes in the analysis by default, without needing to specify the --unstaged flag.

Git Workflow Integration

DeepLint is designed to be integrated into your Git workflow. Here are some common ways to use DeepLint with Git:

Pre-Commit Analysis

Run DeepLint before committing changes to catch issues early:

Analyzing Specific Files

You can stage specific files and then run DeepLint to analyze only those files:

Analyzing Unstaged Changes

If you want to analyze changes before staging them:

Troubleshooting

No Staged Changes

If you run DeepLint without any staged changes, you'll see an error message:

To fix this, either:

  1. Stage some changes with git add, or

  2. Use the --unstaged flag to analyze unstaged changes:

Not a Git Repository

If you run DeepLint outside of a Git repository, you'll see an error message:

To fix this, either:

  1. Navigate to a Git repository, or

  2. Initialize a Git repository in your current directory:

Git Not Installed

If Git is not installed or not in your PATH, you'll see an error message:

To fix this, install Git from git-scm.comarrow-up-right and ensure it's in your PATH.

Permission Issues

If DeepLint doesn't have permission to access the Git repository, you'll see an error message:

To fix this, ensure you have the necessary permissions to access the Git repository.

How Git Integration Works

DeepLint's Git integration consists of two main components:

  1. Git Operations: Interacts with Git repositories to retrieve information about changes

  2. Diff Parser: Parses Git diffs into a structured format for analysis

Git Operations

The Git Operations component provides a clean interface for interacting with Git repositories. It uses the simple-git library to execute Git commands and parse their results. Key operations include:

  • Checking if there are staged or unstaged changes

  • Getting the list of staged or unstaged files

  • Getting the diff for staged or unstaged changes

  • Getting the diff between two commits

Diff Parser

The Diff Parser component parses Git diff output into a structured format that can be easily processed by the Context Builder. It extracts information about:

  • Changed files and their paths

  • Additions, deletions, and modifications

  • Line numbers and content

  • Context around changes

This structured information is then used by the Context Builder to build context for analysis.

Note: For planned Git features such as pre-commit hooks, CI/CD integration, and pull request analysis, see the Roadmap.

Next Steps

Now that you understand how DeepLint works with Git, you can:

  1. Configure DeepLint to customize the analysis

  2. Learn about the command line options to get the most out of DeepLint

  3. Explore the context building process to understand how DeepLint analyzes your code

For more detailed information about the Git integration implementation, see the Git Operationsarrow-up-right and Diff Parsingarrow-up-right documentation.


Previous: First Run

Last updated