partkeepr/PartKeepr

View on GitHub

Showing 922 of 922 total issues

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

        this.storageLocationFilterCheckbox = Ext.create("Ext.form.field.Checkbox", {
            width: "20px",
            listeners: {
                change: function (obj, value)
                {
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js on lines 746..758
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js on lines 802..813
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartFilterPanel.js on lines 858..869

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

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

    loadStats: function ()
    {
        var options = {
            url: PartKeepr.getBasePath() + "/api/statistics/current",
            method: "GET",
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Statistics/StatisticsChartPanel.js on lines 39..48

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

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

    reloadDates: function ()
    {
        var options = {
            url: PartKeepr.getBasePath() + "/api/statistics/range",
            method: "GET",
src/PartKeepr/FrontendBundle/Resources/public/js/Components/Statistics/SummaryStatisticsPanel.js on lines 86..95

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

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

    initComponent: function ()
    {
        var modelFieldSelector = Ext.create({
            xtype: 'modelFieldSelector',
            border: false,

    Function applyColumnConfigurationFromGrid has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        applyColumnConfigurationFromGrid: function ()
        {
            var columns = this.grid.getColumns();
            var i, j;
            var columnRecord;

      Function exportGrid has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          exportGrid: function ()
          {
              var columns = this.gridPanel.getColumns();
      
              var store = this.gridPanel.getStore();

        Function getPagingItems has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getPagingItems: function ()
            {
                var items = this.callParent(arguments);
        
                items.push({ xtype: 'tbseparator' });

          Function _showException has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _showException: function (exception, response)
              {
                  var separator = "==================================";
          
                  this.messageDiv.update('<strong>' + exception.getTitle() + '</strong>');

            Method authenticate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function authenticate(TokenInterface $token)
                {
                    $lastException = null;
                    $result = null;
            
            

              Method getSampledStatistics has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getSampledStatistics(\DateTime $startDate, \DateTime $endDate, $sampleSize = 25)
                  {
                      if ($startDate->getTimestamp() > $endDate->getTimestamp()) {
                          // Swap both times
                          list($startDate, $endDate) = [$endDate, $startDate];
              Severity: Minor
              Found in src/PartKeepr/StatisticBundle/Services/StatisticService.php - About 1 hr to fix

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

                        this.password = Ext.create("Ext.form.field.Text", {
                            fieldLabel: 'Database Password',
                            inputType: "password",
                            labelWidth: this.defaults.labelWidth,
                            value: PartKeeprSetup.getApplication().getSetupConfig().values.database_password
                Severity: Major
                Found in web/setup/js/Cards/DatabaseParametersCard.MySQL.js and 1 other location - About 1 hr to fix
                web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 47..52

                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

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

                        this.password = Ext.create("Ext.form.field.Text", {
                            fieldLabel: 'Database Password',
                            inputType: "password",
                            labelWidth: this.defaults.labelWidth,
                            value: PartKeeprSetup.getApplication().getSetupConfig().values.database_password
                Severity: Major
                Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 1 other location - About 1 hr to fix
                web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 45..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 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

                    _updateDeleteButton: function () {
                        /* Right now, we support delete on a single record only */
                        if (this.getSelectionModel().getCount() == 1)
                        {
                            this.deleteButton.enable();
                src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js on lines 221..229

                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

                    _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

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

                    initComponent: function ()
                    {
                        this.callParent(arguments);
                
                        this.down("#grid").setTitle(i18n("Preview"));

                  Function seed has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function seed(s) {
                      var a, b, c, d, e, f, g, h, i;
                  
                      /* seeding the seeds of love */
                      a = b = c = d =

                    Method intMigrateFilesAction has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function intMigrateFilesAction(Request $request)
                        {
                            if (!$this->ensureAuthKey($request)) {
                                return $this->getAuthKeyErrorResponse();
                            }
                    Severity: Minor
                    Found in src/PartKeepr/SetupBundle/Controller/FileMigrationController.php - About 1 hr to fix

                      Method getConfigTreeBuilder has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getConfigTreeBuilder()
                          {
                              $treeBuilder = new TreeBuilder();
                              $rootNode = $treeBuilder->root('partkeepr');
                      
                      
                      Severity: Minor
                      Found in src/PartKeepr/CoreBundle/DependencyInjection/Configuration.php - About 1 hr to fix

                        Function onBeforeEdit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            onBeforeEdit: function (editor, context, eOpts) {
                                var sameUser = false;
                        
                                // Checks if the usernames match
                                if (context.record.getUser() !== null) {

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

                            onDataLoaded: function ()
                            {
                                if (this.searchStore.getCount() === 0) {
                                    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

                        Severity
                        Category
                        Status
                        Source
                        Language