spmcbride1201/keypunch-electron

View on GitHub
app/utils/jesFtp.js

Summary

Maintainability
F
4 days
Test Coverage

File jesFtp.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Promise from 'bluebird';
import { store } from '../index';
import {
  setCurrentStep,
  setIsConnected,
Severity: Minor
Found in app/utils/jesFtp.js - About 6 hrs to fix

    Function _pollMostRecentJobUntilComplete has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      async _pollMostRecentJobUntilComplete(maxRetries, timeToWait) {
        console.log("Attempting to get most recent job");
        let mostRecentJob;
        while (!mostRecentJob || mostRecentJob.status !== 'OUTPUT' && maxRetries > 0) {
          console.log("TriesRemaining: ", maxRetries);
    Severity: Minor
    Found in app/utils/jesFtp.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 listDatasets has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      listDatasets() {
        store.dispatch(setIsSubmitting(true));
        store.dispatch(setIsRetrieving(true));
        let datasets = [];
        return this.connect()
    Severity: Major
    Found in app/utils/jesFtp.js - About 2 hrs to fix

      Function listMembers has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        listMembers(dsname, datasets) {
          store.dispatch(setIsSubmitting(true));
          store.dispatch(setIsRetrieving(true));
          console.log("Connection: ", this.ftp.getConnectionStatus());
          let pwd;
      Severity: Major
      Found in app/utils/jesFtp.js - About 2 hrs to fix

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

          pollJobStatus() {
            store.dispatch(setIsSubmitting(true));
            store.dispatch(setIsRetrieving(true));
            this.connect()
              .then(() => this.setEncoding('ascii'))
        Severity: Minor
        Found in app/utils/jesFtp.js - About 1 hr to fix

          Function disconnect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async disconnect() {
              this.connectionStatus = this.ftp.getConnectionStatus();
              console.log("Attempting to disconnect");
              this.ftp.end()
                .then((msg) => console.log(msg))
          Severity: Minor
          Found in app/utils/jesFtp.js - About 1 hr to fix

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

              retrieveMember(datasetName, memberName) {
                store.dispatch(setIsSubmitting(true));
                store.dispatch(setIsRetrieving(true));
                console.log(`Retrieving member ${memberName} from dataset ${datasetName}`);
                return this.connect()
            Severity: Minor
            Found in app/utils/jesFtp.js - About 1 hr to fix

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

                async _pollMostRecentJobUntilComplete(maxRetries, timeToWait) {
                  console.log("Attempting to get most recent job");
                  let mostRecentJob;
                  while (!mostRecentJob || mostRecentJob.status !== 'OUTPUT' && maxRetries > 0) {
                    console.log("TriesRemaining: ", maxRetries);
              Severity: Minor
              Found in app/utils/jesFtp.js - About 1 hr to fix

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                    return this.connect()
                      .then((msg) => this.setEncoding('ascii'))
                      .then((msg) => console.log('After setting encoding to ASCII: ', msg))
                      .then((msg) => this.setFiletype('jes'))
                      .then((msg) => console.log('After setting filetype to JES: ', msg))
                Severity: Major
                Found in app/utils/jesFtp.js and 2 other locations - About 3 hrs to fix
                app/utils/jesFtp.js on lines 175..180
                app/utils/jesFtp.js on lines 219..224

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 95.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                    return this.connect()
                      .then((msg) => this.setEncoding('ascii'))
                      .then((msg) => console.log('After setting encoding to ASCII: ', msg))
                      .then((msg) => this.setFiletype('jes'))
                      .then((msg) => console.log('After setting filetype to JES: ', msg))
                Severity: Major
                Found in app/utils/jesFtp.js and 2 other locations - About 3 hrs to fix
                app/utils/jesFtp.js on lines 175..180
                app/utils/jesFtp.js on lines 201..206

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 95.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                    return this.connect()
                      .then((msg) => this.setEncoding('ascii'))
                      .then((msg) => console.log('After setting encoding to ASCII: ', msg))
                      .then((msg) => this.setFiletype('jes'))
                      .then((msg) => console.log('After setting filetype to JES: ', msg))
                Severity: Major
                Found in app/utils/jesFtp.js and 2 other locations - About 3 hrs to fix
                app/utils/jesFtp.js on lines 201..206
                app/utils/jesFtp.js on lines 219..224

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 95.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    return this.connect()
                      .then(() => this.setEncoding('ascii'))
                      .then(() => this.setFiletype('seq'))
                      .then(() => this.ftp.list(''))
                      .then(results => {
                Severity: Major
                Found in app/utils/jesFtp.js and 1 other location - About 1 hr to fix
                app/utils/jesFtp.js on lines 134..168

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 74.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    this.connect()
                      .then(() => this.setEncoding('ascii'))
                      .then(() => this.setFiletype('jes'))
                      .then(() => this.ftp.list(''))
                      .then(results => {
                Severity: Major
                Found in app/utils/jesFtp.js and 1 other location - About 1 hr to fix
                app/utils/jesFtp.js on lines 248..291

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 74.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            attributes: {
                              name: name,
                              vvmm: vvmm,
                              created: created,
                              changed: changed,
                Severity: Major
                Found in app/utils/jesFtp.js and 1 other location - About 1 hr to fix
                app/utils/jesFtp.js on lines 276..287

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 56.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        stream.on('data', (chunk) => {
                          console.log(`Received ${results.length} bytes of data.`);
                          results += chunk.toString();
                        })
                Severity: Major
                Found in app/utils/jesFtp.js and 1 other location - About 1 hr to fix
                app/utils/jesFtp.js on lines 387..390

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 56.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            attributes: {
                              volume,
                              unit,
                              referred,
                              ext,
                Severity: Major
                Found in app/utils/jesFtp.js and 1 other location - About 1 hr to fix
                app/utils/jesFtp.js on lines 344..355

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 56.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        stream.on('data', (chunk) => {
                          console.log(`Received ${results.length} bytes of data.`);
                          results += chunk.toString();
                        })
                Severity: Major
                Found in app/utils/jesFtp.js and 1 other location - About 1 hr to fix
                app/utils/jesFtp.js on lines 230..233

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 56.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status