lint-trap icon indicating copy to clipboard operation
lint-trap copied to clipboard

max-statements: [1, 15]

Open Raynos opened this issue 10 years ago • 1 comments

max-statements is still too low.

I'm writing a simple thrift struct parser.

Struct.read = function readStruct(buffer, offset) {
    /*eslint max-statements: [1, 25]*/
    var fields = [];
    var stop = null;

    // read a field. peek for stop
    do {
        var res = read.UInt8(buffer, offset);

        if (res[0]) {
            // turn into wtf did not find field error
            return res;
        }

        var value = res[2];
        if (value === ThriftType.TType.STOP) {
            stop = value;
            break;
        }

        var res2 = Field.read(buffer, offset);
        if (res[0]) {
            // turn into expected field error
            return res;
        }

        offset = res2[1];
        var field = res2[2];
        fields.push(field);
    } while (stop === null);
};

That's 16 statements! I've had to bump 15 to 25 a bunch of times whilst writing all kinds of code.

Also let's make it [2, 25] since warnings suck, either error or nothing.

Raynos avatar Feb 28 '15 23:02 Raynos

:+1:

jcorbin avatar Mar 01 '15 03:03 jcorbin