1vasari/songdown-compiler

View on GitHub

Showing 3 of 16 total issues

Function parseSection has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  parseSection: function(lines) {
    var nodes = [];

    while (lines[0] && !this.isHeader(lines[0])) {
      var line = lines.shift();
Severity: Minor
Found in lib/components/compiler.jsx - 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 parseVerse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseVerse: function(lines) {
    var nodes = [];

    // These indicate whether the verse block contains chords, lyrics, both, or none.
    var chords = true;
Severity: Minor
Found in lib/components/compiler.jsx - About 1 hr to fix

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

      parse: function(lines) {
        if (this.props.chords && this.props.lyrics) {
          return this.parseStandardBlock(lines);
        } else if (this.props.chords && !this.props.lyrics) {
          return this.parseChordBlock(lines);
    Severity: Minor
    Found in lib/components/verse.jsx - 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