Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

Clean Code

No security coverage
View on drupal.org

Overview

The Clean Code module integrates GrumPHP into your Drupal project to enforce coding standards and perform code quality checks. It provides Drush commands to generate and manage GrumPHP configurations, ensuring that your codebase remains clean and adheres to best practices. it runs automatically during Git operations to catch issues before they are committed, ensuring a high-quality codebase.

Features

  • Automated code quality checks during Git operations.
  • Manual code quality checks via Drush commands.
  • Saves GrumPHP results to a log file for review.
  • Drush commands for generating and managing GrumPHP configurations.
  • Composer package management for GrumPHP tasks.
  • Integration with Git pre-commit hooks.
  • Saves GrumPHP results to a log file for review.

Installation

  1. Enable the module:
    drush en clean_code

Usage

Drush Commands

  1. Generate GrumPHP Configuration and Install Packages:
    • Command: drush clean_code:generate-install
    • Alias: drush ccgi
    • Example:
      drush clean_code:generate-install
  2. Run GrumPHP Checks:
    • Command: drush clean_code:check
    • Aliases: drush clc:check, drush code:check
    • Examples:
      drush clean_code:check
      drush clean_code:check --tasks=phpcs,phplint
  3. Generate GrumPHP Configuration Without Installing Packages (Override):
    • Command: drush clean_code:generate-no-install
    • Alias: drush ccgni
    • Example:
      drush clean_code:generate-no-install

Available Tasks

GrumPHP tasks available for code checks include:

  • git_blacklist: Ensures no blacklisted files are committed.
  • git_branch_name: Validates Git branch names.
  • git_commit_message: Validates Git commit message formats.
  • phpcs: Enforces PHP coding standards with PHP CodeSniffer.
  • phplint: Performs PHP lint checks for syntax errors.
  • phpmd: Detects code smells with PHP Mess Detector.
  • phpstan: Analyzes PHP code with PHPStan.
  • phpunit: Runs PHPUnit tests.
  • twigcs: Checks Twig templates for coding standards.
  • yamllint: Lints YAML files for syntax and style issues.
  • jsonlint: Lints JSON files for syntax correctness.
  • security-checker: Checks project dependencies for security vulnerabilities.

Configuration

To install necessary packages and set up the GrumPHP configuration file, use the following command:

drush ccgi

To edit the GrumPHP configuration file and customize tasks or options, use:

drush ccgni

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 5
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
1.0.0-alpha5 Pre-release Oct 27, 2024
1.0.0-alpha4 Pre-release Oct 17, 2024
1.0.0-alpha3 Pre-release Oct 16, 2024
1.0.0-alpha2 Pre-release Oct 16, 2024
1.0.0-alpha1 Pre-release Oct 12, 2024