pixijs/pixi-haxe

View on GitHub
samples/src/bunnymark/Main.hx

Summary

Maintainability
Test Coverage

Method _setup length is 55 lines (max allowed is 50)
Open

    function _setup() {
        renderer.view.style.transform = "translatez(0)";
        maxX = Browser.window.innerWidth;
        maxY = Browser.window.innerHeight;

Severity: Critical
Found in samples/src/bunnymark/Main.hx by haxe-checkstyle

Checks for long methods. If a method becomes very long it is hard to understand. Therefore long methods should usually be refactored into several individual methods that focus on a specific task.

37 is a magic number
Open

        var bunny2 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 86, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

164 is a magic number
Open

        var bunny4 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 164, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

200000 is a magic number
Open

        container = new ParticleContainer(200000, [false, true, false, false, false]);

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

47 is a magic number
Open

        var bunny1 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 47, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

26 is a magic number
Open

        var bunny2 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 86, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

26 is a magic number
Open

        var bunny4 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 164, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

                    bunny.scale.set(0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5);

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

5 is a magic number
Open

                    bunny.speedY = (Math.random() * 5) - 3;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

                if (Math.random() > 0.5) bunny.speedY -= Math.random() * 6;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

125 is a magic number
Open

        var bunny3 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 125, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

37 is a magic number
Open

        var bunny3 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 125, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

3 is a magic number
Open

            bunny.speedY = (Math.random() * 5) - 3;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

                    bunny.rotation = (Math.random() - 0.5);

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

5 is a magic number
Open

                    bunny.speedX = Math.random() * 5;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

                    bunny.scale.set(0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5);

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

6 is a magic number
Open

                if (Math.random() > 0.5) bunny.speedY -= Math.random() * 6;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

37 is a magic number
Open

        var bunny1 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 47, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

    var gravity:Float = 0.5;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0x8BDDCE is a magic number
Open

        backgroundColor = 0x8BDDCE;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

86 is a magic number
Open

        var bunny2 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 86, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

200000 is a magic number
Open

            if (count < 200000) {

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

3 is a magic number
Open

                    bunny.speedY = (Math.random() * 5) - 3;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

5 is a magic number
Open

            bunny.speedX = Math.random() * 5;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

5 is a magic number
Open

            bunny.speedY = (Math.random() * 5) - 3;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

26 is a magic number
Open

        var bunny5 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 2, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

5 is a magic number
Open

        bunnyType %= 5;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

-0.85 is a magic number
Open

                bunny.speedY *= -0.85;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

37 is a magic number
Open

        var bunny5 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 2, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

            bunny.anchor.x = 0.5;

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

                    bunny.scale.set(0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5);

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

26 is a magic number
Open

        var bunny1 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 47, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

26 is a magic number
Open

        var bunny3 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 125, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

37 is a magic number
Open

        var bunny4 = new Texture(wabbitTexture.baseTexture, new Rectangle(2, 164, 26, 37));

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

0.5 is a magic number
Open

                    bunny.scale.set(0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5);

Checks that there are no magic numbers. By default, -1, 0, 1, and 2 are not considered to be magic numbers.

Invalid variable bunnyTextures initialisation (move initialisation to constructor or function)
Open

    var bunnyTextures:Array<Texture> = [];

Checks for instance variables that are initialised at class level.

Invalid variable amount initialisation (move initialisation to constructor or function)
Open

    var amount:Int = 100;

Checks for instance variables that are initialised at class level.

Invalid variable minY initialisation (move initialisation to constructor or function)
Open

    var minY:Float = 0;

Checks for instance variables that are initialised at class level.

Invalid variable gravity initialisation (move initialisation to constructor or function)
Open

    var gravity:Float = 0.5;

Checks for instance variables that are initialised at class level.

Invalid variable bunnys initialisation (move initialisation to constructor or function)
Open

    var bunnys:Array<Bunny> = [];

Checks for instance variables that are initialised at class level.

Invalid variable isAdding initialisation (move initialisation to constructor or function)
Open

    var isAdding:Bool = false;

Checks for instance variables that are initialised at class level.

Invalid variable startBunnyCount initialisation (move initialisation to constructor or function)
Open

    var startBunnyCount:Int = 2;

Checks for instance variables that are initialised at class level.

Invalid variable minX initialisation (move initialisation to constructor or function)
Open

    var minX:Float = 0;

Checks for instance variables that are initialised at class level.

Invalid variable count initialisation (move initialisation to constructor or function)
Open

    var count:Int = 0;

Checks for instance variables that are initialised at class level.

Invalid member signature: startBunnyCount (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var startBunnyCount:Int = 2;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: isAdding (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var isAdding:Bool = false;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: container (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var container:ParticleContainer;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: minX (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var minX:Float = 0;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: maxY (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var maxY:Float;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: bunnyTextures (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var bunnyTextures:Array<Texture> = [];

Checks that instance variable names conform to a format specified by the format property.

Invalid method name signature: main (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    static function main() {
        new Main();
    }

Checks that method names conform to a format specified by the format property.

Invalid member signature: maxX (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var maxX:Float;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: bunnyType (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var bunnyType:Int;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: bunnys (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var bunnys:Array<Bunny> = [];

Checks that instance variable names conform to a format specified by the format property.

Invalid method name signature: onTouchEnd (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    function onTouchEnd(event) {
        bunnyType++;
        bunnyType %= 5;
        currentTexture = bunnyTextures[bunnyType];
        isAdding = false;

Checks that method names conform to a format specified by the format property.

Invalid member signature: minY (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var minY:Float = 0;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: count (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var count:Int = 0;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: wabbitTexture (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var wabbitTexture:Texture;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: amount (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var amount:Int = 100;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: currentTexture (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var currentTexture:Texture;

Checks that instance variable names conform to a format specified by the format property.

Invalid member signature: counter (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var counter:DivElement;

Checks that instance variable names conform to a format specified by the format property.

Invalid method name signature: onTouchStart (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    function onTouchStart(event) {
        isAdding = true;
    }

Checks that method names conform to a format specified by the format property.

Invalid member signature: gravity (name should be ~/^_[a-z][a-zA-Z0-9]*$/)
Open

    var gravity:Float = 0.5;

Checks that instance variable names conform to a format specified by the format property.

There are no issues that match your filters.

Category
Status