APTrust/dart

View on GitHub

Showing 166 of 237 total issues

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

    list() {
        var tarReader = this;
        var extract = tar.extract();
        tarReader.fileCount = 0;
        tarReader.dirCount = 0;
Severity: Minor
Found in plugins/formats/read/tar_reader.js - About 1 hr to fix

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

        parseFromDOM() {
            // This is required for jest tests.
            if ($ === undefined) {
                var $ = require('jquery');
            }
    Severity: Minor
    Found in ui/forms/form.js - About 1 hr to fix

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

          static profileFromStandardObject(obj) {
              if (BagItUtil.guessProfileType(obj) != 'bagit_profiles') {
                  throw Context.y18n.__("Object does not look like a BagIt profile");
              }
              var p = new BagItProfile();
      Severity: Minor
      Found in bagit/bagit_util.js - 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 _validateManifestEntries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          _validateManifestEntries(manifestType) {
              var manifests = this.payloadManifests();
              if (manifestType === Constants.TAG_MANIFEST) {
                  manifests = this.tagManifests();
              }
      Severity: Minor
      Found in bagit/validator.js - 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 uploadedAt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          uploadedAt() {
              var uploadedAt = null;
              if (this.uploadOps.length > 0) {
                  for (let uploadOp of this.uploadOps) {
                      for (let result of uploadOp.results) {
      Severity: Minor
      Found in core/job.js - 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 _writeIntoArchive has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function _writeIntoArchive(data, done) {
          if (!fs.existsSync(path.dirname(data.dest))) {
              try {
                  mkdirp.sync(path.dirname(data.dest), { mode: 0o755 });
              } catch (err) {
      Severity: Minor
      Found in plugins/formats/write/file_system_writer.js - 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 title has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          get title() {
              // Try to get the name of the file that was created or uploaded.
              var name = null;
              if (!name && this.packageOp && this.packageOp.packageName) {
                  name = path.basename(this.packageOp.packageName);
      Severity: Minor
      Found in core/job.js - 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 uploadAttempted has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          uploadAttempted() {
              if (this.uploadOps) {
                  for (let op of this.uploadOps) {
                      for (let result of op.results) {
                          if (result.attempt > 0) {
      Severity: Minor
      Found in core/job.js - 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 writeFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function writeFile(data, done) {
          try {
              var reader = fs.createReadStream(data.bagItFile.absSourcePath);
      
              reader.on('error', function(err) {
      Severity: Minor
      Found in plugins/formats/write/tar_writer.js - About 1 hr to fix

        Function _validateSerialization has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _validateSerialization() {
                var validFormat = true;
                if (!this.disableSerializationCheck) {
                    var checkSerializationFormat = true;
                    var bagIsDirectory = fs.statSync(this.pathToBag).isDirectory();
        Severity: Minor
        Found in bagit/validator.js - About 1 hr to fix

          Function _init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _init() {
                  var profiles = BagItProfile.list(null, {
                      limit: 0,
                      offset: 0,
                      orderBy: 'name',
          Severity: Minor
          Found in ui/forms/new_bagit_profile_form.js - About 1 hr to fix

            Function _processResponses has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _processResponses(controller) {
                    let form = new SettingsResponseForm(importedSettings);
                    let responses = form.getResponses();
                    let hasEmptyAnswers = false;
                    let errors = '';
            Severity: Minor
            Found in ui/controllers/settings_controller.js - About 1 hr to fix

              Function _validatePayloadOxum has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _validatePayloadOxum() {
                      //Context.logger.info(`Validator: Validating Payload-Oxum in ${this.pathToBag}`);
                      let found = false;
                      let bagInfo = this.files["bag-info.txt"];
                      if (bagInfo && bagInfo.keyValueCollection) {
              Severity: Minor
              Found in bagit/validator.js - About 1 hr to fix

                Function list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    list() {
                        var fsReader = this;
                        var stream = readdirp(fsReader.pathToDirectory, OPTS);
                        fsReader.fileCount = 0;
                        fsReader.dirCount = 0;
                Severity: Minor
                Found in plugins/formats/read/file_system_reader.js - About 1 hr to fix

                  Function _ensureDirectories has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _ensureDirectories(fileHeader) {
                          let template =
                          {
                              relDestPath: '',
                              mode: 0o755,
                  Severity: Minor
                  Found in plugins/formats/write/tar_writer.js - About 1 hr to fix

                    Function read has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        read() {
                            var tarReader = this;
                            var extract = tar.extract();
                            tarReader.fileCount = 0;
                            tarReader.dirCount = 0;
                    Severity: Minor
                    Found in plugins/formats/read/tar_reader.js - About 1 hr to fix

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

                          _resetDisplayBeforeValidation() {
                              $('#batchRunning').hide();
                              $('#batchCompleted').hide();
                              $('#workflowResults').hide();
                          }
                      Severity: Minor
                      Found in ui/controllers/workflow_batch_controller.js and 1 other location - About 55 mins to fix
                      ui/controllers/workflow_batch_controller.js on lines 168..172

                      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 54.

                      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

                          _resetDisplayBeforeRunning() {
                              $('#batchRunning').show();
                              $('#workflowResults').show();
                              $('div.batch-result').remove();
                          }
                      Severity: Minor
                      Found in ui/controllers/workflow_batch_controller.js and 1 other location - About 55 mins to fix
                      ui/controllers/workflow_batch_controller.js on lines 157..161

                      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 54.

                      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

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

                          _readEntry(entry) {
                              let validator = this;
                              if (entry.fileStat.isFile()) {
                                  var bagItFile = this._addBagItFile(entry);
                                  if (Context.slowMotionDelay > 0) {
                      Severity: Minor
                      Found in bagit/validator.js - 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 renderPackageInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          renderPackageInfo(data, dartProcess) {
                              let [detailDiv, progressBar] = this.getDivs(dartProcess, 'packageInfo');
                              if (data.action == 'fileAdded') {
                                  let shortName = Util.trimToLength(data.msg, 80, 'middle');
                                  detailDiv.text(Context.y18n.__('Added file %s', shortName));
                      Severity: Minor
                      Found in ui/controllers/running_jobs_controller.js - 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

                      Severity
                      Category
                      Status
                      Source
                      Language