Sha256: 5b1576889c0d500091855ee1f305d36a2b9ef63798514e1e86a9be378c01ede0

Contents?: true

Size: 1.21 KB

Versions: 43

Compression:

Stored size: 1.21 KB

Contents

/*jsl:option explicit*/
function useless_comparison() {
    var i, j, o;

    /* Test expressions */
    if (i+2 < i+2) { /*warning:useless_comparison*/
        return;
    }
    if (j != j) { /*warning:useless_comparison*/
        i++;
    }
    if ((14 * i) / (j - 2) >= (14 * i) / (j - 2)) { /*warning:useless_comparison*/
        return;
    }

    /* Test properties */
    if (o.left == o.left) { /*warning:useless_comparison*/
        return;
    }
    if (o.left == o['left']) { /*warning:useless_comparison*/
        return;
    }
    if (o['left'] == o['left']) { /*warning:useless_comparison*/
        return;
    }
    if (o[i] == o[i]) { /*warning:useless_comparison*/
        return;
    }

    if (o.left == o.right) {
        return;
    }
    if (o['left'] == o.right) {
        return;
    }
    if (o['left'] == o['right']) {
        return;
    }
    if (o[i] == o[j]) {
        return;
    }
    if (o[i] == o.right) {
        return;
    }

    /* Complex expressions not caught because of slight differences */
    if ((14 * i) / (j - 2) == (i * 14) / (j - 2)) {
        return;
    }

    /* allowed since function may have side affects */
    if (useless_comparison() == useless_comparison()) {
        return;
    }
}

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
distil-0.14.5.a vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.4 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.3 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.2 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.2.a vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.1 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.1.a vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0.i vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0.h vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0.g vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0.d vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0.c vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.14.0.b vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.13.6 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.13.5 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.13.4 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.13.3 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.13.2 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js
distil-0.13.1 vendor/jsl-0.3.0/tests/warnings/useless_comparison.js