partkeepr/PartKeepr

View on GitHub
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js

Summary

Maintainability
F
3 days
Test Coverage

File PartsGrid.js has 456 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This class is the main part list grid.
 *
 */
Ext.define('PartKeepr.PartsGrid', {

    Function initComponent has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        initComponent: function ()
        {
    
            this.groupingFeature = Ext.create('Ext.grid.feature.Grouping', {
                //enableGroupingMenu: false,

      Function defineColumns has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          defineColumns: function ()
          {
              this.columns = [
                  {
                      header: '<span class="web-icon fugue-icon paper-clip"></span>',

        Function confirmStockChange has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            confirmStockChange: function (e)
            {
                var mode = this.getStockChangeMode(e.value);
                var value = Math.abs(parseInt(e.value));
                var confirmText = "";

          Function onAddParameterFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              onAddParameterFilter: function (rec) {
                  var subFilters = [];
          
          
                  subFilters.push( Ext.create("PartKeepr.util.Filter", {

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

                addParameterFilter: function () {
                    this.addFilterWindow = Ext.create("PartKeepr.Components.Widgets.PartParameterSearchWindow", {
            
                        sourceModel: this.getStore().getModel(),
                        listeners: {
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/PagingToolbar.js on lines 64..75

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

            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

                _updateAddTemplateButton: function ()
                {
                    /* Right now, we support delete on a single record only */
                    if (this.getSelectionModel().getCount() === 1) {
                        this.addFromTemplateButton.enable();
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/EditorGrid.js on lines 305..314

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

            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

                    this.bottomToolbar.add({
                        xtype: 'button',
                        tooltip: i18n("Expand all Groups"),
                        iconCls: this.expandRowButtonIconCls,
                        listeners: {
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 116..125

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

            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

                    this.bottomToolbar.add({
                        xtype: 'button',
                        tooltip: i18n("Collapse all Groups"),
                        iconCls: this.collapseRowButtonIconCls,
                        listeners: {
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 105..114

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

            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

                        }, {
                            text: '<span class="web-icon flag_orange"></span>',
                            dataIndex: "needsReview",
                            width: 30,
                            tooltip: i18n("Needs Review?"),
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 280..291

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

            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

                        }, {
                            text: '<span class="web-icon bricks"></span>',
                            dataIndex: "metaPart",
                            width: 30,
                            tooltip: i18n("Meta Part"),
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 269..280

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

            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

                            confirmText = sprintf(
                                i18n("You wish to add  <b>%s %s</b> of part <b>%s</b>. Is this correct?"),
                                value, e.record.getPartUnit().get("name"), e.record.get("name"));
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 524..526

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

            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

                            confirmText = sprintf(
                                i18n("You wish to set the stock level to <b>%s %s</b> for part <b>%s</b>. Is this correct?"),
                                value, e.record.getPartUnit().get("name"), e.record.get("name"));
            src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 516..518

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

            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