APTrust/dart

View on GitHub

Showing 103 of 237 total issues

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

      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

                    Function _upload has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _upload(xfer) {
                            var s3Client = this;
                            var minioClient = s3Client._getClient();
                            // Metadata works with fPutObject, but not with putObject,
                            // so this is commented out for now. We can delete it if we
                    Severity: Minor
                    Found in plugins/network/s3_client.js - About 1 hr to fix

                      Function postRenderCallback has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          postRenderCallback(fnName) {
                              let controller = this;
                              $('#pathToBag').on('change',function(e){
                                  let element = document.getElementById('pathToBag');
                                  if (element && element.files && element.files[0]) {
                      Severity: Minor
                      Found in ui/controllers/bag_validation_controller.js - About 1 hr to fix

                        Function parseFromDOM has a Cognitive Complexity of 11 (exceeds 5 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

                        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 _mergeTagSet has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            _mergeTagSet(bagItProfile, tags, profileTags) {
                                let firstInstanceOfTag = null;
                                for (let i = 0; i < tags.length; i++) {
                                    let tag = tags[i];
                                    if (profileTags.length > i) {
                        Severity: Minor
                        Found in core/job_params.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 guessProfileType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            static guessProfileType(obj) {
                                let type = 'unknown';
                                if (Array.isArray(obj['tags'])) {
                                    type = 'dart';
                                } else if (Array.isArray(obj['ordered'])) {
                        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 _setBagInfoAutoValues has a Cognitive Complexity of 11 (exceeds 5 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

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

                            validateParams() {
                                let errors = [];
                                for (let op of this.job.uploadOps) {
                                    let opErrors = []
                                    if (Util.isEmpty(op.storageServiceId)) {
                        Severity: Minor
                        Found in workers/uploader.js - About 1 hr to fix

                          Function constructor has 31 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 relative file paths and
                          Severity: Minor
                          Found in bagit/manifest_parser.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language