LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Subcommands
  • Options
  • Direct Usage
  • Examples
  • Run all analyses
  • Quick analysis with summary
  • Analyze specific directory
  • Generate analysis report
  • Analysis Overview
  • Code Quality
  • Performance
  • Security
  • Output Example
  • Analysis Configuration
  • Integration with CI/CD
  • GitHub Actions Example
  • Quality Gates
  • Report Formats
  • HTML Report
  • JSON Report
  • Markdown Report
  • Analysis Rules
  • Built-in Rules
  • Custom Rules
  • Baseline
  • Ignoring Issues
  • Inline Comments
  • Configuration File
  • Performance Tips
  • Use Cases
  • Best Practices
  • Troubleshooting
  • Analysis Takes Too Long
  • Too Many False Positives
  • Notes
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Code Analysis

wheels analyze

Base command for code analysis and quality checks.

Synopsis

wheels analyze [subcommand] [options]

Description

The wheels analyze command provides comprehensive code analysis tools for Wheels applications. It helps identify code quality issues, performance bottlenecks, security vulnerabilities, and provides actionable insights for improvement.

Subcommands

Command
Description

code

Analyze code quality and patterns

performance

Analyze performance characteristics

security

Security vulnerability analysis (deprecated)

Options

Option
Description

--help

Show help information

--version

Show version information

Direct Usage

When called without subcommands, runs all analyses:

wheels analyze

This executes:

  1. Code quality analysis

  2. Performance analysis

  3. Security scanning (if not deprecated)

Examples

Run all analyses

wheels analyze

Quick analysis with summary

wheels analyze --summary

Analyze specific directory

wheels analyze --path=./models

Generate analysis report

wheels analyze --report=html --output=./analysis-report

Analysis Overview

The analyze command examines:

Code Quality

  • Coding standards compliance

  • Code complexity metrics

  • Duplication detection

  • Best practices adherence

Performance

  • N+1 query detection

  • Slow query identification

  • Memory usage patterns

  • Cache effectiveness

Security

  • SQL injection risks

  • XSS vulnerabilities

  • Insecure configurations

  • Outdated dependencies

Output Example

Wheels Code Analysis Report
==========================

Code Quality
------------
✓ Files analyzed: 234
✓ Total lines: 12,456
⚠ Issues found: 23
  - High priority: 3
  - Medium priority: 12
  - Low priority: 8

Performance
-----------
✓ Queries analyzed: 156
⚠ Potential N+1 queries: 4
⚠ Slow queries detected: 2
✓ Cache hit ratio: 87%

Security (Deprecated)
--------------------
! Security analysis has been deprecated
! Use 'wheels security scan' instead

Summary Score: B+ (82/100)

Analysis Configuration

Configure via .wheels-analysis.json:

{
  "analyze": {
    "exclude": [
      "vendor/**",
      "tests/**",
      "*.min.js"
    ],
    "rules": {
      "complexity": {
        "maxComplexity": 10,
        "maxDepth": 4
      },
      "duplication": {
        "minLines": 5,
        "threshold": 0.05
      }
    },
    "performance": {
      "slowQueryThreshold": 1000,
      "cacheTargetRatio": 0.8
    }
  }
}

Integration with CI/CD

GitHub Actions Example

- name: Run code analysis
  run: |
    wheels analyze --format=json --output=analysis.json
    wheels analyze --format=badge > analysis-badge.svg

Quality Gates

Set minimum scores:

wheels analyze --min-score=80 --fail-on-issues=high

Report Formats

HTML Report

wheels analyze --report=html
  • Interactive dashboard

  • Detailed issue breakdown

  • Code snippets with issues

JSON Report

wheels analyze --format=json
  • Machine-readable format

  • CI/CD integration

  • Custom processing

Markdown Report

wheels analyze --format=markdown
  • Documentation-friendly

  • Pull request comments

  • Wiki integration

Analysis Rules

Built-in Rules

  • CFScript best practices

  • SQL query optimization

  • Security patterns

  • Memory management

Custom Rules

Create custom rules in .wheels-analysis-rules/:

module.exports = {
  name: "custom-rule",
  check: function(file, content) {
    // Rule implementation
  }
};

Baseline

Track improvement over time:

# Create baseline
wheels analyze --save-baseline

# Compare with baseline
wheels analyze --compare-baseline

Ignoring Issues

Inline Comments

// wheels-analyze-ignore-next-line
complexQuery = ormExecuteQuery(sql, params);

/* wheels-analyze-ignore-start */
// Complex code block
/* wheels-analyze-ignore-end */

Configuration File

{
  "ignore": [
    {
      "rule": "sql-injection",
      "file": "legacy/*.cfc"
    }
  ]
}

Performance Tips

  1. Incremental Analysis: Analyze only changed files

  2. Parallel Processing: Use multiple cores

  3. Cache Results: Reuse analysis for unchanged files

  4. Focused Scans: Target specific directories

Use Cases

  1. Pre-commit Hooks: Catch issues before commit

  2. Pull Request Checks: Automated code review

  3. Technical Debt: Track and reduce over time

  4. Team Standards: Enforce coding guidelines

  5. Performance Monitoring: Identify bottlenecks

Best Practices

  1. Run analysis regularly

  2. Fix high-priority issues first

  3. Set realistic quality gates

  4. Track metrics over time

  5. Integrate with development workflow

Troubleshooting

Analysis Takes Too Long

  • Exclude vendor directories

  • Use incremental mode

  • Increase memory allocation

Too Many False Positives

  • Tune rule sensitivity

  • Add specific ignores

  • Update rule definitions

Notes

  • First run may take longer due to initial scanning

  • Results are cached for performance

  • Some rules require database connection

  • Memory usage scales with codebase size

See Also

PreviousCode AnalysisNextwheels analyze code

Last updated 2 days ago

Was this helpful?

- Code quality analysis

- Performance analysis

- Security scanning

- Run tests

wheels analyze code
wheels analyze performance
wheels security scan
wheels test