Coder Social home page Coder Social logo

nilportugues / php-forbidden-functions Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 2.0 27 KB

[Git hook] Command line to look for functions that should be avoided

Home Page: http://nilportugues.com

License: MIT License

PHP 100.00%
php php7 git git-hooks git-hook ci quality quality-assurance composer forbidden-functions

php-forbidden-functions's Introduction

PHP Forbidden Functions

Scrutinizer Code Quality SensioLabsInsight Latest Stable Version Total Downloads License Donate

Why? Because someone should look for forbidden functions that should be avoided in production.

Typical examples are print_r, var_dump, exit and die function calls.

Installation

Use Composer to install the package:

$ composer require --dev nilportugues/php_forbidden

Usage

It is really this simple:

$ php bin/php_forbidden check <path/to/directory>
$ php bin/php_forbidden check <path/to/file>

You can also pipe STDIN in, if you want to use this tool with Gulp for instance:

$ cat <path/to/file> | php bin/php_forbidden check

which means that this also works writing code directly from the shell (if you have some reason to do it):

$ php bin/php_forbidden check
<?php
// Insert your code
// and press CTRL+D to send EOF

Configuration file

When run the first time, if no php_forbidden_function.yml file is found, it will be generated.

A configuration for instance, should formatted as follows:

forbidden:
  - file_get_contents
  - fopen
  - die
  - var_dump
  - print_r

You can specify an alternate location for the configuration file by passing in the -c parameter. Example:

$  php bin/php_forbidden check -c configs/php_forbidden_function.yml src/

Contribute

Contributions to the package are always welcome!

Support

Get in touch with me using one of the following means:

Authors

License

The code base is licensed under the MIT license.

php-forbidden-functions's People

Contributors

michelezamuner avatar nilportugues avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

guoyu07 sailoa996

php-forbidden-functions's Issues

php_forbidden_function.yml probably shouldn't be committed

As a user, if I try to modify it, I won't be able to checkout a newer release of your library because the changes would conflict/be overwritten.

A better solution is might be to add some install instructions asking users to copy the sample to .yml, or maybe a composer post-install script that copies the file for users.

Unit tests errors on Travis CI during pull request

I made a pull request, but Travis CI is failing while running unit tests:

The command "php vendor/phpunit/phpunit/phpunit tests/" exited with 1.

How can I see what tests are being run, and where they are failing?

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.