Giter VIP home page Giter VIP logo

judge's Introduction

Judge

Judge is a tool to examine Magento extensions regarding their qualitiy and compatibility. There also exists a webend for Judge where you don't need to install the tool if you only want to try it.

Installation

If Composer is not yet installed on your system, you first have to install Composer:

curl -s https://getcomposer.org/installer | php;

Install judge with Composer:

git clone git://github.com/NetresearchAppFactory/judge.git && cd judge && php composer.phar install --prefer-source

That's all. Happy judging :)

Usage

To evaluate an extension, you simply call

judge evaluate /path/to/extension

and you will get a summary report after a while.

There are some command line options available:

Judge command line parameters
parameter description
--config (-c) provide a configuration file (default: 'ini/sample.judge.ini')
--vendor (-d) provide the name of the extension vendor
--extension (-e) provide the extension name
--ext_version (-s) provide the extension version
--verbose (-v) Increase output verbosity

Prerequisites

Judge obtains information on various Magento versions from a database that needs to be created before running the tool. Restore the database dump from judge.sql.zip (included in the root directory) and set your database credentials via MageCompatibility configuration.

To perform code coverage tests via PHPUnit, a Magento installation must be available, inluding both, the extension to be checked and the EcomDev_PHPUnit extension. If you do not have a running installation prepared, Jumpstorm can be used to set up the environment. However, information on the Magento installation must be given in a separate configuration file which is referenced in the main CodeCoverage configuration. If you already installed a Magento, the [common] section is sufficient. When installing via Jumpstorm, the sections [magento] and [unittesting] must be specified additionally. Have a look at the sample ini for reference.

Configuration

Judge comes with a sample configuration file, which resides at ini/sample.judge.ini. The most relevant configuration part is [plugins], where you can adjust tools, measures and other special settings for all evaluations.

Quality Checks

CheckComments

This check evaluates the extension's code comment ratio.

CheckStyle

Checks, if the extension follows the Magento coding guidelines.

CodeCoverage

Runs unit tests (if available) and calculates their coverage.

CodeRuin

Detect unfinished parts of code.

CoreHacks

Detect if the extension uses include hacks to override Magento core components.

MageCompatibility

Try to find compatible Magento version. This is a very tricky task, since Magento uses a lot of Magic.

The extension gets parsed and all class dependencies, method calls and constants usage will be compared to all Magento versions (although we currently check only CE 1.3.2.4-1.7.0.2 and EE 1.8.0.0-1.10.1.1). We extracted all these tokens from the different Magento versions and inserted them in the database shipped with Judge. The tokens represent * existing classes * existing constants * existing methods * magic get/set/has/uns for database fields (although we may not detect them all).

We know, that there are a lot of false alarms, especially due to magic get/set/has/uns that also exist in code in some Magento versions. So here is a lot of work to do.

There are some very hard nuts: For instance, Varien_Data_Form_Element_Abstract supports calling getOriginalData, but that is done by a magic getter. Since it is a form element, there is no database representation for this property and so our scripts did not recognize that. That's why we introduced a JSON file (plugins/MageCompatibility/var/fixedVersions.json), where you can add tokens you know to be supported by some specific version.

PerformanceCheck

Try to find some well-known performance killers.

PhpCompatibility

Detect the minimum required PHP version to run the extension.

Rewrites

Count rewrites of the extension. The more rewrites an extension includes, the less compatibility to other extensions can be expected.

SecurityCheck

Try to find some well-known security leaks.

SourceCodeComplexity

Calculates the source code complexity.

Architecture

Judge is based on the Jumpstorm architecture, which is very flexible, so that every component could be replaced by another one. So it should be no problem to use another Logger or even to provide a web interface (although the least should not be possible for Jumpstorm that easy...).

Every single check is made by a Judge plugin, which in most cases calls an external tool via exec().

judge's People

Contributors

amenk avatar dshatovskiy avatar gfobe avatar grygir avatar mam08ixo avatar michaelluehr avatar quafzi avatar satknightn avatar vinai avatar

Watchers

 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.