2014-07-20 10 views
2

sublime-phpcs를 구성하려고했습니다. 배를 설치했고 문서화 된 설치 절차를 사용하여 PHP_CodeSnifferPHPMD 명령 줄을 설치했습니다. PHP와 배는 내 경로 인 d :/Program Files/xampp/php 및 d :/Program Files/xampp/php/pear에 있으며 디렉토리 외부에서 사용할 수 있습니다. 필자는 PHPCodeSniffer, PHPMD 및 showdebug를 사용자 설정 파일에서 true로 설정했지만 저장시 아무 것도 강조 표시되지 않거나 윤곽선이 표시되지 않으며 콘솔에서만 오류를 볼 수 있습니다.Sublime-phpcs - PHP MD 및 CS 패키지가 제대로 작동하지 않습니다.

[Phpcs] phpcs --report=checkstyle --standard=PSR2 -n D:\htdocs\ubc\app\main\source\plugins\project\core\class-cse-meta-boxes.php 
[Phpcs] phpcs --report=checkstyle --standard=PSR2 -n D:\htdocs\ubc\app\main\source\plugins\project\core\class-cse-meta-boxes.php 
[Phpcs] cwd: C:\Users\mtpultz 
Exception in thread Thread-183: 
Traceback (most recent call last): 
File "X/subprocess.py", line 1090, in _execute_child 
FileNotFoundError: [WinError 2] The system cannot find the file specified 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
File "X/threading.py", line 639, in _bootstrap_inner 
File "X/threading.py", line 596, in run 
File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 433, in run 
File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 139, in get_errors 
File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 215, in execute 
File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 218, in parse_report 
File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 169, in shell_out 
File "X/subprocess.py", line 818, in __init__ 
File "X/subprocess.py", line 1096, in _execute_child 
FileNotFoundError: [WinError 2] The system cannot find the file specified 

모든 설치 후 서버를 다시 시작한 후 서브 텍스트를 다시 열었습니다.

업데이트 Sergey의 도움을 받아 사용자 설정에 대한 phpcs 실행 경로가 추가되었습니다.

[Phpcs] phpmd D:\htdocs\ubc\app\main\source\plugins\ubc\core\class-cse-meta-boxes.php text codesize,unusedcode,naming 
[Phpcs] phpmd D:\htdocs\ubc\app\main\source\plugins\ubc\core\class-cse-meta-boxes.php text codesize,unusedcode,naming 
[Phpcs] cwd: C:\Users\mtpultz 
Exception in thread Thread-183: 
Traceback (most recent call last): 
    File "X/subprocess.py", line 1090, in _execute_child 
    FileNotFoundError: [WinError 2] The system cannot find the file specified 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "X/threading.py", line 639, in _bootstrap_inner 
    File "X/threading.py", line 596, in run 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 435, in run 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 139, in get_errors 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 311, in execute 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 314, in parse_report 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 169, in shell_out 
    File "X/subprocess.py", line 818, in __init__ 
    File "X/subprocess.py", line 1096, in _execute_child 
FileNotFoundError: [WinError 2] The system cannot find the file specified 

사용자 설정에 phpmd 실행 파일 경로가 추가 세르게이의 도움에 대한 응답으로 업데이트 2 .

[Phpcs] D:\Program Files\xampp\php\pear\phing\tasks\ext\phpmd D:\htdocs\ubc\app\main\source\plugins\ubc-petrography\core\class-cse-meta-boxes.php text codesize,unusedcode,naming 
[Phpcs] D:\Program Files\xampp\php\pear\phing\tasks\ext\phpmd D:\htdocs\ubc\app\main\source\plugins\ubc-petrography\core\class-cse-meta-boxes.php text codesize,unusedcode,naming 
[Phpcs] cwd: C:\Users\mtpultz 
Exception in thread Thread-18: 
Traceback (most recent call last): 
    File "X/subprocess.py", line 1090, in _execute_child 
PermissionError: [WinError 5] Access is denied 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "X/threading.py", line 639, in _bootstrap_inner 
    File "X/threading.py", line 596, in run 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 435, in run 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 139, in get_errors 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 311, in execute 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 314, in parse_report 
    File "phpcs in C:\Users\mtpultz\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 169, in shell_out 
    File "X/subprocess.py", line 818, in __init__ 
    File "X/subprocess.py", line 1096, in _execute_child 
PermissionError: [WinError 5] Access is denied 

누구든지이 문제가 있습니까?

답변

2

봅니다 PHPCS 설정을 엽니 다 : 기본 패키지 설정 → PHP 코드 스니퍼 → 설정 → - 사용자

이 설정 파일이 추가 : (some_path이 phpcs의 실행 경로

{ 
    "phpcs_executable_path": "some_path" 
} 

당신이 경우 Windows의 PEAR 명령으로 설치 한 경우 실행 파일은 PHP의 루트 폴더에 phpcs.bat입니다. :)

예를 들어, 코드 스니퍼를 설치했으며 해당 실행 파일은 D:\dev\php\phpcs.bat입니다. 그래서 내 설정 내가 그 설정에 phpcs_executable_path을 설정할 때까지

{ 
    "phpcs_executable_path": "D:\\dev\\php\\phpcs.bat", 
    // Enable debug to see verbose output 
    "show_debug": true 
} 

숭고한-phpcs가도 나를 위해 작동하지 않았다이다.

업데이트 : 귀하의 질문에 대한 업데이트에서 볼 수 있듯이 지금 당장 phpmd_executable_path도 설정해야합니다. 또한이 목록에서 PHP 경로를 사용하겠습니다.

{ 
    "phpcs_executable_path": "D:\\Program Files\\xampp\\php\\phpcs.bat", 
    "phpmd_executable_path": "D:\\Program Files\\xampp\\php\\phpmd.bat", 
    // Enable debug to see verbose output 
    "show_debug": true 
} 
+0

안녕, 나는 phpcs_executable_path 변경에 "D : \\ 프로그램 파일 \\ XAMPP \\ PHP \\ phpcs.bat"당신이 언급 한 것처럼, 그리고 기본 설정에서 또한 발견 phpcs_php_path, 그리고 D를 추가 : \\ 프로그램 파일 \\ xampp \\ php에 사용자 설정에서. 그건 분명히 oversite 내 부분에있어,하지만 난 여전히 같은 오류 및 PHP 오류 알림을 받고 있어요. – mtpultz

+1

@mtpultz'phpcs_php_path'가 없으면'phpcs_executable_path'를 추가하지 않고 시작해 봅시다. 오, 안돼. 또한''show_debug ': true'를 추가해야합니다. 내 코드 목록을 업데이트했습니다. 위 참조. –

+0

안녕하세요, 알았습니다. 이제 공허한 오류 목록이 숭고한 콘솔에 나타납니다. 편집기에서 선 표시기 나 강조 표시가 없으며 하단의 오류 메시지가 변경되었습니다. 변경 사항을 반영하도록 질문을 수정했습니다. – mtpultz