Ninjify

PHP nunchucks for you coding dojo

Check it out →

Installation

Create new project using composer library.

composer create-project --repository https://github.com/planette/playground
1

Add to your current project using composer library.

composer require ninjify/qa
1

Setup

Create file [project]/ruleset.xml

<?xml version="1.0"?>
<ruleset>
  <!-- Contributte Coding Standard -->
  <rule ref="./vendor/ninjify/coding-standard/contributte.xml">
    <!-- Exclude some rules -->
    <exclude name="Squiz.Commenting.FunctionComment.InvalidTypeHint"/>
  </rule>

  <!-- Specific rules -->
  <rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
      <properties>
          <property name="rootNamespaces" type="array" value="
              src=>Acme\Project,
              tests/fixtures=>Tests\Fixtures
          "/>
      </properties>
  </rule>

  <!-- Exclude folders -->
  <exclude-pattern>/tests/tmp</exclude-pattern>
</ruleset>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Usage

Once you have prepared ruleset.xml and have all dependencies in your composer.json, you can run these commands.

Analyse code

vendor/bin/codesniffer src tests
1

Fixup codestyle

vendor/bin/codefixer src tests
1

Demo

This is example of running codesniffer.

vendor/bin/codesniffer src tests
1

Or via composer script.

vendor/bin/codesniffer src tests
1

Codesniffer