Code Monkey home page Code Monkey logo

eggheads-code-style's Introduction

Установка

  • В composer.json в require-dev прописываем: "eggheads/eggheads-code-style": "^1"
  • Подключаем репозиторий:
{
    "type": "vcs",
    "url": "git://github.com/vovantune/eggheads-code-style"
}

Настройка Php code sniffer

  • Создаём в корне проекта файл phpcs.xml.dist вида:
<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

    <arg name="basepath" value="."/>
    <arg name="cache" value=".phpcs-cache"/>
    <arg name="colors"/>
    <arg name="extensions" value="php,ctp"/>
    <arg name="parallel" value="75"/>

    <rule ref="vendor/eggheads/eggheads-code-style/rules/phpcs-rules.xml"/>

    <file>src/</file>
    <file>tests/</file>
</ruleset>
  • Запуск сниффера: vendor/bin/phpcs
  • Автоисправление: vendor/bin/phpcbf
  • Запуск в TeamCity: vendor/bin/phpcs --report=\\setasign\\PhpcsTeamcityReport\\TeamcityReport

Настройка Php Mess Detector

  • Создаём в корне проекта файл phpmd-ruleset.xml вида:
<?xml version="1.0"?>
<ruleset name="Eggheads code style rule set"
         xmlns="http://pmd.sf.net/ruleset/1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
                     http://pmd.sf.net/ruleset_xml_schema.xsd"
         xsi:noNamespaceSchemaLocation="
                     http://pmd.sf.net/ruleset_xml_schema.xsd">

    <rule ref="vendor/eggheads/eggheads-code-style/rules/phpmd-ruleset.xml"/>
</ruleset>
  • Запуск phpmd: vendor/bin/phpmd src/,tests/ text phpmd-ruleset.xml
  • Запуск в TeamCity (Предварительно добавил phpmd-report.html Artifact paths для проекта, а также в Build Report Tabs самого TeamCity): vendor/bin/phpmd src/,tests/ html phpmd-ruleset.xml > phpmd-report.html

Настройка PHPStan

  • Создаём в корне проекта файл phpstan.neon вида:
parameters:
    level: 6
    paths:
        - src
        - tests
    bootstrapFiles:
        - config/bootstrap.php
  • Запуск PHPStan: vendor/bin/phpstan --configuration=phpstan.neon
  • Запуск в TeamCity: vendor/bin/phpstan --configuration=phpstan.neon --error-format=teamcity

eggheads-code-style's People

Contributors

vendelev avatar vovantune avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.