APTrust/dart

View on GitHub

Showing 166 of 237 total issues

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

                provider.on('start', function(result) {
                    // Note: percentComplete is -1 because we don't
                    // yet have a way of getting that info.
                    uploader.info('start',
                                  Constants.OP_IN_PROGRESS,
Severity: Minor
Found in workers/uploader.js and 1 other location - About 35 mins to fix
workers/uploader.js on lines 119..124

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

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

                provider.on('warning', function(result) {
                    // Note: percentComplete is -1 because we don't
                    // yet have a way of getting that info.
                    uploader.info('upload', Constants.OP_IN_PROGRESS,
                                  result.warning, -1, false);
Severity: Minor
Found in workers/uploader.js and 1 other location - About 35 mins to fix
workers/uploader.js on lines 91..99

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

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

        if (Util.isEmptyStringArray(this.acceptBagItVersion)) {
            this.errors["acceptBagItVersion"] = Context.y18n.__("Profile must accept at least one BagIt version.");
        }
Severity: Minor
Found in bagit/bagit_profile.js and 1 other location - About 35 mins to fix
bagit/bagit_profile.js on lines 266..268

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

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

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

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

                for (let sourceFile of this.sourceFiles) {
                    if (!fs.existsSync(sourceFile)) {
                        missingFiles.push(sourceFile);
                    }
                }
        Severity: Minor
        Found in core/upload_operation.js and 1 other location - About 30 mins to fix
        core/package_operation.js on lines 184..188

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

        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

                    } else {
                        $("#btnToggleHidden").text(showAll);
                        $('.what-is-showing i').text(
                            Context.y18n.__('Tags with default values are not showing.')
                        );
        Severity: Minor
        Found in ui/controllers/job_metadata_controller.js and 1 other location - About 30 mins to fix
        ui/controllers/job_metadata_controller.js on lines 168..173

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

        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

        marked Regular Expression Denial of Service
        Open

                "marked": {
                    "version": "4.0.16",
                    "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.16.tgz",
                    "integrity": "sha512-wahonIQ5Jnyatt2fn8KqF/nIqZM8mh3oRu2+l5EANGMhu6RFjiSG52QNE2eWzFMI94HqYSgN184NurgNG6CztA==",
                    "dev": true
        Severity: Minor
        Found in package-lock.json by nodesecurity

        Regular Expression Denial of Service

        Overview:

        The marked module is vulnerable to a regular expression denial of service. Based on the information published in the public issue, 1k characters can block for around 6 seconds.

        Recommendation:

        Consider another markdown parser until the issue can be addressed.

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

                for (let sourceFile of this.sourceFiles) {
                    if (!fs.existsSync(sourceFile)) {
                        missingFiles.push(sourceFile);
                    }
                }
        Severity: Minor
        Found in core/package_operation.js and 1 other location - About 30 mins to fix
        core/upload_operation.js on lines 75..79

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

        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

                    if (currentText == showAll) {
                        $("#btnToggleHidden").text(hideDefaults);
                        $('.what-is-showing i').text(
                            Context.y18n.__('Showing all tags.')
                        );
        Severity: Minor
        Found in ui/controllers/job_metadata_controller.js and 1 other location - About 30 mins to fix
        ui/controllers/job_metadata_controller.js on lines 173..178

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

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

        Severity
        Category
        Status
        Source
        Language