承接 secl-group/phpcs-secl-standard 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

secl-group/phpcs-secl-standard

Composer 安装命令:

composer require secl-group/phpcs-secl-standard

包简介

A PHP_CodeSniffer maintainability standard for Secl Group applications

README 文档

README

PHP_CodeSniffer maintainability standard for Secl Group applications.

Everyone is probably familiar with a situation in which, with the development of a project, the implementation of new functions becomes more time-consuming and expensive. And, unfortunately, it often happens that the price starts to significantly outweigh the possible benefit that can be obtained from the implementation of the function.

Having analyzed a number of projects, the experts of Software Improvement Group (SIG) developed a set of simple principles and rules with the help of which you can make the situation much better. Some of these principles can be easily controlled in automatic mode. For this purpose, special software was created for such languages as Java and C#. We propose the easiest implementation of automatic control for PHP development. In this option, we have carried out control of these basic principles:

  • A function should be no longer than 15 lines of code;
  • The cyclomatic complexity of a function should not exceed 5;
  • Functions should not take more than 4 input arguments.

Once such control has been implemented in our company, the quality of development has significantly improved. Therefore, the code has become much easier to understand and maintain.

We propose you a basic option of the solution for automatic control. The standard can be easily integrated into a version control system. We recommend using it combined with other stylistic standards of your company.

This project was based on the principles provided by Joost Visser in his book Building Maintainable Software (ISBN print: 978-1-4919-5352-5, ISBN eBook: 978-1-4919-5348-8). For more information about software maintainability, we recommend that you read the book.

Installation

This coding standard can be installed via composer or used in your PHP_CodeSniffer install over PECL. Both ways are described below, but the way of using composer is recommended:

Using Composer

  1. Install The standard as a dependency of your composer based project (It will install a composer version of PHP_CodeSniffer as a dependency):

     $ php composer.phar require --dev secl-group/phpcs-secl-standard:~1.0.0
    
  2. Profit!

     $ bin/phpcs --standard=vendor/secl-group/phpcs-secl-standard/secl-group/phpcs/Secl --extensions=php src/
    

Using PEAR

  1. Install PHP_CodeSniffer:

     $ pear install PHP_CodeSniffer
    
  2. Find your PEAR directory:

     $ pear config-show | grep php_dir
    
  3. Copy, symlink or check out this repository to Secl folder inside the phpcs Standards directory:

     $ cd /path/to/pear/PHP/CodeSniffer/Standards
     $ git clone https://github.com/SECL-Group/phpcs-secl-standard Secl
    
  4. Set Secl as your default coding standard if you want:

     $ phpcs --config-set default_standard Secl
    
  5. Profit!

     $ phpcs --standard=Secl --extensions=php src/
    

Contributing

If you do contribute code to these Sniffs, please make sure it conforms to the PEAR coding standards and that the Secl-coding-standard unit tests are still passed.

To check the coding standard, run from the Secl-coding-standard source root:

$ phpcs --ignore=*/tests/* --standard=Secl . -n

For unit-tests

$ composer install
$ cp phpunit.xml.dist phpunit.xml

Make links to a vendor directory, use only absolute paths – otherwise, CORRECT the LINKS!

$ mkdir /path/to/phpcs/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Secl
  ln -sf /path/to/phpcs/Sniffs /path/to/phpcs/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Secl/Sniffs
  ln -sf /path/to/phpcs/Tests /path/to/phpcs/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Secl/Tests
  ln -sf /path/to/phpcs/ruleset.xml /path/to/phpcs/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Secl/ruleset.xml
  ln -sf /path/to/phpcs/phpunit.xml /path/to/phpcs/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Secl/phpunit.xml

The unit tests are run from the Secl directory which includes the vendor directory.

$ vendor/bin/phpunit -c phpunit.xml vendor/squizlabs/php_codesniffer/tests/AllTests.php

统计信息

  • 总下载量: 9.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2016-09-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固