CocoonIO/cocoon-cloud-sdk

View on GitHub

Showing 12 of 133 total issues

File gulpfile.js has 581 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

const cocoonSDK = require("cocoon-cloud-sdk");
const fs = require("fs");
const gulp = require("gulp");
Severity: Major
Found in sample/gulp/gulpfile.js - About 1 day to fix

    Project has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class Project {
        public get id(): string {
            return this._id;
        }
    
    
    Severity: Minor
    Found in src/lib/project.ts - About 4 hrs to fix

      ProjectAPI has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class ProjectAPI {
          /**
           * Create a project from a Zip file.
           * @param file Zip file containing the source code. Can contain a config.xml file too.
           * @returns {Promise<Project>} Promise of the project created.
      Severity: Minor
      Found in src/lib/project-api.ts - About 3 hrs to fix

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

        export default class APIURL {
            public static get BASE(): string {
                return APIURL._BASE;
            }
        
        
        Severity: Minor
        Found in src/lib/api-url.ts - About 2 hrs to fix

          Function downloadFile has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function downloadFile(url, outputPath) {
              const dir = path.dirname(outputPath);
              if (!fs.existsSync(dir)) {
                  fs.mkdirSync(dir);
              }
          Severity: Minor
          Found in sample/gulp/gulpfile.js - About 1 hr to fix

            Function downloadProjectCompilation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function downloadProjectCompilation(project, platform, outputDir) {
                return waitForCompletion(project)
                .then(() => {
                    if (project.compilations[platform]) {
                        if (project.compilations[platform].isReady()) {
            Severity: Minor
            Found in sample/gulp/gulpfile.js - About 1 hr to fix

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

                  public static async request(
                      options: RequestOptions,
                      popsiclePlugins: Middleware[] = [],
                      addCredentials: boolean = true,
                  ): Promise<Response> {
              Severity: Minor
              Found in src/lib/cocoon-api.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 getUnprocessed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static async getUnprocessed(signingKeyId: string): Promise<ISigningKeyData> {
                      const signingKeysData = await SigningKeyAPI.listUnprocessed();
                      for (const platform in signingKeysData) {
                          if (!signingKeysData.hasOwnProperty(platform)) {
                              continue;
              Severity: Minor
              Found in src/lib/signing-key-api.ts - 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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static async get(signingKeyId: string): Promise<SigningKey> {
                      const signingKeysData = await SigningKeyAPI.listUnprocessed();
                      for (const platform in signingKeysData) {
                          if (!signingKeysData.hasOwnProperty(platform)) {
                              continue;
              Severity: Minor
              Found in src/lib/signing-key-api.ts - 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 isCompiling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public isCompiling(): boolean {
                      for (const platform in this._compilations) {
                          if (!this._compilations.hasOwnProperty(platform)) {
                              continue;
                          }
              Severity: Minor
              Found in src/lib/project.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

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

                  public async tokenExchangeAuthorizationCode(pCode: string, state: string): Promise<IAccessToken> {
                      const parameters = {
                          client_id: this.clientId,
                          client_secret: this.clientSecret,
                          code: pCode,
              Severity: Minor
              Found in src/lib/oauth.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

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

                  public constructor(data: IProjectData, platform: Platform) {
                      this._devapp = data.devapp && data.devapp.length > 0 && data.devapp.indexOf(platform as any) >= 0;
                      this._downloadLink = data.download ? data.download[platform] : null;
                      this._error = data.error ? data.error[platform] : null;
                      this._platform = platform;
              Severity: Minor
              Found in src/lib/compilation.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

              Severity
              Category
              Status
              Source
              Language