/magento-static-test

Tools for static testing Magento 2 code

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

License: GPL v2

Build Status

What is this?

A Docker image that utilizes a phpcs to evaluate coding standards on code.

Based on:

How to use this image

Basic usage.

docker run --rm \
    --volume /local/path:/project \
    udovicic/magentost[:tag] [<options>]

For example, to check src directory against the lMEQP2 coding standard.

docker run --rm \
    --volume `pwd`:/project \
    udovicic/magentost:latest --standard=mcga --extensions=js,php,phtml src

A personal recommendation is to add following to your set of aliases:

alias mcga='docker run --rm --volume `pwd`:/project udovicic/magentost:latest --standard=mcga --extensions=js,php,phtml'
alias mcga-fix='docker run --rm --entrypoint "phpcbf" --volume `pwd`:/project udovicic/magentost:latest --standard=mcga --extensions=js,php,phtml'

In that case, you can simply use this as:

$ mcga <path_to_source>

And to fix what can be automaticall done:

$ mcga-fix <path_to_source>

Volumes

  • /project: Your PHP project directory.