partkeepr/PartKeepr

View on GitHub

Showing 922 of 922 total issues

Method testSelfChangeUserPassword has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSelfChangeUserPassword()
    {
        $builtinProvider = $this->getContainer()->get('partkeepr.userservice')->getBuiltinProvider();

        $user = new User('bernd2');
Severity: Minor
Found in src/PartKeepr/AuthBundle/Tests/UserTest.php - About 1 hr to fix

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

        isOptional: function (field)
        {
            var fields = PartKeepr.getApplication().getSystemPreference("partkeepr.partManufacturer.requiredFields", []);
    
            if (Ext.Array.contains(fields, field)) {
    src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartEditor.js on lines 520..529

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

    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 (this.record.get("legacy") === true) {
                this.down("#legacyField").setVisible(true);
            } else {
                this.down("#legacyField").setVisible(false);
            }
    src/PartKeepr/FrontendBundle/Resources/public/js/Components/User/UserEditor.js on lines 83..87

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

    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 (this.record.get("protected") === true) {
                this.down("#protectedNotice").setVisible(true);
            } else {
                this.down("#protectedNotice").setVisible(false);
            }
    src/PartKeepr/FrontendBundle/Resources/public/js/Components/User/UserEditor.js on lines 89..93

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

    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 (selected[0].data.data.name === "") {
                        this.down("#configurationCards").setActiveItem(this.down("#importerEntityConfiguration"));
                        this.down("#importerEntityConfiguration").setModel(selected[0].data.data.reference);
                    } else {
    src/PartKeepr/FrontendBundle/Resources/public/js/Components/Importer/Importer.js on lines 320..323

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

    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

        isOptional: function (field)
        {
            var fields = PartKeepr.getApplication().getSystemPreference("partkeepr.part.requiredFields", []);
    
            if (Ext.Array.contains(fields, field)) {
    src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartManufacturerGrid.js on lines 103..112

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

    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 {
                            this.down("#configurationCards").setActiveItem(this.down("#importerManyToOneConfiguration"));
                            this.down("#importerManyToOneConfiguration").setModel(selected[0].data.data.reference);
                        }
    src/PartKeepr/FrontendBundle/Resources/public/js/Components/Importer/Importer.js on lines 314..317

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

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

        initComponent: function ()
        {
            var settings = this.getSettingClasses();
    
            var settingItems = [], item;

      Method recomputeStockLevels has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function recomputeStockLevels()
          {
              $currentStock = 0;
              $avgPrice = 0;
      
      
      Severity: Minor
      Found in src/PartKeepr/PartBundle/Entity/Part.php - About 1 hr to fix

        Function get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            get: function (fieldName)
            {
                var ret, role, item, openingBracket, closingBracket, subEntity, index, subEntityStore;
        
                ret = this.callParent(arguments);
        Severity: Minor
        Found in src/PartKeepr/FrontendBundle/Resources/public/js/Data/HydraModel.js - About 1 hr to fix

          Method parseConfiguration has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parseConfiguration($importConfiguration)
              {
                  if (!property_exists($importConfiguration, "importBehaviour")) {
                      throw new \Exception(sprintf("The key importBehaviour does not exist for path /%s!", implode("/", $this->getPath())));
                  }
          Severity: Minor
          Found in src/PartKeepr/ImportBundle/Configuration/EntityConfiguration.php - About 1 hr to fix

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

                    if (window.parameters.autoLoginUsername) {
                        config.autoLogin = true;
                        config.autoLoginUsername = window.parameters.autoLoginUsername;
                        config.autoLoginPassword = window.parameters.autoLoginPassword;
                    }
            src/PartKeepr/FrontendBundle/Resources/public/js/PartKeepr.js on lines 41..45

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

            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

                    if (window.parameters.autoLoginUsername) {
                        config.autoLogin = true;
                        config.autoLoginUsername = window.parameters.autoLoginUsername;
                        config.autoLoginPassword = window.parameters.autoLoginPassword;
                    }
            src/PartKeepr/MobileFrontendBundle/Resources/public/js/PartKeeprMobile.js on lines 14..18

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

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

                initComponent: function ()
                {
                    this.items = [
                        {
                            xtype: 'partkeepr.FootprintTree',

              Function onStartEdit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  onStartEdit: function ()
                  {
                      if (this.record.get("protected") === true) {
                          this.items.each(function (item) {
                              if (item instanceof Ext.form.field.Base && !(item instanceof Ext.form.field.Display)) {

                Method testGetImage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function testGetImage()
                    {
                        $client = static::makeClient(true);
                
                        $file = __DIR__.'/Fixtures/files/uploadtest.png';
                Severity: Minor
                Found in src/PartKeepr/ImageBundle/Tests/ImageControllerTest.php - About 1 hr to fix

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

                  <?php
                  
                  namespace PartKeepr\SetupBundle\Command;
                  
                  use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
                  src/PartKeepr/SetupBundle/Command/ImportManufacturersCommand.php on lines 1..28
                  src/PartKeepr/SetupBundle/Command/ImportSiPrefixesCommand.php on lines 1..28

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

                  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

                  <?php
                  
                  namespace PartKeepr\SetupBundle\Command;
                  
                  use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
                  src/PartKeepr/SetupBundle/Command/ImportFootprintsCommand.php on lines 1..28
                  src/PartKeepr/SetupBundle/Command/ImportSiPrefixesCommand.php on lines 1..28

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

                  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

                  <?php
                  
                  namespace PartKeepr\SetupBundle\Command;
                  
                  use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
                  src/PartKeepr/SetupBundle/Command/ImportFootprintsCommand.php on lines 1..28
                  src/PartKeepr/SetupBundle/Command/ImportManufacturersCommand.php on lines 1..28

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

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

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

                  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