[英]Code sniffer, How to validate just clear PSR2?
我的配置: phpcs --config-set default_standard PSR2<?xml version="1.0"?> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="tes ...
[英]Code sniffer, How to validate just clear PSR2?
我的配置: phpcs --config-set default_standard PSR2<?xml version="1.0"?> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="tes ...
[英]token_get_all() returns different values on same php version
我正在使用 PhpCS 來檢測代碼中的錯誤語法。 此工具使用 function token_get_all 但是我在 PHP 版本之間存在一些不一致(甚至在線相同的 PHP 版本) 簡化的代碼是: 如果我在這兩個網站上都使用 PHP 7.3,結果會有所不同: https://onlinephp.i ...
[英]How can I find out what rule produces an error?
我將PHP CodeSniffer設置為我的代碼的 linter,我有一個我想忽略的錯誤。 為了做到這一點,我應該能夠將行// phpcs:ignore Name.Of.The.Rule放在該規則的例外行之前。 不幸的是,我不知道如何找到我必須忽略的規則。 有沒有辦法顯示產生錯誤的規則? 現在,我 ...
[英]I am facing a PHP_CodeSniffer Error. Can you please help me?
我們的一位工程師面臨着 PhpStorm 的錯誤。 每當他在 PhpStorm 中編輯任何內容時,都會給出與PHP_Codesniffer相關的錯誤: phpcs:環境:php:沒有這樣的文件或目錄... 如果打開 PHPCodeSniffer 檢查設置,可以看到以下附加設置。 還有一點,在他 ...
[英]How to exclude everything except some directories from PHP Code Sniffer inspections in .phpcs.xml?
我想在我的項目中從PHP Code Sniffer檢查中排除除某些目錄之外的所有內容。 類似於 git 回購排除與.gitignore 我的想法是帶有負前瞻的regex可以與<exclude-pattern > 一起使用。 我試過了: 因此,我希望 PHPCS 只掃描wp-conten ...
[英]phpcs: Referenced sniff "PHPCompatibility.PHP.RemovedExtensions" does not exist
我正在嘗試在 VSCode Windows 上安裝 PHP CodeSniffer 和 WordPress 編碼標准。 我得到了 PHP Code Beautifier 和 Fixer 工作,但是錯誤沒有突出顯示,並且出現錯誤說“phpcs:引用的嗅探”PHPCompatibility.PHP.Re ...
[英]Mysterious checked icon in PhpStorm
請問我的項目中的圖標是什么? 是來自 CodeSniffer 還是 PHPUnit? 非常感謝! ...
[英]PHP CodeSniffer Error: The phpcs report contains invalid json
我想將 PHP CodeSniffer 添加到 VScode。 在 VScode 中,我收到錯誤“phpcs:phpcs 報告包含無效的 json” 但是,當我在終端中運行以下命令時: PHP Codesniffer 按預期工作,終端輸出如下: 輸出中沒有無效的 JSON,我不確定如何 ...
[英]Discouraged Class Usage PHPCS
假設我有這些課程: Old_Class New_Class 如果這存在->something(new Old_Class())或Old_Class::staticMethod()或$oldClass->methodCall()我想要一個代碼嗅探來警告“發現 Old_Clas ...
[英]phpcs - Prevent showing "Opening parenthesis of a multi-line function call must be the last content on the line"
此代碼發生錯誤: 我正在使用phpcs vscode,需要phpcs的所有默認規則,除了這個! 你能告訴我怎么做嗎編寫一個包含所有默認規則的 phpcs 如何排除此規則 ...
[英]Is it possible to have different phpcs configuration values for different files?
我將PHP_CodeSniffer與PHPCompatibility一起使用,我想為不同的文件設置不同的配置值。 對於某些文件,我需要以下配置: 對於其他文件: 我想從我的phpcs.xml文件中執行此操作。 這可能嗎? ...
[英]Php Codesniffer Should ignore Capital letter and full stop
我正在為現有項目實施 PHPCS。 我想檢查函數是否有文檔塊。 我目前正在使用以下規則: 但是我遇到了很多問題,即參數注釋應該以大寫字母開頭並以句號結尾。 我怎樣才能使關於大寫字母和句號的規則不那么嚴格編輯:目前代碼塊也想對齊參數。 這會在@param array和$parameter之間創建很多難 ...
[英]Can PHP Code Sniffer advise me which rule has been violated and how to turn it off?
是否可以讓嗅探器 output 規則被破壞,因此我可以更改配置的哪一行來阻止這些違規行為的出現? 例如,我收到大量與數組相關的違規行為,但我對數組縮進感到滿意。 如何找出規則以及如何禁用它? 謝謝 ...
[英]How to find and alter rulesets in codesniffer?
我在這樣的預提交 git 鈎子中使用代碼嗅探器 但是,我不喜歡帶有標簽的意圖策略。 我的問題是我沒有找到定義規則集的 xml。 當我試圖找到可用的標准時 我得到The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, ...
[英]phpcs keeps scanning the whole project and not the specified directory
我正在嘗試在特定目錄上運行PHP代碼嗅探器,但是PHP代碼嗅探器將忽略<files>標志並掃描整個項目。 這是我正在運行的命令: ./vendor/bin/phpcs -p . --extensions=php docs/ ./vendor/bin/phpcs -p . --e ...
[英]PHP CodeSniffer: ERROR: The specified sniff code "Generic.Files.LineEndings.InvalidEOLChar" is invalid
我試圖在我的 Windows 機器上排除對 EOL 字符的檢查總是導致此錯誤消息: 無法弄清楚我做錯了什么。 我已經通過 composer 安裝了 PHP CodeSniffer 並且正在運行 3.4.0 版。 ...
[英]Any way to ignore `Missing file doc comment` Yii2 using PHp Strom?
我如何消除錯誤,所以我不必在名稱空間后添加文件標簽,而在名稱空間后添加類標簽 phpStorm中缺少文件標簽和類標簽錯誤。 ...
[英]Inspect Subdirectories of an Excluded Folder with PHP CodeSniffer
我正在嘗試配置我的phpcs.xml (PHP CodeSniffer 配置文件),以便我可以將文件夾內的所有目錄排除在檢查之外,但我指定的目錄除外。 對於那些熟悉.gitignore的人來說,等效項應該是這樣的,以便“ButIncludeThisOne”包含在版本控制中。 我試過的這是我的phpc ...
[英]How to setup PHP CodeSniffer that extend WordPress coding standards + autofix errors in VSCode?
如何為項目設置PHP CodeSniffer,其中包含擴展WordPress編碼標准的個人規則+保存時VSCode中的自動修復錯誤? 我在全球范圍內安裝了CodeSniffer WordPress編碼標准安裝在主題文件夾中(所以在項目內部他們位於/wp-content/themes ...