APTrust/dart

View on GitHub

Showing 103 of 237 total issues

Function upload has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    upload(filepathOrBuffer, keyname) {
        let sftp = this;
        if (!filepathOrBuffer) {
            throw new Error('Param filepathOrBuffer is required for upload.');
        }
Severity: Major
Found in plugins/network/sftp_client.js - About 2 hrs to fix

    Function _checkTagsRequiredByProfile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        _checkTagsRequiredByProfile(profile, jobParamsArray) {
            // Get a list of required tags whose values must appear in the CSV file.
            for (let i=0; i < jobParamsArray.length; i++) {
                let params = jobParamsArray[i];
                for (let tag of profile.tags) {
    Severity: Minor
    Found in core/workflow_batch.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

    BagItProfileController has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BagItProfileController extends BaseController {
    
        constructor(params) {
            super(params, 'Settings');
            /**
    Severity: Minor
    Found in ui/controllers/bagit_profile_controller.js - About 2 hrs to fix

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

          doUpload(uploadOp) {
              let uploader = this;
              // Clear prior upload results. They may cause the UI to
              // report successful upload as failed, or vice-versa.
              uploadOp.results = [];
      Severity: Major
      Found in workers/uploader.js - About 2 hrs to fix

        Function _validateSerialization has a Cognitive Complexity of 17 (exceeds 5 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 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 validateParams has a Cognitive Complexity of 16 (exceeds 5 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 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 colorCodeJobs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            colorCodeJobs(jobs) {
                // TODO: This code has some overlap with DashboardController#formatJobOutcome.
                for(let i=0; i < jobs.length; i++) {
                    let job = Job.inflateFrom(jobs[i]);
                    job.pkgDate = '-';
        Severity: Minor
        Found in ui/controllers/job_controller.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 _validateAllowedTagFiles has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            _validateAllowedTagFiles() {
                let allowed = this.profile.tagFilesAllowed || [];
                let tagFiles = this.tagFiles();
                for (let file of tagFiles) {
                    if (file.relDestPath == 'bagit.txt') {
        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 profileFromStandardObject has 44 lines of code (exceeds 25 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

          Function _addObjType has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _addObjType() {
                  let objType = `objType_${this.rowCount}`
                  let question = this.obj.questions[this.rowCount];
                  let value = question ? question.objType : "";
                  this.fields[objType] = new Field(
          Severity: Minor
          Found in ui/forms/settings_questions_form.js - About 1 hr to fix

            Function _validateTagsInFile has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                _validateTagsInFile(filename, tagFile) {
                    var requiredTags = this.profile.tagsGroupedByFile();
                    for (var tagDef of requiredTags[filename]) {
                        var parsedTagValues = tagFile.keyValueCollection.all(tagDef.tagName);
                        if (parsedTagValues == null) {
            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 uploadSucceeded has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                uploadSucceeded() {
                    let anyAttempted = false;
                    let allSucceeded = true;
                    if (this.uploadOps) {
                        for (let op of this.uploadOps) {
            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 run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                run() {
                    var creator = this;
                    if (!this.job.packageOp.validate()) {
                        return new Promise(function(resolve, reject) {
                            let errors = Object.values(creator.job.packageOp.errors);
            Severity: Minor
            Found in workers/bag_creator.js - About 1 hr to fix

              Function _importProfileObject has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _importProfileObject(json, profileUrl) {
                      let obj;
                      try {
                          obj = JSON.parse(json);
                      } catch (ex) {
              Severity: Minor
              Found in ui/controllers/bagit_profile_controller.js - About 1 hr to fix

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

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

                    _updatePackaging(withValidation) {
                        let form = this._parseJobPackagingForm();
                        if (withValidation) {
                            if (this.job.packageOp.packageFormat == Context.y18n.__('Choose One')) {
                                form.obj.errors['packageFormat'] = Context.y18n.__("You must specify a package format.");
                Severity: Minor
                Found in ui/controllers/job_packaging_controller.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 _validatePayloadOxum has a Cognitive Complexity of 13 (exceeds 5 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

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

                    attachDragAndDropEvents() {
                        let controller = this;
                        $('#dropZone').on('drop', function(e) {
                            e.preventDefault();
                            e.stopPropagation();
                Severity: Minor
                Found in ui/controllers/job_files_controller.js - About 1 hr to fix

                  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

                    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
                      Severity
                      Category
                      Status
                      Source
                      Language