benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
812 stars 126 forks source link

0 errors found in SL2, but cli finds errors #37

Closed smith981 closed 12 years ago

smith981 commented 12 years ago

I had the same issue as https://github.com/benmatselby/sublime-phpcs/issues/33. However, a reboot did not solve the problem for me. My config is:


{
    // Plugin settings

    // Turn the debug output on/off
    "show_debug": true,

    // Which file types (file extensions), do you want the plugin to
    // execute for
    "extensions_to_execute": ["php"],

    // Execute the sniffer on file save
    "phpcs_execute_on_save": true,

    // Show the error list after save.
    "phpcs_show_errors_on_save": true,

    // Show the errors in the gutter
    "phpcs_show_gutter_marks": true,

    // Show outline for errors
    "phpcs_outline_for_errors": true,

    // Show the errors in the status bar
    "phpcs_show_errors_in_status": true,

    // Show the errors in the quick panel so you can then goto line
    "phpcs_show_quick_panel": true,

    // PHP_CodeSniffer settings

    // Do you want to run the phpcs checker?
    "phpcs_sniffer_run": true,

    // Execute the sniffer on file save
    "phpcs_command_on_save": true,

    // It seems python/sublime cannot always find the phpcs application
    // If empty, then use PATH version of phpcs, else use the set value
    "phpcs_executable_path": "",

    // Additional arguments you can specify into the application
    //
    // Example:
    // {
    //     "--standard": "PEAR",
    //     "-n"
    // }
    "phpcs_additional_args": {
        "--standard": "PEAR",
        "-n": ""
    },

    // PHP-CS-Fixer settings

    // Fix the issues on save
    "php_cs_fixer_on_save": false,

    // Path to where you have the php-cs-fixer installed
    "php_cs_fixer_executable_path": "/Users/bselby/git/external/PHP-CS-Fixer/php-cs-fixer",

    // Additional arguments you can specify into the application
    //
    // Example:
    // {
    //     "--level": "all"
    // }
    "php_cs_fixer_additional_args": {
        "--level": "all"
    },

    // PHP Linter settings

    // Are we going to run php -l over the file?
    "phpcs_linter_run": false,

    // Execute the linter on file save
    "phpcs_linter_command_on_save": true,

    // It seems python/sublime cannot always find the php application
    // If empty, then use PATH version of php, else use the set value
    "phpcs_php_path": "C:\\Program Files\\BitNami MAMPStack\\php\\php.exe",

    // What is the regex for the linter? Has to provide a named match for 'message' and 'line'
    "phpcs_linter_regex": "(?P<message>.*) on line (?P<line>\\d+)",

    // PHP Mess Detector settings

    // Execute phpmd
    "phpmd_run": false,

    // Execute the phpmd on file save
    "phpmd_command_on_save": true,

    // It seems python/sublime cannot always find the phpmd application
    // If empty, then use PATH version of phpmd, else use the set value
    "phpmd_executable_path": "",

    // Additional arguments you can specify into the application
    //
    // Example:
    // {
    //     "codesize,unusedcode"
    // }
    "phpmd_additional_args": {
        "codesize,unusedcode,naming": ""
    }
}
benmatselby commented 12 years ago

What happens if you define "phpcs_executable_path" with the path to phpcs as mentioned in the Readme?

On 28 Aug 2012, at 23:34, smith981 notifications@github.com wrote:

phpcs_executable_path

smith981 commented 12 years ago

I had tried that yesterday with no success (I failed to mention that this is on a Windows 7 machine). However, looking again, I realized that the path I had entered into "phpcs_executable_path" pointed to the file "phpcs", which contained PHP code and this at the top:

#!C:\php\php.exe
<?php
/**
 * PHP_CodeSniffer tokenises PHP code and detects violations of a
 * defined set of coding standards.
 *
 * PHP version 5
...

That header pointed to a PHP executable that did not exist. Changing it to the correct PHP executable's path solved the problem. Closing issue, thanks for pointing me in the right direction.