Code coverage report for stylus-lint/src/checks/checkBlockStyle.js

Statements: 100% (9 / 9)      Branches: 93.33% (14 / 15)      Functions: 100% (1 / 1)      Lines: 100% (8 / 8)      Ignored: none     

All files » stylus-lint/src/checks/ » checkBlockStyle.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29    1           1 7     6         2 2     4         2    
'use strict';
 
var
    eqRe = /( =)|( \=\n)/,
    eqEndRe = /=$|=\s$/,
    hashRe = /\{$/;
 
// checks for use of @block when declaring blocks
module.exports = function checkBlockStyle( line ) {
    if ( typeof line !== 'string' ) { return; }
 
    // if = is present on line and not a block var or hash
    if ( eqRe.test( line ) &&
        line.indexOf( '@block' ) === -1 &&
        !hashRe.test( line ) ) {
 
        // if = at end of line, but no value or @block
        Eif ( eqEndRe.test( line ) ) {
            return false;
        }
    }
    else if ( eqRe.test( line ) &&
        line.indexOf( '@block' ) !== -1 &&
        !hashRe.test( line ) &&
        !eqEndRe.test( line ) ) {
        // if = is present, @block is present, not a hash, and no = at the end
        return true;
    }
}