Skip to content

APIHK/ArcaneAuditor

Β 
Β 

Repository files navigation

Arcane Auditor Logo

A mystical code review tool for Workday Extend applications.

βš—οΈ Validate. Visualize. Improve. β€” PMD, Pod, and Script compliance with wizard-level precision.

Version Download


🎯 Overview

Arcane Auditor channels ancient wisdom through 42 comprehensive validation rules to reveal hidden quality issues that compilers cannot detect but master code wizards should catch. This mystical tool analyzes:

  • πŸ“„ PMD Files: Page definitions with embedded scripts, endpoints, and presentation layers
  • 🧩 Pod Files: Reusable components with template widgets and endpoint configurations
  • πŸ“œ Script Files: Standalone .script files with function libraries and utilities
  • πŸ“‹ AMD Files: Application manifest definitions
  • πŸ“‹ SMD Files: Security manifest definitions

🌟 What Makes Arcane Auditor Special?

πŸ§™ Always Ready Reviewer

Like having an experienced Extend developer over your shoulder. No more wondering if you're following the style guide!

πŸ” True Script Understanding

Actually parses PMD Script to analyze complexity and qualityβ€”not just text matching.

🎯 Exact Line Numbers

Violations are reported according to the exact line in your source files - no more hunting through hundreds of lines of code.

🧠 Smart Analysis

  • 42 comprehensive rules covering script quality and structural issues
  • Intelligent function tracking - knows when functions are called across sections
  • Cross-field analysis - detects issues that span multiple script blocks
  • Context-aware validation - understands PMD/Pod/Script/AMD/SMD relationships

πŸ›‘οΈ Update-Safe Configuration

Layered config system protects your customizations during updates. Your personal and team configs are never overwritten.

πŸ“Š Multiple Output Formats

  • Console: Quick feedback during development
  • Excel: Detailed reports with context sheets for stakeholder review
  • JSON: Optimal for CI system or ingestion by external tools
  • Web Interface: Visual analysis with drag-and-drop convenience

πŸ“‹ Prerequisites

UV Package Manager ⭐

UV is the fastest and easiest way to get started!

  • Automatically downloads Python - no separate installation needed
  • 10-100x faster than pip
  • Install UV:
    • Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    • macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh
    • More options: UV Installation Guide
  • Verify: uv --version

πŸ’‘ That's all you need! UV handles Python installation automatically when you run the tool.

πŸ”§ Advanced users: If you cannot use UV, see Alternative Installation Methods for pip instructions.


⚑ Quick Start Guide

Installation

  1. Download the latest release
  2. Extract to your desired location
  3. Install dependencies (first time only):
    cd ArcaneAuditor
    uv sync

πŸ€” Which Interface Should I Use?

Use Case Best Choice Why?
First-time users 🌐 Web Interface Visual, intuitive, no commands to remember
Quick analysis 🌐 Web Interface Drag & drop, instant results
CI/CD pipelines βš”οΈ Command Line Scriptable, exit codes, automation-friendly
Batch processing βš”οΈ Command Line Process multiple archives efficiently
Custom workflows βš”οΈ Command Line Full control over configuration and output

🌐 Option 1: Web Interface (Recommended for Most Users)

  1. Run the startup script:

    cd ArcaneAuditor
    
    # Windows
    start-web-service.bat
    
    # macOS/Linux
    ./start-web-service.sh

    The script automatically starts the server, and opens your browser!

  2. Upload your application ZIP file or drag & drop individual files

  3. Review results and download Excel reports

Screenshots

Dark Mode: Web Interface - Dark Mode

Light Mode: Web Interface - Light Mode

πŸ“Έ More Screenshots

Upload View: Upload View

Issues View: Issues View

Issues Breakdown: Issues Breakdown

Configuration View: Configuration View


βš”οΈ Option 2: Command Line (Power Users & CI)

Quick commands:

cd ArcaneAuditor

# Analyze a complete application
uv run main.py review-app myapp.zip

# Analyze individual files
uv run main.py review-app file1.pmd file2.pod file3.script

