Skip to content

Instantly share code, notes, and snippets.

@lamngockhuong
Last active December 30, 2017 16:41
Show Gist options
  • Select an option

  • Save lamngockhuong/3e3fe5b71749d641d68fded351d0b43a to your computer and use it in GitHub Desktop.

Select an option

Save lamngockhuong/3e3fe5b71749d641d68fded351d0b43a to your computer and use it in GitHub Desktop.
[Using PHPCS with Sublime Text] #sublimetext #ide #phpcs #lamngockhuong

Sử dụng PHP-Code-Sniffer kiểm tra code convention với Sublime Text

  1. Cài đặt PHP-Code-Sniffer

    composer global require "squizlabs/php_codesniffer=*"
  2. Thêm bộ quy tắc Framgia PHP https://github.com/wataridori/framgia-php-codesniffer

  3. Cài đặt Sublime Text package https://packagecontrol.io/packages/Phpcs.

    Cấu hình: Preferences => Package Settings => PHP Code Sniffer => Settings User

    {
    	"phpcs_executable_path": "ABSOLUTE_PATH_OF_phpcs",
    	"phpcs_additional_args": {
            "--standard": "Framgia",
            "-n": ""
        },
    }
  4. Other Sublime Text setting

    {
        // End of file is always newline
    	"ensure_newline_at_eof_on_save": true,
    	// Using space
    	"translate_tabs_to_spaces": true,
    	// Strip whitespace
    	"trim_trailing_white_space_on_save": true
    	"rulers":
    	[
    		80, // Soft limit
    		120 // Hard limit
    	],
    	"indent_guide_options":
    	[
    		"draw_normal",
    		"draw_active"
    	],
    	"show_encoding": true,
    	"show_line_endings": true,
    }
  5. With PHPStorm: https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment