Sibyx/phpGPX

View on GitHub

Showing 325 of 327 total issues

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

                [
                    'name' => 'Ownship',
                    'extensions' => [
                        'unsupported' => [
                            'guid' => 201,
Severity: Major
Found in tests/LoadFileTest.php and 1 other location - About 1 day to fix
tests/LoadFileTest.php on lines 138..220

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

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

                [
                    'name' => 'Ownship',
                    'extensions' => [
                        'unsupported' => [
                            'guid' => 102,
Severity: Major
Found in tests/LoadFileTest.php and 1 other location - About 1 day to fix
tests/LoadFileTest.php on lines 55..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 337.

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

                [
                    'name' => "Sibyx's Route",
                    'rtep' => [
                        [
                            'lat' => 54.9328621088893,
Severity: Major
Found in tests/LoadRouteFileTest.php and 1 other location - About 1 day to fix
tests/LoadRouteFileTest.php on lines 55..116

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

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

                [
                    'name' => "Patrick's Route",
                    'rtep' => [
                        [
                            'lat' => 54.9328621088893,
Severity: Major
Found in tests/LoadRouteFileTest.php and 1 other location - About 1 day to fix
tests/LoadRouteFileTest.php on lines 117..178

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

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

    private function createExpectedArray()
    {
        return [
            'waypoints' => [
                [
Severity: Major
Found in tests/LoadFileTest.php - About 7 hrs to fix

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

        public static function toXML(Track $track, \DOMDocument &$document)
        {
            $node = $document->createElement(self::$tagName);
    
            foreach (self::$attributeMapper as $key => $attribute) {
    Severity: Major
    Found in src/phpGPX/Parsers/TrackParser.php and 1 other location - About 7 hrs to fix
    src/phpGPX/Parsers/RouteParser.php on lines 113..147

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

    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

        public static function toXML(Route $route, \DOMDocument &$document)
        {
            $node = $document->createElement(self::$tagName);
    
            foreach (self::$attributeMapper as $key => $attribute) {
    Severity: Major
    Found in src/phpGPX/Parsers/RouteParser.php and 1 other location - About 7 hrs to fix
    src/phpGPX/Parsers/TrackParser.php on lines 107..141

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

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

        private function createExpectedArray()
        {
            return [
                'creator' => 'RouteConverter',
                'metadata' => [
    Severity: Major
    Found in tests/LoadRouteFileTest.php - About 5 hrs to fix

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

          private static $attributeMapper = [
              'name' => [
                  'name' => 'name',
                  'type' => 'string'
              ],
      Severity: Major
      Found in src/phpGPX/Parsers/MetadataParser.php and 2 other locations - About 3 hrs to fix
      src/phpGPX/Parsers/RouteParser.php on lines 20..57
      src/phpGPX/Parsers/TrackParser.php on lines 20..57

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

      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

          private static $attributeMapper = [
              'name' => [
                  'name' => 'name',
                  'type' => 'string'
              ],
      Severity: Major
      Found in src/phpGPX/Parsers/TrackParser.php and 2 other locations - About 3 hrs to fix
      src/phpGPX/Parsers/MetadataParser.php on lines 20..57
      src/phpGPX/Parsers/RouteParser.php on lines 20..57

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

      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

          private static $attributeMapper = [
              'name' => [
                  'name' => 'name',
                  'type' => 'string'
              ],
      Severity: Major
      Found in src/phpGPX/Parsers/RouteParser.php and 2 other locations - About 3 hrs to fix
      src/phpGPX/Parsers/MetadataParser.php on lines 20..57
      src/phpGPX/Parsers/TrackParser.php on lines 20..57

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

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

          public static function parse($nodes)
          {
              $routes = [];
      
              foreach ($nodes as $node) {
      Severity: Minor
      Found in src/phpGPX/Parsers/RouteParser.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

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

          public function toArray()
          {
              return [
                  'name' => SerializationHelper::stringOrNull($this->name),
                  'cmt' => SerializationHelper::stringOrNull($this->comment),
      Severity: Major
      Found in src/phpGPX/Models/Track.php and 1 other location - About 3 hrs to fix
      src/phpGPX/Models/Route.php on lines 61..75

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

      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

          public function toArray()
          {
              return [
                  'name' => SerializationHelper::stringOrNull($this->name),
                  'cmt' => SerializationHelper::stringOrNull($this->comment),
      Severity: Major
      Found in src/phpGPX/Models/Route.php and 1 other location - About 3 hrs to fix
      src/phpGPX/Models/Track.php on lines 60..74

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

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

          public function recalculateStats()
          {
              if (empty($this->stats)) {
                  $this->stats = new Stats();
              }
      Severity: Minor
      Found in src/phpGPX/Models/Track.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 toXML has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function toXML(Metadata $metadata, \DOMDocument &$document)
          {
              $node =  $document->createElement(self::$tagName);
      
              foreach (self::$attributeMapper as $key => $attribute) {
      Severity: Minor
      Found in src/phpGPX/Parsers/MetadataParser.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 recalculateStats has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function recalculateStats()
          {
              if (empty($this->stats)) {
                  $this->stats = new Stats();
              }
      Severity: Major
      Found in src/phpGPX/Models/Track.php - About 2 hrs to fix

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

            public static function toXML(Copyright $copyright, \DOMDocument &$document)
            {
                $node = $document->createElement(self::$tagName);
        
                $node->setAttribute('author', $copyright->author);
        Severity: Major
        Found in src/phpGPX/Parsers/CopyrightParser.php and 1 other location - About 2 hrs to fix
        src/phpGPX/Parsers/LinkParser.php on lines 54..71

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

        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

            public static function toXML(Link $link, \DOMDocument &$document)
            {
                $node =  $document->createElement(self::$tagName);
        
                $node->setAttribute('href', $link->href);
        Severity: Major
        Found in src/phpGPX/Parsers/LinkParser.php and 1 other location - About 2 hrs to fix
        src/phpGPX/Parsers/CopyrightParser.php on lines 43..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 127.

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

            public static function parse(\SimpleXMLElement $nodes)
            {
                $tracks = [];
        
                foreach ($nodes as $node) {
        Severity: Minor
        Found in src/phpGPX/Parsers/TrackParser.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

        Severity
        Category
        Status
        Source
        Language