conveyal/transitive.js

View on GitHub
lib/styler/styler.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function getModeStyles has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getModeStyles(mode, display) {
    const modeStyles = {}

    // simulate a segment w/ the specified style
    const segment = {
Severity: Minor
Found in lib/styler/styler.js - About 1 hr to fix

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

      getModeStyles(mode, display) {
        const modeStyles = {}
    
        // simulate a segment w/ the specified style
        const segment = {
    Severity: Minor
    Found in lib/styler/styler.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

    Consider simplifying this complex logical expression.
    Open

        if (
          mode === 'WALK' ||
          mode === 'BICYCLE' ||
          mode === 'BICYCLE_RENT' ||
          mode === 'CAR' ||
    Severity: Critical
    Found in lib/styler/styler.js - About 1 hr to fix

      Function load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        load(styles) {
          for (const i in types) {
            const type = types[i]
            if (styles[type]) {
              for (const key in styles[type]) {
      Severity: Minor
      Found in lib/styler/styler.js - About 35 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

      Function reset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        reset() {
          for (const i in types) {
            const type = types[i]
            this[type] = Object.assign({}, styles[type] || {})
            for (const key in this[type]) {
      Severity: Minor
      Found in lib/styler/styler.js - About 35 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

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

        compute(rules, display, data, index) {
          let computed
          for (const i in rules) {
            const rule = rules[i]
            const val =
      Severity: Minor
      Found in lib/styler/styler.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

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

        compute2(type, attr, data, index) {
          let computed
          const rules = this[type][attr]
          if (!rules) return null
          for (const rule of rules) {
      Severity: Minor
      Found in lib/styler/styler.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

      There are no issues that match your filters.

      Category
      Status