# Use specific configuration
uv run main.py review-app myapp.zip --config my-config

# Generate Excel report
uv run main.py review-app myapp.zip --format excel --output report.xlsx

πŸ’‘ No Python installation needed! UV automatically downloads and manages Python when you run uv run.


πŸ“¦ Alternative Installation Methods

πŸ“¦ Installation Details (click to expand)

Option A: Clone Repository

Best for: Contributing or staying on latest development

# Clone the repository
git clone https://github.com/Developers-and-Dragons/ArcaneAuditor.git
cd ArcaneAuditor

# Install dependencies
uv sync

# Optional: Run tests
uv run pytest

Option B: Traditional pip

Best for: Restricted environments without UV

⚠️ Requires Python 3.12+ pre-installed

# Download and extract release
cd ArcaneAuditor

# Install dependencies
pip install -r requirements.txt

# Run without 'uv run' prefix
python main.py review-app myapp.zip
python web/server.py --port 8080

🌐 Web Interface

Features

  • πŸ“ Drag & Drop Upload: Easy file selection with ZIP or individual files
  • βš™οΈ Configuration Presets: Choose from development or production-ready modes
  • πŸ“Š Real-time Results: Quick analysis with detailed violation reports
  • πŸ“₯ Excel Export: Comprehensive reports with context information
  • πŸŒ™ Theme Support: Dark and light modes

Starting the Server

Quick Launch (Recommended):

# Windows - Auto-opens browser
start-web-service.bat

# macOS/Linux - Auto-opens browser
./start-web-service.sh

Custom Options:

# Custom port
start-web-service.bat --port 3000

# Specific host (for network access)
./start-web-service.sh --host 0.0.0.0 --port 8080

# Don't auto-open browser
start-web-service.bat --no-browser

πŸ’‘ Tip: See WEB_SERVICE_SCRIPTS.md for advanced options.

πŸ”— API Endpoints
  • GET / - Main interface
  • POST /upload - File upload
  • GET /job/{job_id} - Job status
  • GET /download/{job_id}/excel - Download Excel report
  • GET /configurations - Available configurations
  • GET /static/{file} - Static assets

βš™οΈ Configuration

Arcane Auditor uses a layered configuration system that protects your customizations:

Built-in Presets

  • development - Lenient rules for active development
    • Allows console logs, unused code, work-in-progress
    • Perfect for daily coding
  • production-ready - Comprehensive validation for deployment
    • All rules enabled, strict settings
    • Catches everything including cleanup items

