partkeepr/PartKeepr

View on GitHub
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js

Summary

Maintainability
F
3 days
Test Coverage

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

    initComponent: function ()
    {

        this.subGrid = {
            xtype: 'gridfoo',

    File ProjectReportResultGrid.js has 471 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    Ext.define("PartKeepr.Components.Project.ProjectReportResultGrid", {
        extend: "PartKeepr.BaseGrid",
    
        features: [
            {

      Function getCheapestDistributor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          getCheapestDistributor: function (part)
          {
              var cheapestDistributor = null;
              var currentPrice;
              var activeDistributor;

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

          getCheapestDistributor: function (part)
          {
              var cheapestDistributor = null;
              var currentPrice;
              var activeDistributor;

        Function removeStocks has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            removeStocks: function (btn)
            {
                if (btn === "yes")
                {
        
        

          Function onEdit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              onEdit: function (editor, context)
              {
                  if (context.field === "distributor" && context.record.getDistributor() !== null)
                  {
                      var partDistributors = context.record.getPart().distributors();

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

              onBeforeEdit: function (e, context)
              {
                  if (context.field !== "distributor")
                  {
                      return;

          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 5 locations. Consider refactoring.
          Open

                  this.removeStockButton = Ext.create('Ext.button.Button', {
                      text: i18n("Remove parts from stock"),
                      iconCls: 'fugue-icon notification-counter-03',
                      listeners: {
                          click: this.onStockRemovalClick,
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 130..137
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 139..146
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 157..164
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 166..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 55.

          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 5 locations. Consider refactoring.
          Open

                  this.nextMetaPart = Ext.create("Ext.button.Button", {
                      text: i18n("Next Meta-Part"),
                      iconCls: 'partkeepr-icon bricks_down',
                      listeners: {
                          click: this.jumpToNextMetaPart,
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 139..146
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 148..155
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 157..164
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 166..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 55.

          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 5 locations. Consider refactoring.
          Open

                  this.previousMetaPart = Ext.create("Ext.button.Button", {
                      text: i18n("Previous Meta-Part"),
                      iconCls: 'partkeepr-icon bricks_up',
                      listeners: {
                          click: this.jumpToPreviousMetaPart,
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 130..137
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 148..155
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 157..164
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 166..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 55.

          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 5 locations. Consider refactoring.
          Open

                  this.saveReportButton = Ext.create('Ext.button.Button', {
                      text: i18n("Save Project Report"),
                      iconCls: 'fugue-icon notification-counter-04',
                      listeners: {
                          click: this.onSaveReportClick,
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 130..137
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 139..146
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 148..155
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 166..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 55.

          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 5 locations. Consider refactoring.
          Open

                  this.autoFillButton = Ext.create('Ext.button.Button', {
                      text: i18n("Auto-Fill Distributors"),
                      iconCls: 'fugue-icon notification-counter-02',
                      listeners: {
                          click: this.onAutoFillClick,
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 130..137
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 139..146
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 148..155
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 157..164

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

          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

                      }, {
                          header: i18n("Sum (Order)"),
                          dataIndex: 'orderSum',
                          renderers: [{
                              rtype: 'currency'
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 100..109

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

          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

                      }, {
                          header: i18n("Sum"),
                          dataIndex: 'itemSum',
                          renderers: [{
                              rtype: 'currency'
          src/PartKeepr/FrontendBundle/Resources/public/js/Components/Project/ProjectReportResultGrid.js on lines 118..127

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

          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