partkeepr/PartKeepr

View on GitHub
web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js

Summary

Maintainability
F
5 days
Test Coverage

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

    initComponent: function ()
    {
        this.createHintTemplate = Ext.create("Ext.Template", [
            "<code>CREATE USER {user} WITH UNENCRYPTED PASSWORD '{password}'; CREATE DATABASE {dbname}; GRANT ALL PRIVILEGES ON DATABASE {dbname} TO {user};<br/><br/></code>"
        ]);
Severity: Major
Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js - About 5 hrs to fix

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

        onUpdateParameters: function ()
        {
            if (this.initial)
            {
                return;
    Severity: Minor
    Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js - About 1 hr to fix

      Function onUpdateParameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          onUpdateParameters: function ()
          {
              if (this.initial)
              {
                  return;
      Severity: Minor
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.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 initComponent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          initComponent: function ()
          {
              this.createHintTemplate = Ext.create("Ext.Template", [
                  "<code>CREATE USER {user} WITH UNENCRYPTED PASSWORD '{password}'; CREATE DATABASE {dbname}; GRANT ALL PRIVILEGES ON DATABASE {dbname} TO {user};<br/><br/></code>"
              ]);
      Severity: Minor
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.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

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

          onActivate: function ()
          {
              this.initial = true;
              this.hostname.setValue(PartKeeprSetup.getApplication().getSetupConfig().values.database_host);
              this.username.setValue(PartKeeprSetup.getApplication().getSetupConfig().values.database_user);
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 1 other location - About 1 day to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 174..187

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

      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 (this.hostname.getValue() !== "" && this.username.getValue() !== "" && this.password.getValue() !== "" &&
                  this.databaseName.getValue() !== "")
              {
      
                  Ext.ComponentQuery.query('#nextBtn')[0].enable();
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 1 other location - About 3 hrs to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 221..224

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

      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

                  {
                      xtype: 'panel',
                      border: false,
                      width: "300px",
                      bodyStyle: {
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 1 other location - About 3 hrs to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 115..137

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

      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

              Ext.merge(config, {
                  values: {
                      database_driver: 'pdo_pgsql',
                      database_host: this.hostname.getValue(),
                      database_user: this.username.getValue(),
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 1 other location - About 3 hrs to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 228..237

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

      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

                  if (this.hostname.getValue() === "localhost" || this.hostname.getValue() === "127.0.0.1")
                  {
                      host = this.hostname.getValue();
                  } else
                  {
      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 201..205

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

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

              this.databaseName = Ext.create("Ext.form.field.Text", {
                  fieldLabel: 'Database Name',
                  labelWidth: this.defaults.labelWidth,
                  value: PartKeeprSetup.getApplication().getSetupConfig().values.database_name
              });
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 5 other locations - About 1 hr to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 29..33
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 37..41
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 54..58
      web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 31..35
      web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 39..43

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

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

              this.hostname = Ext.create("Ext.form.field.Text", {
                  fieldLabel: 'Database Hostname',
                  labelWidth: this.defaults.labelWidth,
                  value: PartKeeprSetup.getApplication().getSetupConfig().values.database_host
              });
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 5 other locations - About 1 hr to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 29..33
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 37..41
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 54..58
      web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 39..43
      web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 56..60

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

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

              this.username = Ext.create("Ext.form.field.Text", {
                  fieldLabel: 'Database Username',
                  labelWidth: this.defaults.labelWidth,
                  value: PartKeeprSetup.getApplication().getSetupConfig().values.database_user
              });
      Severity: Major
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 5 other locations - About 1 hr to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 29..33
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 37..41
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 54..58
      web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 31..35
      web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js on lines 56..60

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

      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 (field.getValue())
                              {
                                  this.port.disable();
                                  this.port.setValue(5432);
                              } else
      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 92..97

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

      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.createHintTemplate.overwrite(Ext.getCmp("postgresql-parameters-hint").getEl(), {
                      localhost: host,
                      user: this.username.getValue(),
                      password: this.password.getValue(),
                      name: this.databaseName.getValue()
      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 211..216

      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

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

              this.showHintCheckbox = Ext.create("Ext.form.field.Checkbox", {
                  xtype: 'checkboxfield',
                  boxLabel: 'Show commands to create the database',
                  listeners: {
                      change: this.onUpdateParameters,
      Severity: Minor
      Found in web/setup/js/Cards/DatabaseParametersCard.PostgreSQL.js and 1 other location - About 50 mins to fix
      web/setup/js/Cards/DatabaseParametersCard.MySQL.js on lines 105..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 51.

      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