sahat/satellizer

View on GitHub
src/popup.ts

Summary

Maintainability
B
4 hrs
Test Coverage

Function polling has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  polling(redirectUri: string): angular.IPromise<any> {
    return this.$q((resolve, reject) => {
      const redirectUriParser = document.createElement('a');
      redirectUriParser.href = redirectUri;
      const redirectUriPath = getFullUrlPath(redirectUriParser);
Severity: Minor
Found in src/popup.ts - About 1 hr to fix

    Function polling has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          const polling = this.$interval(() => {
            if (!this.popup || this.popup.closed || this.popup.closed === undefined) {
              this.$interval.cancel(polling);
              reject(new Error('The popup window was closed'));
            }
    Severity: Minor
    Found in src/popup.ts - About 1 hr to fix

      Function open has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        open(url: string,
             name: string,
             popupOptions: { width: number, height: number },
             redirectUri: string,
             dontPoll?: boolean): angular.IPromise<any> {
      Severity: Minor
      Found in src/popup.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 eventListener has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        eventListener(redirectUri): angular.IPromise<any> {
          return this.$q((resolve, reject) => {
            this.popup.addEventListener('loadstart', (event) => {
              if (event.url.indexOf(redirectUri) !== 0) {
                return;
      Severity: Minor
      Found in src/popup.ts - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status