Skip to main content

AI-powered code quality analysis tool with GitHub integration and interactive chatbot

Project description

Code Quality Intelligence Agent

The Code Quality Intelligence Agent is an enterprise-grade tool that combines traditional static analysis with modern AI capabilities to provide comprehensive code quality assessment. The system integrates multiple analysis engines, semantic search capabilities, and conversational AI to deliver actionable insights for software development teams.

Links:

1) Environment and Installation

# 1. Create and activate a virtual environment (Windows PowerShell)
python -m venv .venv
.\.venv\Scripts\Activate.ps1

#    macOS/Linux
python3 -m venv .venv
source .venv/bin/activate

# 2. Install the package
pip install -U pip
pip install code-quality-intelligence

# Optional: feature extras
pip install "code-quality-intelligence[rag]"    # RAG/semantic search extras
pip install "code-quality-intelligence[full]"   # Web/visualization extras

Verify installation and entry points:

cqi --help | cat
code-quality --help | cat
python -m code_quality_agent --help | cat

2) Quick Start (CLI)

# Analyze a local project
cqi analyze . --format console

# JSON report
cqi analyze . --format json --output quality.json

# Markdown report
cqi analyze . --format markdown --output quality.md

# Analyze a GitHub repository
cqi analyze https://github.com/pallets/flask

# Choose a branch
cqi analyze https://github.com/user/repo --branch main

# Interactive Q&A post-analysis
cqi analyze . --interactive

The code-quality and code-quality-agent commands are equivalent entry points.

3) Web Interface (Streamlit UI)

The package exposes a full web UI shipped in the repo. To run it from your environment:

# Install web dependencies
pip install streamlit pandas plotly

# If you cloned the repo, you can run the included web app
cd Webpage
pip install -r requirements.txt
streamlit run app.py

Alternatively, create your own minimal Streamlit launcher that calls the CLI under the hood.

Access via http://localhost:8501. Pages: Home, Setup, Info, Analyze, Chat.

4) Configuration and API Keys

Basic/static analysis works offline. To enable AI-enhanced and chat/RAG features, configure the Groq API key.

# A) Environment variable
setx GROQ_API_KEY "your_key_here"           # Windows (restart shell)
export GROQ_API_KEY="your_key_here"        # macOS/Linux

# B) .env file in your project directory
echo GROQ_API_KEY=your_key_here > .env

# C) Setup wizard
cqi setup

# D) Per-command override
cqi analyze . --groq-key your_key_here

5) What It Does — A→Z Workflow

When you run cqi analyze:

  1. Input resolution (local path or GitHub URL; optional --branch).
  2. File discovery and language detection via FileHandler.
  3. Static analysis: Bandit (security), Radon (complexity), pattern checks.
  4. Issue aggregation by severity and category.
  5. Optional RAG indexing: embeddings with FAISS/Chroma for semantic Q&A.
  6. Report generation: console, JSON, or Markdown.
  7. Optional interactive chat: LLM-backed answers grounded in analysis results and RAG retrieval.

Key components (package modules): code_quality_agent.agent, analyzers, rag_system and simple fallback RAG modules, report_generator, cli.

6) CLI Reference

  • cqi analyze PATH [--format console|json|markdown] [--output FILE] [--interactive] [--groq-key KEY] [--branch BRANCH]
  • cqi info PATH — quick stats without full analysis
  • cqi setup — store API key to .env, check dependencies
  • cqi chat — enhanced interactive chat (prompts for a path/URL)
  • cqi dashboard — launches a demo dashboard

Module mode equivalents:

python -m code_quality_agent --version
python -m code_quality_agent analyze . --format console
python -m code_quality_agent analyze . --interactive

7) Features

  • Security (Bandit), complexity (Radon), best-practice detection
  • GitHub analysis with branch support
  • Multi-language coverage (Python, JS/TS, Java, C/C++, C#, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala)
  • RAG-enhanced chat and answers; offline heuristic fallback
  • Reports: Console, JSON, Markdown
  • Streamlit web UI with charts, tables, and setup checks
  • Clear error handling and robust CLI UX

8) Troubleshooting

  • GROQ_API_KEY not found → cqi setup or set env/.env.
  • No supported files → verify path; run cqi info <path>.
  • RAG not available → install extras: pip install "code-quality-intelligence[rag]".
  • GitHub cloning issues → ensure Git is installed and URL/branch are correct.

9) CI/CD Example

name: Code Quality Assessment
on: [push, pull_request]
jobs:
  quality_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - name: Install Code Quality Agent
        run: pip install code-quality-intelligence
      - name: Run Analysis
        run: cqi analyze . --format json --output quality_report.json
        env:
          GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
      - name: Upload Report
        uses: actions/upload-artifact@v3
        with:
          name: quality-report
          path: quality_report.json

10) License

MIT License. See the source repository for details.

11) References

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

code_quality_intelligence-1.6.2.tar.gz (63.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_quality_intelligence-1.6.2-py3-none-any.whl (51.1 kB view details)

Uploaded Python 3

File details

Details for the file code_quality_intelligence-1.6.2.tar.gz.

File metadata

File hashes

Hashes for code_quality_intelligence-1.6.2.tar.gz
Algorithm Hash digest
SHA256 81df62d09ba80870bf1088f9d400e31b54cc79124ba0770dcddae6714adf0406
MD5 45944605b2e48b3c34b86fdf95ad340f
BLAKE2b-256 b10da96de284462b37e3e8b48d2a2023484f3807e08ec3463fe18e84de7f3a15

See more details on using hashes here.

File details

Details for the file code_quality_intelligence-1.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for code_quality_intelligence-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2dfa894fbac7564d5d00d427d4a66c340eeaf526d29132505784853cc1211f14
MD5 91f5918ccf9e8aafaa05fbeaaeb2b193
BLAKE2b-256 a0916aa7cd00644058297f6e96cae6c495fa9ace97c73cbf41377ed397f77903

See more details on using hashes here.

Supported by

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