定制 gordinskiy/line-length-checker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gordinskiy/line-length-checker

最新稳定版本:v0.0.2

Composer 安装命令:

composer require gordinskiy/line-length-checker

包简介

PHP-CS-Fixer rule to check line length

README 文档

README

Custom rule for PHP-CS-Fixer.
Checks that the length of lines does not exceed 120 characters.
Doesn't fix anything.

How it works

Searches for the line that exceed max length limit and mark it by adding comment:
# Line too long

To see which lines violates the rule you should run the command with the--diff flag.

DIff example:

Diff Example

Works only for check command and fix command with --dry-run flag. Does nothing in other cases.

Installation

Install package:

composer require --dev gordinskiy/line-length-checker

Register rule in PHP-CS-Fixer config file:

<?php
// ...
return (new PhpCsFixer\Config())
    // ...
    ->registerCustomFixers([
        new Gordinskiy\LineLengthChecker\Rules\LineLengthLimit()
    ])
;

Enable rule in PHP-CS-Fixer config file:

<?php
// ...
return (new PhpCsFixer\Config())
    // ...
    ->setRules([
        'Gordinskiy/line_length_limit' => true,
    ])
;

Configuration

Default limitation is 120, but it can be configured by max_length option:

<?php
// ...
return (new PhpCsFixer\Config())
    // ...
    ->setRules([
        'Gordinskiy/line_length_limit' => ['max_length' => 115],
    ])
;

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-27