richcongress/static-analysis 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

richcongress/static-analysis

最新稳定版本:v0.3.1

Composer 安装命令:

composer require richcongress/static-analysis

包简介

A library to setup quickly the static analysis tools for RichCongress

README 文档

README

Package version Contributions Welcome License

The static analysis checks if the code fits the configured. In this repository, you'll find a default configuration, and a script to easily execute the static analysis.

Installation

Execute the following command using composer: composer require richcongress/static-analysis --dev

Configuration

Files

Create symlinks in the project folder that points to the configuration files:

ln -sr ./vendor/richcongress/static-analysis/configs/phpstan.neon ./
ln -sr ./vendor/richcongress/static-analysis/configs/phpinsights.php ./
ln -sr ./vendor/richcongress/static-analysis/configs/php-cs-fixer.dist.php ./.php-cs-fixer.dist.php

If you use this method in a bundle you will also want to exclude phpinsights.php from your autoloads in your composer.json:

{
    "autoload": {
        "exclude-from-classmap": ["phpinsights.php"]
    }
}

If you want rather copying files instead of creating a symlink, juste change ln by cp:

cp ./vendor/richcongress/static-analysis/configs/phpstan.neon ./
cp ./vendor/richcongress/static-analysis/configs/phpinsights.php ./
cp ./vendor/richcongress/static-analysis/configs/php-cs-fixer.dist.php ./.php-cs-fixer.dist.php

Git Hook

To easily add a hook that execute the static analysis on pre-push, add the following code to your composer.json file:

{
    "scripts": {
        "post-install-cmd": [
            "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks add --ignore-lock"
        ],
        "post-update-cmd": [
            "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks update"
        ]
    },

    "extra": {
        "hooks": {
            "pre-commit": [
                "docker-compose exec -T application ./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix -n"
            ],
            "pre-push": [
                "docker-compose exec -T application ./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run -n",
                "docker-compose exec -T application ./vendor/richcongress/static-analysis/bin/static_analysis"
            ]
        }
    }
}

Note that if commit outside your docker container if you use one, it will be executed outside your container.

PHP CS Fixer File Watcher

You can setup a file watcher to run php-cs-fixer automatically on file save. For PhpStorm the config configs/watcherTasks.xml can be used as an example or if you don't have other watchers in your config, directly copy it to your .idea/ folder:

cp ./vendor/richcongress/static-analysis/configs/watcherTasks.xml .idea/

Versioning

static-analysis follows semantic versioning. In short the scheme is MAJOR.MINOR.PATCH where

  1. MAJOR is bumped when there is a breaking change,
  2. MINOR is bumped when a new feature is added in a backward-compatible way,
  3. PATCH is bumped when a bug is fixed in a backward-compatible way.

Versions bellow 1.0.0 are considered experimental and breaking changes may occur at any time.

Contributing

Contributions are welcomed! There are many ways to contribute, and we appreciate all of them. Here are some of the major ones:

  • Bug Reports: While we strive for quality software, bugs can happen and we can't fix issues we're not aware of. So please report even if you're not sure about it or just want to ask a question. If anything the issue might indicate that the documentation can still be improved!
  • Feature Request: You have a use case not covered by the current api? Want to suggest a change or add something? We'd be glad to read about it and start a discussion to try to find the best possible solution.
  • Pull Request: Want to contribute code or documentation? We'd love that! If you need help to get started, GitHub as documentation on pull requests. We use the "fork and pull model" were contributors push changes to their personnal fork and then create pull requests to the main repository. Please make your pull requests against the master branch.

As a reminder, all contributors are expected to follow our Code of Conduct.

License

static-analysis is distributed under the terms of the MIT license.

See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固