compliance - Module Compliance Check

Verify PrestaShop module compliance with official standards using the PrestaShop Compliance API.

Purpose

The compliance command validates PrestaShop modules against official PrestaShop coding standards, marketplace requirements, and best practices to ensure quality and compatibility.

When to Use

  • Before marketplace submission: Validate modules before submitting to PrestaShop Marketplace
  • During module development: Check compliance during development process
  • Quality assurance: Regular quality checks as part of development workflow
  • Code review process: Automated compliance checking in code review
  • Client delivery: Ensure modules meet professional standards before delivery

Prerequisites

Before running the compliance command:

  1. Running Environment: Local environment must be running (ps-enterprise start)
  2. Module Installation: Modules must be installed in the local environment
  3. Network Access: Internet connection required for PrestaShop Compliance API
  4. Valid Authentication: Must be authenticated with PrestaShop Enterprise Platform

Usage

Interactive Module Selection

# Shows list of available modules to check
ps-enterprise compliance

Check Specific Module

# Check specific module by exact name
ps-enterprise compliance mymodule

# Check module with partial name matching
ps-enterprise compliance payment

Options

Flag Short Description Required
--help -h Show command help No

Process

The compliance tool automatically detects modules from your local environment:

Module Discovery

  • Module Directory: Scans /modules/ directory for installed modules
  • Module Metadata: Reads module configuration files to identify modules
  • Version Detection: Identifies module versions for accurate compliance checking

Module Selection Methods

Exact Match

# Exact module name matching
ps-enterprise compliance paymentmodule

Partial Match

# Partial name matching (shows options if multiple matches)
ps-enterprise compliance payment

# Output:
# Multiple modules found matching 'payment':
# 1. paymentmodule
# 2. payment_gateway
# 3. advanced_payment
# ? Select module to check: [1-3]

Interactive Selection

# Shows all available modules
ps-enterprise compliance

# Output:
# Available modules for compliance check:
# 1. customtheme
# 2. paymentmodule  
# 3. shippingmodule
# 4. analyticsmodule
# ? Select module(s) to check: [1-4, comma-separated]

Examples

Single Module Check

# Check specific payment module
ps-enterprise compliance paymentmodule

# Output:
# ✓ Analyzing module: paymentmodule v1.2.3
# ✓ Code structure validation
# ✓ Security analysis
# ✓ Performance analysis
# ✓ Marketplace requirements check
#
# Compliance Report:
# ==================
# Overall Score: 85/100
#
# Issues Found:
# ERROR (2):
#   - Line 45: SQL injection vulnerability in getOrders()
#   - Line 67: Missing input validation for user data
#
# WARNING (3):
#   - Line 23: Deprecated PrestaShop function usage
#   - Line 89: Missing translation for admin interface
#   - Line 112: Inefficient database query detected
#
# Recommendations:
# - Use PrestaShop's Db::getInstance()->execute() for safe queries
# - Add Tools::getValue() validation for user inputs
# - Update to use current PrestaShop API functions

Interactive Module Selection

# Interactive selection from available modules
ps-enterprise compliance

# Shows module selection menu:
# Available modules:
# 1. customtheme (v2.1.0)
# 2. paymentmodule (v1.3.2)  
# 3. shippingmodule (v1.0.1)
# 4. analyticsmodule (v2.0.0)
# 5. All modules
# ? Select modules to check (comma-separated): 2,3

Integration with Development Workflow

Development Process

# During development
ps-enterprise compliance mymodule

# Fix issues found
# Edit module files...

# Re-check compliance
ps-enterprise compliance mymodule

# Repeat until satisfactory score achieved

Pre-submission Checklist

# Before marketplace submission
ps-enterprise compliance mymodule

# Ensure score is 85+ and no CRITICAL/ERROR issues
# Address all security-related warnings
# Verify all marketplace requirements are met

Automated Quality Assurance

#!/bin/bash
# quality-check.sh - Automated compliance checking
for module in $(ls modules/); do
    echo "Checking $module..."
    ps-enterprise compliance $module
done

Advanced Usage

Batch Processing

# Check all custom modules (non-core modules)
find modules/ -maxdepth 1 -type d -not -name "ps_*" | while read module; do
    ps-enterprise compliance $(basename $module)
done

Report Export

While the CLI provides console output, you can redirect output for processing:

# Save compliance report to file
ps-enterprise compliance mymodule > compliance-report.txt

# Process multiple modules and save reports
for module in payment shipping analytics; do
    ps-enterprise compliance $module > "compliance-${module}.txt"
done

Troubleshooting

Module Not Found

❌ Module 'nonexistent' not found in modules directory
Available modules: paymentmodule, shippingmodule, analytics

Solution: Verify module name and installation.

Network Connection Error

❌ Cannot connect to PrestaShop Compliance API
Please check your internet connection and try again.

Solution: Verify internet connectivity and retry.

Module Structure Error

❌ Invalid module structure: Missing required file 'mymodule.php'

Solution: Fix module structure to include all required files.

  • start - Required to have running environment for module analysis
  • exec - Can be used to access module files for fixing issues
  • Development workflow integrates compliance checking with module development

API Dependency: This command requires internet connectivity to access the PrestaShop Compliance API for the most up-to-date compliance checking.
Pro Tip: Run compliance checks frequently during development rather than waiting until the end. It’s easier to fix issues as you go.
Security Priority: Always address CRITICAL and ERROR level security issues before deploying modules to production or submitting to marketplace.