GithubHelp home page GithubHelp logo

code-style's Introduction

Codestyle presets for Spiral components

Latest Stable Version Build Status Codecov

This repository contains ruleset for static analyses tools. Currently supported:

Current codestyle is PSR-12.

PHP Codesniffer ruleset is located in config/ruleset.xml.

PHP CS Fixer ruleset is located in config/.php_cs

To apply it in your project do the following:

Install the package

composer require --dev spiral/code-style

Check the code


#vendor/bin/spiral-cs check <dir1> <dir2> <file1>....
vendor/bin/spiral-cs check src tests

Automatically fix the code style

#vendor/bin/spiral-cs fix <dir1> <dir2> <file1>....
vendor/bin/spiral-cs fix src tests

code-style's People

Contributors

alexndr-novikov avatar butschster avatar msmakouz avatar serafimarts avatar wolfy-j avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mshabdiz

code-style's Issues

Check command has bad formatting

Error description contains only 1 word per line, example:

FILE: ...ycle\ProxyFactory\tests\Promise\ProxyPrinter\Fixtures\Entity.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
LINE 16: WARNING Property
                 name
                 "$__resolver"
                 should
                 not
                 be
                 prefixed
                 with
                 an
                 underscore
                 to
                 indicate
                 visibility
----------------------------------------------------------------------
   14:      public static $publicStatic;
   15:      protected $protected;
>> 16:      protected $__resolver;
   17:      private $private = null;
   18:
----------------------------------------------------------------------
Time: 4.38 secs; Memory: 10MB

Ability to define own cs config file

Now you have problem with PHP-cs-fixer - wrong config file name - Configuration file .php_cs is outdated, rename to .php-cs-fixer.php..
You can avoid this problem if command will have some option for config file

Is it possible?

Add new option like --exclude

Sometimes it can be required to check directory but skip some directory or file

It will be useful for libs with some generated code (in case of vendor lib generates code with some problems for example)

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.