Trip-Trax/tt-stylesheet

View on GitHub

Showing 4 of 7 total issues

`` has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class {
  constructor (target) {
    this._styleSheetEnabled = false;
    this._stylesheetElement = null;
    this._stylesheet = this._initializeStyleElement(target);
Severity: Minor
Found in src/tt-stylesheet.js - About 2 hrs to fix

    Function initCSS has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      initCSS () {
        const cssRules = this._stylesheet.cssRules;
        const styleElem = this._stylesheetElement;
    
        if (this._isArray(cssRules)) {
    Severity: Minor
    Found in src/tt-stylesheet.js - About 2 hrs 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 _normalizeProperty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      _normalizeProperty (property) {
        if (this._CACHED_PROPERTIES.hasOwnProperty(property)) {
          return this._CACHED_PROPERTIES[property];
        }
    
    
    Severity: Minor
    Found in src/tt-stylesheet.js - About 45 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 _flattenToOneLevel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      _flattenToOneLevel( data) {
        for (let key in data) {
          const styles = data[key];
    
          for (let _key in styles) {
    Severity: Minor
    Found in src/tt-stylesheet.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