Skip to main content

A professional static analysis tool for QGIS (PyQGIS) plugins

Reason this release was yanked:

new release

Project description

QGIS Plugin Analyzer 🛡️

GitHub release (latest by date) Python Version License Maintenance Conventional Commits Quality Score Maintainability

The QGIS Plugin Analyzer is a static analysis tool designed specifically for QGIS (PyQGIS) plugin developers. Its goal is to elevate plugin quality by ensuring they follow community best practices and are optimized for AI-assisted development.

✨ Main Features

  • High-Performance Engine: Parallel analysis powered by ProcessPoolExecutor for ultra-fast execution on multi-core systems.
  • Project Auto-Detection: Intelligently distinguishes between official QGIS Plugins and Generic Python Projects, tailoring validation logic accordingly.
  • Advanced Ignore Engine: Robust .analyzerignore support with non-anchored patterns and smart default excludes (.venv, build, etc.).
  • Deep Semantic Analysis: Cross-file dependency graphing, circular import detection, and module coupling metrics.
  • Interactive Auto-Fix Mode: Automatically fix common QGIS issues (GDAL imports, PyQt bridge, logging, i18n) with safety checks.
  • Official Repository Compliance: Proactive validation of binaries, package size, and metadata URLs.
  • Real-time Progress: CLI feedback with a progress bar and ETA tracking.
  • Enhanced Configuration Profiles: Rule-level severity control (error, warning, info, ignore) via pyproject.toml.
  • Integrated Ruff Analysis: Combines custom QGIS rules with the fastest linter in the Python ecosystem.
  • Qt Resource Validation: Detect missing or broken resource paths (:/plugins/...) in your code.
  • Signal/Slot Safety: Detection of potentially missing slots or inherited slot warnings.
  • AI-Ready: Generates structured summaries and optimized contexts for LLMs.
  • Zero Runtime Dependencies: Works using only the Python standard library (Ruff as an external tool).

⚖️ Why use this Analyzer? (Comparison)

Feature QGIS Plugin Analyzer flake8-qgis Ruff (Standard) Official Repo Bot
Static Linting ✅ (Ruff + Custom) ✅ (flake8) ✅ (General) ✅ (Limited)
QGIS-Specific Rules ✅ (Precise AST) ✅ (Regex/AST)
Interactive Auto-Fix
Semantic Analysis
Compliance Checks
i18n / API Audit
Architecture Audit ✅ (UI/Core)
HTML/MD Reports
AI Context Gen ✅ (Project Brain)

Key Differentiators

  1. High-Performance Hybrid Engine: Combines multi-core AST processing with deep understanding of cross-file relationships and Qt-specific patterns.
  2. Safety-First Auto-Fixing: AST-based transformations with Git status verification and interactive diff previews.
  3. Repository Compliance: Local pre-checks to ensure your plugin passes the Official QGIS Repository policies.
  4. Zero Runtime Stack: Minimal footprint, ultra-fast execution, and easy CI integration.
  5. AI-Centric Design: Built to help developers and AI agents understand complex QGIS plugins instantly.

🚀 Installation and Usage

Installation with uv (Recommended):

If you have uv installed, you can install the analyzer quickly and in isolation:

1. As a global tool (isolated):

uv tool install git+https://github.com/geociencio/qgis-plugin-analyzer.git

2. Local installation for development:

git clone https://github.com/geociencio/qgis-plugin-analyzer
cd qgis-plugin-analyzer
uv sync

Installation with pip:

pip install .

Main Commands:

1. Analyze a Plugin:

qgis-analyzer analyze /path/to/your/plugin -o ./quality_report

2. Auto-Fix issues (Dry Run):

qgis-analyzer fix /path/to/your/plugin

3. Legacy Support: The default command remains analysis if no subcommand is specified:

qgis-analyzer /path/to/your/plugin

🔄 Pre-commit Hook

You can run qgis-plugin-analyzer automatically before every commit to ensure quality. Add this to your .pre-commit-config.yaml:

  - repo: https://github.com/geociencio/qgis-plugin-analyzer
    rev: v1.1.0  # Use the latest tag
    hooks:
      - id: qgis-plugin-analyzer
      - id: qgis-plugin-analyzer

