Git Integration
Last updated
Last updated
This guide will help you understand how DeepLint works with Git and how to integrate it into your Git workflow.
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
To run DeepLint on your Git changes:
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.
DeepLint is designed to be integrated into your Git workflow. Here are some common ways to use DeepLint with Git:
Run DeepLint before committing changes to catch issues early:
You can stage specific files and then run DeepLint to analyze only those files:
If you want to analyze changes before staging them:
If you run DeepLint without any staged changes, you'll see an error message:
To fix this, either:
Stage some changes with git add
, or
Use the --unstaged
flag to analyze unstaged changes:
If you run DeepLint outside of a Git repository, you'll see an error message:
To fix this, either:
Navigate to a Git repository, or
Initialize a Git repository in your current directory:
If Git is not installed or not in your PATH, you'll see an error message:
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.
DeepLint's Git integration consists of two main components:
Git Operations: Interacts with Git repositories to retrieve information about changes
Diff Parser: Parses Git diffs into a structured format for analysis
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
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.
Now that you understand how DeepLint works with Git, you can:
To fix this, install Git from and ensure it's in your PATH.
Note: For planned Git features such as pre-commit hooks, CI/CD integration, and pull request analysis, see the .
to customize the analysis
Learn about the to get the most out of DeepLint
Explore the to understand how DeepLint analyzes your code
For more detailed information about the Git integration implementation, see the and documentation.
Previous: