APTrust/dart

View on GitHub

Showing 166 of 237 total issues

Function profileToStandardObject has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static profileToStandardObject(p) {
        var obj = {};
        obj["Accept-BagIt-Version"] = p.acceptBagItVersion;
        obj["Accept-Serialization"] = p.acceptSerialization;
        obj["Allow-Fetch.txt"] = p.allowFetchTxt;
Severity: Minor
Found in bagit/bagit_util.js - About 1 hr to fix

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

        $('#container').on('click', 'table tr.repository-clickable-row', function(e) {
            let url = $(this).data('url');
            electron.shell.openExternal(url);
            e.stopPropagation();
        });
    Severity: Major
    Found in ui/application.js and 1 other location - About 1 hr to fix
    ui/application.js on lines 56..60

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

    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

        $('#container').on('click', 'div.local-file', function(e) {
            let uri = $(this).data('url');
            electron.shell.showItemInFolder(uri);
            e.stopPropagation();
        })
    Severity: Major
    Found in ui/application.js and 1 other location - About 1 hr to fix
    ui/application.js on lines 40..44

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

    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 create has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async create() {
            var packOp = this.job.packageOp;
            this.emit('packageStart', `Starting to build ${packOp.packageName}`);
            packOp.result = new OperationResult('bagging', 'DART bagger');
            packOp.result.filepath = packOp.outputPath;
    Severity: Minor
    Found in bagit/bagger.js - About 1 hr to fix

      Function run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          run() {
              var bagValidator = this;
              this.initOpResult();
      
              // Return a failed promise if we get invalid params.
      Severity: Minor
      Found in workers/bag_validator.js - About 1 hr to fix

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

            read() {
                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

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

                  $('#dropZone').on('dragleave', function(e) {
                      e.preventDefault();
                      e.stopPropagation();
                      $(e.currentTarget).removeClass('drop-zone-over');
                      return false;
          Severity: Major
          Found in ui/controllers/job_files_controller.js and 2 other locations - About 1 hr to fix
          ui/controllers/job_files_controller.js on lines 89..94
          ui/controllers/job_files_controller.js on lines 101..106

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

          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 3 locations. Consider refactoring.
          Open

                  $('#dropZone').on('dragover', function(e) {
                      e.preventDefault();
                      e.stopPropagation();
                      $(e.currentTarget).addClass('drop-zone-over');
                      return false;
          Severity: Major
          Found in ui/controllers/job_files_controller.js and 2 other locations - About 1 hr to fix
          ui/controllers/job_files_controller.js on lines 95..100
          ui/controllers/job_files_controller.js on lines 101..106

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

          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 3 locations. Consider refactoring.
          Open

                  $('#dropZone').on('dragend', function(e) {
                      e.preventDefault();
                      e.stopPropagation();
                      $(e.currentTarget).removeClass('drop-zone-over');
                      return false;
          Severity: Major
          Found in ui/controllers/job_files_controller.js and 2 other locations - About 1 hr to fix
          ui/controllers/job_files_controller.js on lines 89..94
          ui/controllers/job_files_controller.js on lines 95..100

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

          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 _setBagInfoAutoValues has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _setBagInfoAutoValues() {
                  var profile = this.job.bagItProfile;
                  var baggingDate = profile.firstMatchingTag('tagName', 'Bagging-Date');
                  if (baggingDate) {
                      baggingDate.userValue = dateFormat(Date.now(), 'isoUtcDateTime');
          Severity: Minor
          Found in bagit/bagger.js - About 1 hr to fix

            Function promise has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        var promise = new Promise(function(resolve, reject) {
                            let lastPercentComplete = 0;
                            provider.on('start', function(result) {
                                // Note: percentComplete is -1 because we don't
                                // yet have a way of getting that info.
            Severity: Minor
            Found in workers/uploader.js - About 1 hr to fix

              Function constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  constructor(bagItFile) {
                      /**
                        * bagItFile is the file that will be parsed.
                        * When parsing is complete, bagItFile.keyValueCollection
                        * will be populated with tag names and values.
              Severity: Minor
              Found in bagit/tag_file_parser.js - About 1 hr to fix

                Function uploadFiles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    async uploadFiles() {
                        // TODO: Retry those that failed due to non-fatal error.
                        let returnCode = Constants.EXIT_SUCCESS;
                        if (this.job.uploadOps.length > 0) {
                            this.assignUploadSources();
                Severity: Minor
                Found in workers/job_runner.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 _listBagItSerializations has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    _listBagItSerializations() {
                        let none = Context.y18n.__('None');
                        let formats = [{ id: '', name: none }];
                        let profile = null;
                        if (this.fields.bagItProfileId.value) {
                Severity: Minor
                Found in ui/forms/job_package_op_form.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 _writeManifests has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    async _writeManifests(payloadOrTag) {
                        var profile = this.job.bagItProfile;
                        var manifestAlgs = profile.chooseManifestAlgorithms('manifest');
                        var fileNamePrefix = 'manifest';
                        if (payloadOrTag == 'tag') {
                Severity: Minor
                Found in bagit/bagger.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 add has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    add(bagItFile, cryptoHashes = []) {
                        super.add(bagItFile, cryptoHashes);
                        var tarWriter = this;
                        var header = {
                            // Don't use path.join because Windows will give us
                Severity: Minor
                Found in plugins/formats/write/tar_writer.js - About 1 hr to fix

                  Function _writeIntoArchive has 34 lines of code (exceeds 25 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

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

                        _mkdir(bagItFile) {
                            var tarWriter = this;
                            var header = {
                                name: bagItFile.relDestPath,
                                type: 'directory',
                    Severity: Minor
                    Found in plugins/formats/write/tar_writer.js - About 1 hr to fix

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

                          runJob(jobParams, lineNumber, lastJobNumber) {
                              let controller = this;
                              return new Promise((resolve, reject) => {
                                  let job = jobParams.toJob();
                                  // validate job?
                      Severity: Minor
                      Found in ui/controllers/workflow_batch_controller.js - About 1 hr to fix

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

                            try {
                                _writeIntoArchive(data, done);
                            } catch (err) {
                                Context.logger.error(err);
                                Context.logger.error(err.stack);
                        Severity: Major
                        Found in plugins/formats/write/file_system_writer.js and 1 other location - About 1 hr to fix
                        plugins/formats/write/tar_writer.js on lines 338..369

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language