SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.js/src/js/app/app.table.js

Summary

Maintainability
F
5 days
Test Coverage

File app.table.js has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*

version: 1.0.0
author: sascha obermüller
date: 07.12.2020
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 6 hrs to fix

Function addRow has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    addRow( rowIndex, rowData, tableData, isMainTable, isEdit) {
        
        let O = this;
        tableData = O._tableData
        // row
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 3 hrs to fix

Function _createTableHead has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _createTableHead(cols) {
        let O = this;
        _log('TABLE / _createTableHead');
        // thead
        let $thead = $('<thead></thead>');
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 2 hrs to fix

Function _create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    async _create() {
        let O = this;
        _log('TABLE / _create', 'primary');

        // current state of view
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.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 _create has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async _create() {
        let O = this;
        _log('TABLE / _create', 'primary');

        // current state of view
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 1 hr to fix

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

    constructor(settings, $container, metadata, uploadDates, executionTimes) {
        let O = this;
        O._$container = $container;
        O._$wrapper = null;
        O.totalRows = 0;
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 1 hr to fix

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

    _updateOrder($th) {
        let O = this;
        _log('TABLE / _updateOrder');

        let field = $th.data('field');
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 1 hr to fix

Function _createTableToolbar has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _createTableToolbar() {
        let O = this;
        _log('TABLE / _createTableToolbar');

        if (O.opts.showToggle || O.opts.showColumns) {
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 1 hr to fix

Function _updateOrder has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    _updateOrder($th) {
        let O = this;
        _log('TABLE / _updateOrder');

        let field = $th.data('field');
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.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 _createTableToolbar has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    _createTableToolbar() {
        let O = this;
        _log('TABLE / _createTableToolbar');

        if (O.opts.showToggle || O.opts.showColumns) {
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 55 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 _handleRowSelect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    _handleRowSelect($tr) {
        let O = this;
        // rows selectable and tr exists
        if (O.opts.rowSelectable && $tr) {
            // get current state
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js - About 55 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 addRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    addRow( rowIndex, rowData, tableData, isMainTable, isEdit) {
        
        let O = this;
        tableData = O._tableData
        // row
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.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

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

    _selectRow($tr) {
        let O = this;
        _log('TABLE / _selectRow : ' + $tr.data('row-id'));

        if ($tr) {
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 6 hrs to fix
de.bund.bfr.knime.js/src/js/app/app.table.js on lines 632..650

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

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

    _deselectRow($tr) {
        let O = this;
        _log('TABLE / _deselectRow : ' + $tr.data('row-id'));

        if ($tr) {
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 6 hrs to fix
de.bund.bfr.knime.js/src/js/app/app.table.js on lines 606..623

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

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 (O._view == 'default') {
            O._view = 'card';
            O._$table.addClass('table-view-card');
            // update toggles class
            O._$toolbar._$btnToggleView
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 1 hr to fix
de.bund.bfr.knime.js/src/js/app/app.table.js on lines 557..564

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

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 ($.isFunction(O.opts.on.afterPopulate)) {
            O.opts.on.afterPopulate.call(O, O, O._tableData);
        }
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 1 hr to fix
de.bund.bfr.knime.js/src/js/app/app.table.mt.js on lines 592..594

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

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 {
            O._view = 'default';
            O._$table.removeClass('table-view-card');
            // update toggles class
            O._$toolbar._$btnToggleView
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 1 hr to fix
de.bund.bfr.knime.js/src/js/app/app.table.js on lines 548..555

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

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

        if ($.isFunction(O.opts.on.afterInit)) {
            O.opts.on.afterInit.call(O, O);
        }
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 2 other locations - About 55 mins to fix
de.bund.bfr.knime.js/src/js/app/app.table.js on lines 216..218
de.bund.bfr.knime.js/src/js/app/app.table.mt.js on lines 63..65

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

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

        if ($.isFunction(O.opts.on.create)) {
            O.opts.on.create.call(O, O);
        }
Severity: Major
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 2 other locations - About 55 mins to fix
de.bund.bfr.knime.js/src/js/app/app.table.js on lines 46..48
de.bund.bfr.knime.js/src/js/app/app.table.mt.js on lines 63..65

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

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

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

            $.each(O.opts.attributes, (attr, val) => {
                O._$table.attr(attr, val);
            });
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 40 mins to fix
de.bund.bfr.knime.js/src/js/app/app.table.mt.js on lines 96..98

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

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

                O._$toolbar._$btnToggleView = $('<button class="btn btn-outline-secondary btn-sm btn-icon toggle-card" type="button"><i class="feather icon-pause"></i></button>')
                    .attr('aria-label', 'Toggle view')
                    .attr('title', 'Toggle view')
                    .attr('data-tooltip', '')
                    .attr('data-toggle-table-view', '')
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 35 mins to fix
de.bund.bfr.knime.js/src/js/app/app.editable.mt.Dialog.js on lines 87..92

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

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

                col.classes && col.classes.th ? $th.addClass(col.classes.th) : null; // classes
Severity: Minor
Found in de.bund.bfr.knime.js/src/js/app/app.table.js and 1 other location - About 30 mins to fix
de.bund.bfr.knime.js/src/js/app/app.ui.js on lines 50..50

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

There are no issues that match your filters.

Category
Status