Skip to content

eddiejaoude/brobdingnagian-detector-phpspec-extension

 
 

Repository files navigation

Build Status

brobdingnagian-detector-phpspec-extension

Detects if your class and methods are too big and suggest to extract responsibilities and collaborators

Installation

     "require-dev": {
        "elfiggo/brobdingnagian-detector":"^0.1.0"
      }

Enable the extension

Add the following to your phpspec.yml under extensions

extensions:
    - Elfiggo\Brobdingnagian\Extension

See PhpSpec Extension Documentation if you are having trouble

Parameters

brobdingnagian:
    class-size: 300
    method-size: 15
    number-of-methods: 5
    dependencies: 3
    list-brob: true|false
    create-csv: true|false
    number-of-interfaces: 3
    number-of-traits: 1

Usage

Use as normal with phpspec, if you want to disable exceptions for Brobdingnagian and list the classes, methods or dependencies instead, then pass the following flag, this has precedence over the phpspec.yml parameter.

phpspec r --list-brob=true (Turns Exceptions Off)
phpspec r --list-brob=false (Turns Exceptions On)

Supported PHP Versions

Currently PHP 5.5 and above

Follows php security support release cycle for minimum supported versions

To Do - Brobdingnagian

  1. Configurable limits
    • Configure Brob Exceptions to not throw if using list
  2. Number of Class dependencies
    • Count number class construct dependencies
    • add configurable limit
    • add error type
  3. Count number of methods
    • Add configurable limits
    • add error type
  4. Size of methods
    • Check each method size
    • Check number of method dependencies
    • Add configurable limits
    • add error type
  5. Add List output formatter
    • table view (default)
    • update log message/exception message where appropriate
    • add back error type
    • group class messages together to be more meaningful in large lists
    • exportable option of all in CSV format
    • add class size error type
    • refactoring period
  6. Add Backlog
    • add configurable filter for number of methods (public|private|protected)
    • add traits detector
    • add interfaces detector
  7. Ship It! (East Croydon)
  8. Add Dictionary of suggestible class names for roles
  9. Ship it! (Blackpool)
  10. Ask to split class/methods into a helper class
    • Create New Helper class with Spec stubs of current class
  11. Ship it! (Derby)

About

Detect if your class and methods are too big and suggest to extract responsibilities and collaborators

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%