> For the complete documentation index, see [llms.txt](https://docs.walnutai.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.walnutai.ai/core-features/gap-analysis/phase-3-code-quality-and-documentation.md).

# Phase 3: Code Quality & Documentation

**Phase 3: Code Quality & Documentation** analyses the technical health of the codebase and the code quality to identify architectural issues, documentation gaps, unit test coverage gaps, security vulnerabilities, and overall engineering quality.&#x20;

This analysis helps identify gaps early, as structural code issues can pose risks at any stage, not just over the long term.\
In this phase, the codebase acts as the baseline, and WalnutAI evaluates technical debt, maintainability, and best practice compliance.

* **Before starting the analysis:**
  * The project must be connected to one or more repositories.
  * Ensure the repositories were properly integrated during project creation.
  * The selected repository and branch will be used for technical quality evaluation.
* **To start the analysis:**

  * Click **Run Analysis**&#x20;

  <figure><img src="/files/nVuSR7PAeDoaqIq546bQ" alt=""><figcaption></figcaption></figure>

  * Select the connected repository.

  <figure><img src="/files/GCOuITvogE7p5ArRaJKq" alt=""><figcaption></figcaption></figure>

  * Click **Start Analysing** to begin evaluation.

  <figure><img src="/files/EsAJ7ZbuNSZSHaYz9YBZ" alt=""><figcaption></figcaption></figure>

  **During analysis:**

  * WalnutAI scans the entire repository structure and evaluates the code across multiple engineering dimensions.&#x20;
  * It detects architectural weaknesses and design issues while also identifying missing or incomplete documentation.&#x20;
  * At the same time, it analyses unit test coverage to find critical path gaps and evaluates performance-related concerns.&#x20;
  * The system also detects security vulnerabilities and risk patterns, categorizes all identified issues based on severity and impact, and generates AI-powered suggestions to improve the overall code quality.

  **After the analysis completes, WalnutAI displays the complete insights:**

  * Quality & Additional Metrics
  * Architectural Analysis
  * Documentation Gaps
  * Unit Tests Gaps
  * Security Gaps
* Quality Metrics & Additional Metrics assess the system’s overall quality by evaluating documentation, unit test coverage, API documentation, architecture strength, security effectiveness, and performance efficiency.

<figure><img src="/files/H7ucFwUBoUvX6dj6NYsK" alt=""><figcaption></figcaption></figure>

WalnutAI provides an initial overview of key technical gaps across the codebase, including architectural issues, documentation gaps, unit test coverage gaps, and security risks, helping users quickly understand and prioritize areas that need attention.

**Architecture Analysis:**

* The system identifies large or complex functions, detects multiple responsibilities within a single module, highlights improper dependency management, flags structural design issues.
* &#x20;WlanutAI also provides impact explanations along with AI-driven refactoring suggestions, displays the severity level and affected files, and allows users to select issues and create tasks accordingly.

<figure><img src="/files/UaQmVPN4PnyFZP6OcMd6" alt=""><figcaption></figcaption></figure>

* Click on “**Create Task**” after selecting either individual items or using the “Select All” option to create tasks.

<figure><img src="/files/LJlVJH5fNSmm6quj7Gfp" alt=""><figcaption></figcaption></figure>

* After clicking on “Create Task”, you can assign the task either to a user (using bulk or individual assignment) or to a [Cloud Agent](/development-and-infrastructure/cloud-agent.md), which can automatically handle the task without human intervention.

<figure><img src="/files/Z9rE0LlWXqBf4dhxx42s" alt=""><figcaption></figcaption></figure>

**Documentation Analysis:**

* The system identifies incomplete or missing explanations in functions and configurations, highlights areas with low documentation coverage percentage, suggests clearer and more comprehensive documentation improvements, and enables users to select identified gaps and create tasks to address them efficiently.

<figure><img src="/files/IefpaOnxiUtAMTYj14TI" alt=""><figcaption></figcaption></figure>

* Click on “**Create Task**” after selecting either individual items or using the “Select All” option to create tasks.

<figure><img src="/files/1mRIDDGETmy8UnS21itg" alt=""><figcaption></figcaption></figure>

* After clicking on “Create Task”, you can assign the task either to a user (using bulk or individual assignment) or to a [Cloud Agent](/development-and-infrastructure/cloud-agent.md), which can automatically handle the task without human intervention.

<figure><img src="/files/LXLs4h8lI8uXHJpWojKu" alt=""><figcaption></figcaption></figure>

**Unit Test Coverage Analysis:**

* The system identifies missing unit tests for critical and high-risk code paths, detects the absence of edge case and boundary condition testing, highlights the need for additional integration tests, provides coverage percentage at a file level for better visibility, suggests relevant and comprehensive test scenarios, and enables users to select identified gaps and create tasks to systematically improve overall test coverage and quality.

<figure><img src="/files/lRAJQTFzObNDEIoXJgq9" alt=""><figcaption></figcaption></figure>

* Click on “**Create Task**” after selecting either individual items or using the “Select All” option to create tasks.

<figure><img src="/files/Koxw4jb6pj3tXfzCt9Z3" alt=""><figcaption></figcaption></figure>

* After clicking on “Create Task”, you can assign the task either to a user (using bulk or individual assignment) or to a [Cloud Agent](/development-and-infrastructure/cloud-agent.md), which can automatically handle the task without human intervention.

<figure><img src="/files/nGvHGPemOsnxui31RKeZ" alt=""><figcaption></figcaption></figure>

**Security Analysis:**

* The system detects potential security vulnerabilities such as injection risks, unsafe configurations, and XSS issues, maps them to appropriate severity levels and recognized security standards like CWE, identifies the impacted source files, provides AI-driven mitigation suggestions, and enables users to select these vulnerabilities and create tasks to address them effectively.

<figure><img src="/files/91Tp6yTgPLYrGza0xytv" alt=""><figcaption></figcaption></figure>

* Click on “**Create Task**” after selecting either individual items or using the “**Select All**” option to create tasks.

<figure><img src="/files/lDd2KPLXQAzuBwIn7lWI" alt=""><figcaption></figcaption></figure>

* After clicking on “Create Task”, you can assign the task either to a user (using bulk or individual assignment) or to a [Cloud Agent](/development-and-infrastructure/cloud-agent.md), which can automatically handle the task without human intervention.

<figure><img src="/files/6xrKj759t20q8wgMvUJh" alt=""><figcaption></figcaption></figure>

Users can:

* Navigate between Architecture, Documentation, Unit Tests, and Security tabs.
* Select All or individual issues and create tasks directly from identified issues.
* The **Confidence and scoring system** reflects how well the codebase aligns with engineering best practices and maintainability standards.
* click **Run New Analysis** to re-scan the codebase for quality, security, and performance issues, ensuring the latest code changes are reflected in the analysis results.

<figure><img src="/files/3QjBa24IZlFBuHZ9viro" alt=""><figcaption></figcaption></figure>

Phase 3 ensures early detection of technical debt, maintains engineering quality standards, improves documentation and test coverage, mitigates security risks, and strengthens long-term code maintainability across the project.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.walnutai.ai/core-features/gap-analysis/phase-3-code-quality-and-documentation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
