From a0c16d2336773ec0756c8ca5120471363ea800bb Mon Sep 17 00:00:00 2001 From: Ben Selby Date: Sat, 14 Oct 2023 20:02:38 +0100 Subject: [PATCH] Removal of Scheck Justification is that Scheck (pfff) is now archived: https://github.com/facebookarchive/pfff --- Changelog.md | 4 + README.md | 10 - example-settings/nix-all-commands.example | 16 -- phpcs.py | 58 ----- phpcs.sublime-settings | 273 ++++++++++------------ 5 files changed, 123 insertions(+), 238 deletions(-) diff --git a/Changelog.md b/Changelog.md index aa5db56..f714fef 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # CHANGELOG +## 7.0.0 + +- Removal of Scheck. + ## 6.9.0 - Turn on tagging diff --git a/README.md b/README.md index bd12736..703e7f2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ This is a plugin for Sublime Text which provides checkstyle reports using the fo - PHP_CodeSniffer (`phpcs`) - Linter (`php -l`) - PHP Mess Detector (`phpmd`) -- Scheck (`scheck`, part of Facebook’s pfff toolchain) You can also configure the plugin to fix the issues using either @@ -65,7 +64,6 @@ which phpcbf - Ability to run PHP_CodeSniffer - Ability to run php -l on the open file - Ability to run PHP Mess Detector on the open file -- Ability to run Scheck on the open file - Show cached results from PHP_CodeSniffer in open file - Show errors in the Quick Panel - Show errors in the Gutter @@ -133,14 +131,6 @@ You can also define the configuration for the following settings, be it for a pr - `phpmd_executable_path` – The path to the phpmd executable. If empty string, use PATH to find it - `phpmd_additional_args` – This is the extra information you want to pass to the phpmd command. For example which “rulesets” you want to run -### Scheck - -- `scheck_run` - Do you want the scheck application to run? Off by default -- `scheck_command_on_save` - Do you want the command to execute on save? -- `scheck_executable_path` - The path to the scheck executable. If empty string, use PATH to find it -- `scheck_additional_args` - This is the extra information you want to pass to the scheck command. - Examples of the settings files can be found here - ### Project Based Settings Your .project file should look something like this: diff --git a/example-settings/nix-all-commands.example b/example-settings/nix-all-commands.example index 38fe0ca..088d5df 100644 --- a/example-settings/nix-all-commands.example +++ b/example-settings/nix-all-commands.example @@ -90,20 +90,4 @@ "phpmd_additional_args": { "codesize,unusedcode,naming": "" }, - - // PHP Scheck settings - // Execute scheck - "scheck_run": true, - - // Execute the scheck on file save - "scheck_command_on_save": false, - - // It seems python/sublime cannot always find the scheck application - // If empty, then use PATH version of scheck, else use the set value - "scheck_executable_path": "/Users/Ben/git/external/pfff/scheck", - - // Additional arguments you can specify into the application - "scheck_additional_args": { - "-strict" : "" - } } diff --git a/phpcs.py b/phpcs.py index 94ff274..1a8962c 100644 --- a/phpcs.py +++ b/phpcs.py @@ -51,10 +51,6 @@ class Pref: "phpmd_command_on_save", "phpmd_executable_path", "phpmd_additional_args", - "scheck_run", - "scheck_command_on_save", - "scheck_executable_path", - "scheck_additional_args", ] def load(self): @@ -419,52 +415,6 @@ def parse_report(self, args): self.error_list.append(error) -class Scheck(ShellCommand): - """Concrete class for Scheck""" - - def execute(self, path): - if pref.scheck_run != True: - return - - args = [] - - if ( - pref.phpcs_php_prefix_path != "" - and self.__class__.__name__ in pref.phpcs_commands_to_php_prefix - ): - args = [pref.phpcs_php_prefix_path] - - if pref.scheck_executable_path != "": - application_path = pref.scheck_executable_path - else: - application_path = "scheck" - - if len(args) > 0: - args.append(application_path) - else: - args = [application_path] - - for key, value in pref.scheck_additional_args.items(): - args.append(key) - if value != "": - args.append(value) - - args.append(os.path.normpath(path)) - - self.parse_report(args) - - def parse_report(self, args): - report = self.shell_out(args) - debug_message(report) - lines = re.finditer( - ".*:(?P\d+):(?P\d+): CHECK: (?P.*)", report - ) - - for line in lines: - error = CheckstyleError(line.group("line"), line.group("message")) - self.error_list.append(error) - - class Linter(ShellCommand): """Content class for php -l""" @@ -536,10 +486,6 @@ def run(self, path, event=None): self.checkstyle_reports.append( ["MessDetector", MessDetector().get_errors(path), "dot"] ) - if pref.scheck_run: - self.checkstyle_reports.append( - ["Scheck", Scheck().get_errors(path), "dot"] - ) else: if pref.phpcs_linter_command_on_save and pref.phpcs_linter_run: self.checkstyle_reports.append( @@ -553,10 +499,6 @@ def run(self, path, event=None): self.checkstyle_reports.append( ["MessDetector", MessDetector().get_errors(path), "dot"] ) - if pref.scheck_command_on_save and pref.scheck_run: - self.checkstyle_reports.append( - ["Scheck", Scheck().get_errors(path), "dot"] - ) sublime.set_timeout(self.generate, 0) diff --git a/phpcs.sublime-settings b/phpcs.sublime-settings index ecb5670..29dc4f5 100644 --- a/phpcs.sublime-settings +++ b/phpcs.sublime-settings @@ -1,185 +1,150 @@ { - // Plugin settings + // Plugin settings - // Turn the debug output on/off - "show_debug": false, + // Turn the debug output on/off + "show_debug": false, - // Which file types (file extensions), do you want the plugin to - // execute for - "extensions_to_execute": ["php"], + // Which file types (file extensions), do you want the plugin to + // execute for + "extensions_to_execute": ["php"], - // Do we need to blacklist any sub extensions from extensions_to_execute - // An example would be ["twig.php"] - "extensions_to_blacklist": [], + // Do we need to blacklist any sub extensions from extensions_to_execute + // An example would be ["twig.php"] + "extensions_to_blacklist": [], - // Execute the sniffer on file save - "phpcs_execute_on_save": true, + // 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 error list after save. + "phpcs_show_errors_on_save": true, - // Show the errors in the gutter - "phpcs_show_gutter_marks": true, + // Show the errors in the gutter + "phpcs_show_gutter_marks": true, - // Show outline for errors - "phpcs_outline_for_errors": 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 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, + // Show the errors in the quick panel so you can then goto line + "phpcs_show_quick_panel": true, - // The path to the php executable. - // Needed for windows, or anyone who doesn't/can't make phars - // executable. Avoid setting this if at all possible - "phpcs_php_prefix_path": "", + // The path to the php executable. + // Needed for windows, or anyone who doesn't/can't make phars + // executable. Avoid setting this if at all possible + "phpcs_php_prefix_path": "", - // Options include: - // - Sniffer - // - Fixer - // - MessDetector - // - CodeBeautifier - // - // This will prepend the application with the path to php - // Needed for windows, or anyone who doesn't/can't make phars - // executable. Avoid setting this if at all possible - "phpcs_commands_to_php_prefix": [], + // Options include: + // - Sniffer + // - Fixer + // - MessDetector + // - CodeBeautifier + // + // This will prepend the application with the path to php + // Needed for windows, or anyone who doesn't/can't make phars + // executable. Avoid setting this if at all possible + "phpcs_commands_to_php_prefix": [], - // What color to stylise the icon - // https://www.sublimetext.com/docs/3/api_reference.html#sublime.View - // add_regions - "phpcs_icon_scope_color": "comment", + // What color to stylise the icon + // https://www.sublimetext.com/docs/3/api_reference.html#sublime.View + // add_regions + "phpcs_icon_scope_color": "comment", + // PHP_CodeSniffer settings - // PHP_CodeSniffer settings + // Do you want to run the phpcs checker? + "phpcs_sniffer_run": true, - // Do you want to run the phpcs checker? - "phpcs_sniffer_run": true, + // Execute the sniffer on file save + "phpcs_command_on_save": 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": "", - // 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": "PSR2", + "-n": "" + }, - // Additional arguments you can specify into the application - // - // Example: - // { - // "--standard": "PEAR", - // "-n" - // } - "phpcs_additional_args": { - "--standard": "PSR2", - "-n": "" - }, + // PHP-CS-Fixer settings + // Fix the issues on save + "php_cs_fixer_on_save": false, + // Show the quick panel + "php_cs_fixer_show_quick_panel": false, - // PHP-CS-Fixer settings + // Path to where you have the php-cs-fixer installed + "php_cs_fixer_executable_path": "", - // Fix the issues on save - "php_cs_fixer_on_save": false, + // Additional arguments you can specify into the application + "php_cs_fixer_additional_args": {}, - // Show the quick panel - "php_cs_fixer_show_quick_panel": false, + // phpcbf settings - // Path to where you have the php-cs-fixer installed - "php_cs_fixer_executable_path": "", + // Fix the issues on save + "phpcbf_on_save": false, - // Additional arguments you can specify into the application - "php_cs_fixer_additional_args": { + // Show the quick panel + "phpcbf_show_quick_panel": false, - }, + // Path to where you have the phpcbf installed + "phpcbf_executable_path": "", + // Additional arguments you can specify into the application + // + // Example: + // { + // "--level": "all" + // } + "phpcbf_additional_args": { + "--standard": "PSR2", + "-n": "" + }, + // PHP Linter settings - // phpcbf settings - - // Fix the issues on save - "phpcbf_on_save": false, - - // Show the quick panel - "phpcbf_show_quick_panel": false, - - // Path to where you have the phpcbf installed - "phpcbf_executable_path": "", - - // Additional arguments you can specify into the application - // - // Example: - // { - // "--level": "all" - // } - "phpcbf_additional_args": { - "--standard": "PSR2", - "-n": "" - }, - - - - // PHP Linter settings - - // Are we going to run php -l over the file? - "phpcs_linter_run": true, - - // 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": "", - - // What is the regex for the linter? Has to provide a named match for 'message' and 'line' - "phpcs_linter_regex": "(?P.*) on line (?P\\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": "" - }, - - - // PHP Scheck settings - - // Execute scheck - "scheck_run": false, - - // Execute the scheck on file save - "scheck_command_on_save": false, - - // It seems python/sublime cannot always find the scheck application - // If empty, then use PATH version of scheck, else use the set value - "scheck_executable_path": "", - - // Additional arguments you can specify into the application - // - //Example: - //{ - // "-php_stdlib" : "/path/to/pfff", - // "-strict" : "" - //} - "scheck_additional_args": { - "-strict" : "" - } + // Are we going to run php -l over the file? + "phpcs_linter_run": true, + + // 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": "", + + // What is the regex for the linter? Has to provide a named match for 'message' and 'line' + "phpcs_linter_regex": "(?P.*) on line (?P\\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": "" + } }