benmatselby / sublime-phpcs

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

[Phpcs] ERROR: option "--runtime-set testVersion 5.4" not known. #155

Closed opauloh closed 8 years ago

opauloh commented 8 years ago

Hi, i need to run phpcs with the standard PHPCompatibility, and whenever i try to execute phpcs with the additional arg --runtime-set testVersion 5.4, he give me the following error:


[Phpcs] Project files:
[Phpcs]  Current: None
[Phpcs]  Last Known: None
[Phpcs] No project file defined, therefore skipping reload
[Phpcs] /home/user/vendor/bin/phpcs --report=checkstyle --runtime-set testVersion 5.4 --standard=PHPCompatibility /usr/share/nginx/html/test.php
[Phpcs] /home/user/vendor/bin/phpcs --report=checkstyle --runtime-set testVersion 5.4 --standard=PHPCompatibility /usr/share/nginx/html/test.php
[Phpcs] cwd: /home/user

[Phpcs] ERROR: option "--runtime-set testVersion 5.4" not known.

Usage: phpcs [-nwlsaepvi] [-d key[=value]] [--colors] [--no-colors]
    [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>] ...
    [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>]
    [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]
    [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]
    [--standard=<standard>] [--sniffs=<sniffs>] [--encoding=<encoding>]
    [--extensions=<extensions>] [--ignore=<patterns>] <file> ...
                      Set runtime value (see --config-set) 
        -n            Do not print warnings (shortcut for --warning-severity=0)
        -w            Print both warnings and errors (this is the default)
        -l            Local directory only, no recursion
        -s            Show sniff codes in all reports
        -a            Run interactively
        -e            Explain a standard by showing the sniffs it includes
        -p            Show progress of the run
        -v[v][v]      Print verbose output
        -i            Show a list of installed coding standards
        -d            Set the [key] php.ini value to [value] or [true] if value is omitted
        --help        Print this help message
        --version     Print version information
        --colors      Use colors in output
        --no-colors   Do not use colors in output (this is the default)
        <file>        One or more files and/or directories to check
        <encoding>    The encoding of the files being checked (default is iso-8859-1)
        <extensions>  A comma separated list of file extensions to check
                      (extension filtering only valid when checking a directory)
                      The type of the file can be specified using: ext/type
                      e.g., module/php,es/js
        <generator>   The name of a doc generator to use
                      (forces doc generation instead of checking)
        <patterns>    A comma separated list of patterns to ignore files and directories
        <report>      Print either the "full", "xml", "checkstyle", "csv"
                      "json", "emacs", "source", "summary", "diff"
                      "svnblame", "gitblame", "hgblame" or "notifysend" report
                      (the "full" report is printed by default)
        <reportFile>  Write the report to the specified file path
        <reportWidth> How many columns wide screen reports should be printed
                      or set to "auto" to use current screen width, where supported
        <sniffs>      A comma separated list of sniff codes to limit the check to
                      (all sniffs must be part of the specified standard)
        <severity>    The minimum severity required to display an error or warning
        <standard>    The name or path of the coding standard to use
        <tabWidth>    The number of spaces each tab represents

if i copy the code and paste the shell that he tries to execute at terminal, he give me the correct output:

/home/user/vendor/bin/phpcs --report=checkstyle --runtime-set testVersion 5.4 --standard=PHPCompatibility /usr/share/nginx/html/test.php

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="2.3.4">
<file name="/usr/share/nginx/html/test.php">
 <error line="300" column="18" severity="error" message="The function array_column is not present in PHP version 5.4 or earlier" source="PHPCompatibility.PHP.NewFunctions"/>
</file>
</checkstyle>

this is my sublime phpcs.sublime-settings

{
    "phpcs_php_path": "/usr/bin/php",
    "phpcs_executable_path": "/home/user/vendor/bin/phpcs",
    "phpcs_additional_args": {
        "--standard": "PHPCompatibility",
        "--runtime-set testVersion 5.4" : ""
    },
     // Show the error list after save.
    "phpcs_show_errors_on_save": true,
    "php_cs_fixer_executable_path": "/home/user/vendor/bin/phpcbf",
    "phpcs_sniffer_run": true,
    // PHP-CS-Fixer settings
    // Do not automatically fix the errors
    "php_cs_fixer_on_save": false,
    // Show the fixes in the quick panel
    "php_cs_fixer_show_quick_panel": true,
    // PHP Linter settings
    // Lint each file
    "phpcs_linter_run": false,
    "show_debug": true
}

anyone facing this issue?

benmatselby commented 8 years ago

@madeiraph

It should be this in your config I believe

"phpcs_additional_args": {
        "--standard": "PHPCompatibility",
        "--runtime-set" : "testVersion 5.4"
    },
opauloh commented 8 years ago

hi @benmatselby thanks for your response, i tried this setup, still error:

"phpcs_additional_args": {
        "--standard": "PHPCompatibility",
        "--runtime-set" : "testVersion 5.4"
},
[Phpcs] /home/user/vendor/bin/phpcs --report=checkstyle --runtime-set=testVersion 5.4 --standard=PHPCompatibility /usr/share/nginx/html/test.php
[Phpcs] /home/user/vendor/bin/phpcs --report=checkstyle --runtime-set=testVersion 5.4 --standard=PHPCompatibility /usr/share/nginx/html/test.php
[Phpcs] cwd: /home/user
reloading Packages/User/achievement.sublime-settings
[Phpcs] ERROR: option "--runtime-set=testVersion 5.4" not known.
benmatselby commented 8 years ago

@madeiraph Hi there, think this may need a development change actually. I'm not actively working on this at the moment as I have switched to phpStorm, so cannot guarantee a fix any time soon.

opauloh commented 8 years ago

@benmatselby i understand, i will try to find the fix for this, and if i get success i share here.

benmatselby commented 8 years ago

@madeiraph This should be fixed in v6.6.2 (just pushed up)