🤖 GitHub Action

Use it directly in your CI/CD workflows:

steps:
  - uses: actions/checkout@v4
  - name: Run QGIS Quality Check
    uses: geociencio/qgis-plugin-analyzer@main
    with:
      path: .
      output: quality_report
      args: --profile release

⌨️ Full CLI Reference

qgis-analyzer analyze

Audits an existing QGIS plugin repository.

Argument Description Default
project_path (Required) Path to the plugin directory to analyze. N/A
-o, --output Directory where HTML/Markdown reports will be saved. ./analysis_results
-p, --profile Configuration profile from pyproject.toml (default, release). default

qgis-analyzer fix

Automatically fix common QGIS issues identified during analysis.

Argument Description Default
path (Required) Path to the plugin directory. N/A
--dry-run Show proposed changes without applying them. True
--apply Apply fixes to the files (disables dry-run). False
--auto-approve Apply fixes without interactive confirmation. False
--rules Comma-separated list of rule IDs to fix. Fix all
-o, --output Directory to read previous analysis from. ./analysis_results

qgis-analyzer summary

Shows a professional, color-coded summary of findings directly in your terminal.

Argument Description Default
-b, --by Granularity of the summary: total, modules, functions, classes. total
-i, --input Path to the project_context.json file to summarize. analysis_results/project_context.json

Example:

# Executive summary
qgis-analyzer summary

# Identify high-complexity functions
qgis-analyzer summary --by functions

qgis-analyzer list-rules

Displays the full catalog of implemented QGIS audit rules with their severity and descriptions.

qgis-analyzer init

Initializes a recommended .analyzerignore file in the current directory with common Python and QGIS development exclusions.

📊 Generated Reports

  • project_context.json: Full structured data for external integrations.

📜 Audit Rules

For a complete list of all implemented checks, their severity, and recommendations, please refer to the:

👉 Detailed Rules Catalog (RULES.md)

📚 References and Standards

The development of this analyzer is based on official QGIS community guidelines, geospatial standards, and industry best practices:

Official QGIS Documentation

Industry & Community Standards

Internal Resources

🛠️ Contributing

Contributions are welcome! Please refer to our Contributing Guide to learn how to report bugs, propose rules, and submit code changes.

Audit rules are located in src/analyzer/scanner.py. Feel free to add new rules following the existing pattern!


⚖️ License

This project is licensed under the GNU General Public License v3 (GPL v3). See the LICENSE file for details.


Developed for the SecInterp team and the QGIS community.

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

qgis_plugin_analyzer-1.3.0.tar.gz (66.3 kB view details)

Uploaded Source

Built Distribution

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

qgis_plugin_analyzer-1.3.0-py3-none-any.whl (66.5 kB view details)

Uploaded Python 3

File details

Details for the file qgis_plugin_analyzer-1.3.0.tar.gz.

File metadata

  • Download URL: qgis_plugin_analyzer-1.3.0.tar.gz
  • Upload date:
  • Size: 66.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for qgis_plugin_analyzer-1.3.0.tar.gz
Algorithm Hash digest
SHA256 00619da2b0988b0c63b3f4d1141bdf6779abd11db746e1d0034077674e706bbf
MD5 4c2378c63feaa10e1c752ab748a8de23
BLAKE2b-256 960cd6049a4f44c7f2d606bd9716e04bc50b842d983d709bad1a41c1ed09160b

See more details on using hashes here.

File details

Details for the file qgis_plugin_analyzer-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: qgis_plugin_analyzer-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 66.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for qgis_plugin_analyzer-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 869e56ea6eedc2de7dc61d1b0bcaa4f2a11be05fbdeab389c627c17d9242d361
MD5 b91e5c7f27c37dd839813b2912a91f0a
BLAKE2b-256 25504271acd15069f7a1cbde7e781491c55519dae548c4c28cae53d2b1e94d4e

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