Configuration Priority (Highest to Lowest)

  1. Command Line Arguments
  2. Personal Configuration (config/personal/*.json) βœ… Update-safe
  3. Team Configuration (config/teams/*.json) βœ… Update-safe
  4. Built-in Presets (config/presets/*.json) ⚠️ Overwritten on app updates - don't modify these!

Creating Custom Configs

Generate a baseline:

uv run main.py generate-config > config/personal/my-config.json

Example personal config (config/personal/my-settings.json):

{
  "rules": {
    "ScriptConsoleLogRule": {
      "enabled": false
    },
    "ScriptLongBlockRule": {
      "custom_settings": {
        "max_lines": 50,
        "skip_comments": true,
        "skip_blank_lines": true
      }
    }
  }
}

Use custom config:

uv run main.py review-app myapp.zip --config my-config

πŸ“– Full details: See Configuration Guide


πŸ”§ Validation Rules

Arcane Auditor enforces 42 validation rules across 2 categories:

πŸ“œ Script Rules (23 rules)

Code Quality:

  • Cyclomatic complexity limits
  • Function length restrictions
  • Nesting depth checks
  • Magic number detection

Best Practices:

  • Use let/const instead of var
  • Array method usage over manual loops
  • Template literals over string concatenation
  • Descriptive parameter names

Dead Code Detection:

  • Unused functions (embedded scripts)
  • Unused variables
  • Dead code (standalone .script files)
  • Unused function parameters
  • Unused script includes

πŸ—οΈ Structure Rules (19 rules)

Widget Validation:

  • Required IDs on widgets
  • Naming convention enforcement
  • Footer pod structure

Endpoint Configuration:

  • Error handling (failOnStatusCodes)
  • Naming conventions
  • Performance patterns (isCollection, bestEffort)

Security & Hardcoding:

  • Security domain requirements
  • Hardcoded WIDs and application IDs
  • Workday API URL patterns

File Organization:

  • File naming conventions
  • PMD section ordering
  • String interpolator patterns

πŸ“– Complete rule details: See Rule Documentation


πŸš€ Advanced Usage

πŸ€– CI/CD Integration

Exit Codes

Code Meaning Use Case
0 βœ… Success Clean code, or ADVICE issues only
1 ⚠️ Quality Issues ACTION issues found
2 ❌ Usage Error Invalid config/files
3 πŸ’₯ Runtime Error Analysis failed

Pipeline Examples

# Standard: Fail on ACTION issues only
uv run main.py review-app myapp.zip --format json --output report.json
if [ $? -eq 1 ]; then
    echo "❌ Code quality issues - review required"
    exit 1
fi

# Strict: Fail on both ACTION and ADVICE
uv run main.py review-app myapp.zip --fail-on-advice --quiet

# Check exit code programmatically
uv run main.py review-app myapp.zip
case $? in
    0) echo "βœ… Clean" ;;
    1) echo "⚠️ Issues found" ;;
    2) echo "❌ Tool misconfigured" ;;
    3) echo "πŸ’₯ Analysis failed" ;;
esac

CI Flags

  • --fail-on-advice - Fail on ADVICE issues (stricter)
  • --quiet - Minimal output for logs
  • --format json --output report.json - Machine-readable output for tooling
  • --format excel --output report.xlsx - Human-readable reports for review
🧠 Context Awareness

Arcane Auditor provides intelligent context awareness:

Complete Analysis βœ…

When all files are provided (PMD, AMD, SMD), runs all enabled rules.

Partial Analysis ⚠️

When files of certain types are missing:

  • Runs available rules on provided files
  • Indicates which files are missing
  • Shows which rules couldn't execute
  • Provides guidance for complete validation

Supported Modes

# ZIP analysis (complete)
uv run main.py review-app myapp.zip

# Individual files (partial)
uv run main.py review-app mypage.pmd

# Multiple files
uv run main.py review-app file1.pmd file2.pod file3.script

πŸ’‘ The tool clearly shows analysis completeness in all output formats.


πŸ› οΈ Development

πŸ› οΈ Contributing & Development Setup

Quick Setup

# Clone repository
git clone https://github.com/Developers-and-Dragons/ArcaneAuditor.git
cd ArcaneAuditor

# Install dependencies
uv sync

# Run tests
uv run pytest

Project Structure

web/              β†’ Web interface (FastAPI + frontend)
tests/            β†’ Automated test suite
config/           β†’ Presets, team, and personal configs
docs/             β†’ Documentation
parser/rules/     β†’ Validation rules
  β”œβ”€β”€ script/     β†’ Script quality rules
  β”œβ”€β”€ structure/  β†’ Structure validation rules
  └── custom/     β†’ Custom rule support

Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature-name
  3. Make changes and add tests
  4. Run test suite: uv run pytest
  5. Commit: git commit -m "Add feature"
  6. Push and create Pull Request

Custom Rules

Create custom rules in parser/rules/custom/user/:

from parser.rules.base import Rule, Finding
from parser.models import ProjectContext
from typing import Generator

class MyCustomRule(Rule):
    ID = "CUSTOM001"
    DESCRIPTION = "My organization-specific rule"
    SEVERITY = "ADVICE"
    
    def analyze(self, context: ProjectContext) -> Generator[Finding, None, None]:
        # Your validation logic
        pass

πŸ“– Full guide: See Custom Rules Guide


πŸ“š Documentation


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ If Arcane Auditor helps you, star the repo and share the magic!

May the Weave guide your code to perfection! ✨

About

A Workday Extend code review tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.0%
  • JavaScript 4.7%
  • CSS 4.5%
  • Other 0.8%