APTrust/dart

View on GitHub

Showing 103 of 237 total issues

Function _processResponses has a Cognitive Complexity of 7 (exceeds 5 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 35 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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(opts = {}) {
        /**
          * The unique identifier for this TagDefinition.
          * This is a version 4 UUID in hex string format.
          *
Severity: Minor
Found in bagit/tag_definition.js - About 35 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    validate() {
        super.validate();
        if (this.packageOp) {
            this.packageOp.validate();
            Object.assign(this.errors, this.packageOp.errors);
Severity: Minor
Found in core/job.js - About 35 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    validate() {
        this.errors = {};
        if (!Util.looksLikeUUID(this.storageServiceId)) {
            this.errors['UploadOperation.storageServiceId'] = Context.y18n.__('You must specify a storage service.');
        }
Severity: Minor
Found in core/upload_operation.js - About 35 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 postRenderCallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    postRenderCallback(fnName) {
        let controller = this;
        if (fnName == 'import') {
            this._attachImportHandlers();
        } else if (fnName == 'export') {
Severity: Minor
Found in ui/controllers/settings_controller.js - About 35 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

Avoid too many return statements within this function.
Open

        return [ allowed[0] ];
Severity: Major
Found in bagit/bagit_profile.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return true;
    Severity: Major
    Found in core/util.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return obj[this.field] || "";
      Severity: Major
      Found in core/export_question.js - About 30 mins to fix

        Function run has a Cognitive Complexity of 6 (exceeds 5 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 25 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 initProgressBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            initProgressBar(dartProcess, section) {
                let [_, progressBar] = this.getDivs(dartProcess, section);
                if (progressBar) {
                    progressBar.removeClass("bg-success");
                    progressBar.removeClass("bg-danger");
        Severity: Minor
        Found in ui/controllers/running_jobs_controller.js - About 25 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 inflateFrom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            static inflateFrom(data) {
                let job = new Job();
                Object.assign(job, data);
                if (data.bagItProfile) {
                    job.bagItProfile = BagItProfile.inflateFrom(data.bagItProfile);
        Severity: Minor
        Found in core/job.js - About 25 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 _makeUploadOps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _makeUploadOps(job) {
                if (!this._workflowObj.storageServiceIds || this._workflowObj.storageServiceIds.length == 0) {
                    // No storage services specified, so no uploads to perform.
                    return;
                }
        Severity: Minor
        Found in core/job_params.js - About 25 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 _jsonFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _jsonFilter(key, value) {
                let unsafe = ['login', 'password', 'userId', 'apiToken']
                if (unsafe.includes(key)) {
                    if (!value.startsWith('env:')) {
                        value = '';
        Severity: Minor
        Found in core/export_settings.js - About 25 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 _getPageLevelErrors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _getPageLevelErrors(profile) {
                let errors = [];
                if (!Util.isEmpty(profile.errors["name"])) {
                    errors.push(Context.y18n.__("About Tab: %s", profile.errors["name"]));
                }
        Severity: Minor
        Found in ui/controllers/bagit_profile_controller.js - About 25 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 _importProfileObject has a Cognitive Complexity of 6 (exceeds 5 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 25 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 pruneSourceFilesUnlessJobCompleted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            pruneSourceFilesUnlessJobCompleted() {
                if (this.result && this.result.succeeded()) {
                    return;
                }
                if (this.sourceFiles.length == 0) {
        Severity: Minor
        Found in core/package_operation.js - About 25 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 copyResponseToObject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            copyResponseToObject(response) {
                let classToSet = this.getTargetClass();
                if (classToSet == null) {
                    throw Context.y18n.__("Response must be assigned to an object");
                }
        Severity: Minor
        Found in core/export_question.js - About 25 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 checkPaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            checkPaths(jobParamsArray) {
                let lineNumber = 2;
                for (let params of jobParamsArray) {
                    for (let filePath of params.files) {
                        if (!fs.existsSync(filePath)) {
        Severity: Minor
        Found in core/workflow_batch.js - About 25 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 renderUploadInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            renderUploadInfo(data, dartProcess) {
                let [detailDiv, progressBar] = this.getDivs(dartProcess, 'uploadInfo');
                if (data.action == 'start') {
                    detailDiv.text(data.msg);
                    // We can have multiple uploads, so we re-initialize the
        Severity: Minor
        Found in ui/controllers/running_jobs_controller.js - About 25 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 _validateNoExtraneousPayloadFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            _validateNoExtraneousPayloadFiles() {
                //Context.logger.info(`Validator: Looking for extraneous payload files in ${this.pathToBag}`);
                for(var manifest of this.payloadManifests()) {
                    for (var f of this.payloadFiles()) {
                        if (!manifest.keyValueCollection.first(f.relDestPath)) {
        Severity: Minor
        Found in bagit/validator.js - About 25 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