DeploymentTools/MySQL-to-object-mapper

View on GitHub

Showing 26 of 26 total issues

Function extractElementFragments has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractElementFragments()
    {
        $elements = array();
        $currentCursor = 0;

Severity: Minor
Found in app/Extractor/Fields.php - About 3 hrs 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 extractElementFragments has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractElementFragments()
    {
        $tablesRaw = array();
        $tablesRawCursor = 0;
        $this->previousChar = null;
Severity: Minor
Found in app/Extractor/Tables.php - About 3 hrs 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 appendDifferencesTables has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function appendDifferencesTables($table1, $table2)
    {
        $matchedFields = [];
        $differences = [
            'field-diffs' => [],
Severity: Minor
Found in app/Console/Command/SnapshotCompareCommand.php - About 2 hrs 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 appendDifferencesDatabases has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function appendDifferencesDatabases($db1, $db2)
    {
        $matchedTables = [];

        $databaseDiffs = [
Severity: Minor
Found in app/Console/Command/SnapshotCompareCommand.php - About 2 hrs 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

Method getFirstChunk has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getFirstChunk($string)
    {
        $firstChar = substr($string, 0, 1);
        $secondChar = substr($string, 1, 1);

Severity: Minor
Found in app/Extractor/String.php - About 1 hr to fix

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

        public static function getFirstChunk($string)
        {
            $firstChar = substr($string, 0, 1);
            $secondChar = substr($string, 1, 1);
    
    
    Severity: Minor
    Found in app/Extractor/String.php - About 1 hr 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

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

            if (is_array($serverSourceDetails) && count($serverSourceDetails) === 5) {
                $mysqlCredentials = new \stdClass();
                $mysqlCredentials->dbuser = $serverSourceDetails[1];
                $mysqlCredentials->dbpass = $serverSourceDetails[2];
                $mysqlCredentials->host = $serverSourceDetails[3];
    Severity: Major
    Found in app/Console/Command/SyncCompareCommand.php and 1 other location - About 1 hr to fix
    app/Console/Command/SyncCompareCommand.php on lines 37..49

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

    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 (is_array($serverDestinationDetails) && count($serverDestinationDetails) === 5) {
                $mysqlCredentials = new \stdClass();
                $mysqlCredentials->dbuser = $serverDestinationDetails[1];
                $mysqlCredentials->dbpass = $serverDestinationDetails[2];
                $mysqlCredentials->host = $serverDestinationDetails[3];
    Severity: Major
    Found in app/Console/Command/SyncCompareCommand.php and 1 other location - About 1 hr to fix
    app/Console/Command/SyncCompareCommand.php on lines 23..35

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

    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

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

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $notFound = false;
            $source = $input->getArgument('source');
            $destination = $input->getArgument('destination');
    Severity: Minor
    Found in app/Console/Command/SyncCompareCommand.php - About 1 hr to fix

      Method extractElementFragments has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function extractElementFragments()
          {
              $elements = array();
              $currentCursor = 0;
      
      
      Severity: Minor
      Found in app/Extractor/Fields.php - About 1 hr to fix

        Function execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute($databaseName = '')
            {
                $this->prepareSourceEntries();
        
                if ($this->entries->count() > 0) {
        Severity: Minor
        Found in app/Driver/Disk.php - About 1 hr 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

        Method appendDifferencesTables has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function appendDifferencesTables($table1, $table2)
            {
                $matchedFields = [];
                $differences = [
                    'field-diffs' => [],
        Severity: Minor
        Found in app/Console/Command/SnapshotCompareCommand.php - About 1 hr to fix

          Method extractElementFragments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function extractElementFragments()
              {
                  $tablesRaw = array();
                  $tablesRawCursor = 0;
                  $this->previousChar = null;
          Severity: Minor
          Found in app/Extractor/Tables.php - About 1 hr to fix

            Method appendDifferencesDatabases has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function appendDifferencesDatabases($db1, $db2)
                {
                    $matchedTables = [];
            
                    $databaseDiffs = [
            Severity: Minor
            Found in app/Console/Command/SnapshotCompareCommand.php - About 1 hr to fix

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

                      foreach ($db1['Tables'] as $table1) {
                          foreach ($db2['Tables'] as $table2) {
                              if ($table1['Name'] === $table2['Name']) {
                                  $matchedTables[] = $table1['Name'];
                                  $tableDifferences = self::appendDifferencesTables($table1, $table2);
              Severity: Major
              Found in app/Console/Command/SnapshotCompareCommand.php and 1 other location - About 1 hr to fix
              app/Console/Command/SnapshotCompareCommand.php on lines 93..104

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

              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

                      foreach ($table1['Fields'] as $field1) {
                          foreach ($table2['Fields'] as $field2) {
                              if ($field1['Id'] === $field2['Id']) {
                                  $matchedFields[] = $field1['Id'];
                                  $fieldDifferences = self::appendDifferencesFields($field1, $field2);
              Severity: Major
              Found in app/Console/Command/SnapshotCompareCommand.php and 1 other location - About 1 hr to fix
              app/Console/Command/SnapshotCompareCommand.php on lines 56..67

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

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

                  public static function getKeyFromString($fieldString)
                  {
                      $pattern = self::$patterns['key'];
                      preg_match($pattern, $fieldString, $matches);
                      if ($matches) {
              Severity: Minor
              Found in app/Extractor/Fields.php - 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 checkQuotes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function checkQuotes()
                  {
                      if (!$this->inComment() && ($this->previousChar != '\\')) {
                          if ($this->currentChar == "'") {
                              $this->inSingleQuote = !$this->inSingleQuote;
              Severity: Minor
              Found in app/Extractor/Tables.php - About 45 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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function execute(InputInterface $input, OutputInterface $output)
                  {
                      $notFound = false;
                      $source = $input->getArgument('source');
                      $outputPath = $input->getArgument('output');
              Severity: Minor
              Found in app/Console/Command/SnapshotCreateCommand.php - About 45 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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function execute(InputInterface $input, OutputInterface $output)
                  {
                      $notFound = false;
                      $source = $input->getArgument('source');
                      $destination = $input->getArgument('destination');
              Severity: Minor
              Found in app/Console/Command/SyncCompareCommand.php - About 45 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

              Severity
              Category
              Status
              Source
              Language