Using code checker

Verze:

27. 06. 2025

Zodpovědná osoba:

Dominik Šlechta

Installation and setup

  • In www/ run composer create-project nette/code-checker
  • Update $accept and $ignore for:
     public $accept = [
            '*.php', '*.phpt', '*.inc',
            '*.txt', '*.texy', '*.md',
            '*.css', '*.less', '*.sass', '*.scss', '*.js', '*.json', '*.latte', '*.htm', '*.html', '*.phtml', '*.xml',
            '*.ini', '*.neon', '*.yml',
            '*.sh', '*.bat',
            '*.sql',
            '.htaccess', '.gitignore',
        ];
    
    public $ignore = [
            '.git', '.svn', '.idea', '*.tmp', 'tmp', 'temp', 'log', 'vendor',
            'node_modules', 'bower_components',
            '*.min.js', 'package.json', 'package-lock.json', 'resources', 'www',
            '.gitlab-ci.yml', '*.lock', 'webpack.mix.js'
        ];​
  • Comment line 109-110

Usage

  • php code-checker -d "C:\www\ProjectName\" -f
  • Or directly from the project php "C:\www\code-checker\code-checker" --fix

Errors

If something does not work:

  • Update composer in code-checker folder
  • Directly from that folder run php code-checker -d C:\www\ProjectName -f