vesln/stylec

View on GitHub

Showing 6 of 32 total issues

Function nodeChildren has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.nodeChildren = function(node) {
  switch (node.type) {
    case 'AssignmentExpression':
      return [node.right, node.left];

Severity: Major
Found in lib/stylec/util.js - About 3 hrs to fix

    Function parseOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Rule.prototype.parseOptions = function() {
      var val = this.source.option(this._option.key) || false;
      var error = false;
    
      if (val === false) {
    Severity: Minor
    Found in lib/stylec/rule.js - About 1 hr to fix

      Function multiLine has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      VarDec.prototype.multiLine = function(node, allowed, fn) {
        if (node.declarations.length === 1) {
          return this.onePerDec(node);
        }
      
      
      Severity: Minor
      Found in lib/stylec/rule/var-dec.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function parseOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      Rule.prototype.parseOptions = function() {
        var val = this.source.option(this._option.key) || false;
        var error = false;
      
        if (val === false) {
      Severity: Minor
      Found in lib/stylec/rule.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function multiLine has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      VarDec.prototype.multiLine = function(node, allowed, fn) {
        if (node.declarations.length === 1) {
          return this.onePerDec(node);
        }
      
      
      Severity: Minor
      Found in lib/stylec/rule/var-dec.js - About 1 hr to fix

        Function oneliner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        VarDec.prototype.oneliner = function(node) {
          var line = null;
          var error = false;
          var tok = null;
        
        
        Severity: Minor
        Found in lib/stylec/rule/var-dec.js - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Severity
        Category
        Status
        Source
        Language