khaines/angular-applicationinsights

View on GitHub
src/Storage.ts

Summary

Maintainability
B
6 hrs
Test Coverage

Function addToCookies has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    addToCookies(key, value) {

        if (Tools.isUndefined(value)) {
            return false;
        } else if (Tools.isArray(value) || Tools.isObject(value)) {
Severity: Minor
Found in src/Storage.ts - About 1 hr to fix

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

        private addToLocalStorage(key, value) {
    
            // Let's convert undefined values to null to get the value consistent
            if (Tools.isUndefined(value)) {
                value = null;
    Severity: Minor
    Found in src/Storage.ts - 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 getFromCookies has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        getFromCookies(key) {
            if (!this.browserSupportsCookies) {
                this._$rootScope.$broadcast("AngularAppInsights.Storage.notification.error", "COOKIES_NOT_SUPPORTED");
                return false;
            }
    Severity: Minor
    Found in src/Storage.ts - 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 addToLocalStorage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private addToLocalStorage(key, value) {
    
            // Let's convert undefined values to null to get the value consistent
            if (Tools.isUndefined(value)) {
                value = null;
    Severity: Minor
    Found in src/Storage.ts - About 1 hr to fix

      Function addToCookies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          addToCookies(key, value) {
      
              if (Tools.isUndefined(value)) {
                  return false;
              } else if (Tools.isArray(value) || Tools.isObject(value)) {
      Severity: Minor
      Found in src/Storage.ts - About 55 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 getFromLocalStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private getFromLocalStorage(key) {
      
              if (!this.browserSupportsLocalStorage() || this._self.storageType === "cookie") {
                  if (!this.browserSupportsLocalStorage()) {
                      this._$rootScope.$broadcast("AngularAppInsights.Storage.notification.warning", "LOCAL_STORAGE_NOT_SUPPORTED");
      Severity: Minor
      Found in src/Storage.ts - 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