Git Product home page Git Product logo

fixtro's Introduction

Fixtro

Build Status

A tool/framework to fix and check static code analysis in our enviroments.

90% Users just need to run the install command, install the precommit and thats it, you will have a fixer of the code, and a way to analyze your code so detects possible(or future) errors. In order to do so execute:

composer require karlosagudo/fixtro

vendor/bin/fixtro install

Usage:

{vendor-bin}/fixtro

In order to install:

{vendor-bin}/fixtro install    

This will install fixtro dependencies and it as a precommit hook.

This is the command will be executed in each precommit:

{vendor-bin}/fixtro precommit

If want more info about the processes use verbose option -vvv

Fixtro uses local binaries in case it found it, (for example phpunit, phpmd, php-cs-fixer), but in case it doesnt find it, it uses the own from fistro. (Thats why the install run a composer inside the vendor folder)

With this special feature, there is no need to install anymore php-cs-fixer, phpunit etc in new projects, only need to install fixtro on it. Also , fixtro will try to look for local config files ie: .php_cs, phpunit.xml , inside the root folder of your project or the build one. So, if you want to configure the project just think, as is php_cs_fixer, or phpunit were installed on it.

Requisites

  • Php 7.0+
  • Composer

Important Read the section about Uncomfortable errors, and generate your own config files (.php_cs, phpunit.xml, psalm.xml, phpmd.xml) (TODO: this files will be generated in the install) You can put this files, in the root of your project, or in the build folder.

Commands

Are in the folder src/CodeQualityTool/Commands. There is a general Abstract called GeneralCommand, that normal commands will heritage.

Examples:

  • FixEntireCommand - Will run all the checkers across the whole project
  • FIxPreCommit- Its intended to be a git-hook precommit, so will analyze only precommited files. (Will ignore the config for src folder and execute in commited files)

All Commands have an array where you can put the analyzers, and filter by files (folder FilterFiles), and add extra parameters. This analyzers are in the Checker folder.

Checkers

Checkers are the fixers or checkers that run in each commit and are already configured to be used in fixtro List of Checkers

Uncomfortable errors

Some of the checkers will show possible errors, that are almost impossible to solve, or there is no need to lost time on it, but you still want to run the other checkers.

This usually happens on phpmd and psalm. You can configure your own configuration files for this projects, or avoid errors with annotations on the code:

You can also avoid errors, using a listener in your project. Check next section

Control Fixtro in your own project

Using events

Config File Reference

Config fixtro.yml Reference

#####TODO:

  • allow to generate your own runner in the config
  • Tests, create a fake fixer test command, to add coverage
  • Checker of phpunit and phpspec if the project has defined a spec folder / phphunit

Fixtro Logo

fixtro's People

Watchers

Mathias Brodala avatar James Cloos 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.