honeybee/honeybee

View on GitHub

Showing 178 of 178 total issues

AggregateRoot has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AggregateRoot extends Entity implements AggregateRootInterface
{
    /**
     * @var AggregateRootEventList $history
     */
Severity: Minor
Found in src/Model/Aggregate/AggregateRoot.php - About 2 hrs to fix

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

    <?php
    
    namespace Honeybee\Common\Error\AggregateRoot;
    
    use Exception;
    Severity: Major
    Found in src/Common/Error/AggregateRoot/HistoryEmptyError.php and 2 other locations - About 2 hrs to fix
    src/Common/Error/AggregateRoot/CommandRevisionError.php on lines 1..37
    src/Common/Error/AggregateRoot/HistoryConflictError.php on lines 1..37

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

    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 Honeybee\Common\Error\AggregateRoot;
    
    use Exception;
    Severity: Major
    Found in src/Common/Error/AggregateRoot/HistoryConflictError.php and 2 other locations - About 2 hrs to fix
    src/Common/Error/AggregateRoot/CommandRevisionError.php on lines 1..37
    src/Common/Error/AggregateRoot/HistoryEmptyError.php on lines 1..37

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

    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 Honeybee\Common\Error\AggregateRoot;
    
    use Exception;
    Severity: Major
    Found in src/Common/Error/AggregateRoot/CommandRevisionError.php and 2 other locations - About 2 hrs to fix
    src/Common/Error/AggregateRoot/HistoryConflictError.php on lines 1..37
    src/Common/Error/AggregateRoot/HistoryEmptyError.php on lines 1..37

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

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

        protected function translateFilters(CriteriaList $filter_criteria_list)
        {
            $elasticsearch_filters = [];
            foreach ($filter_criteria_list as $criteria) {
                if ($criteria instanceof CriteriaContainerInterface) {

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

        protected function applyEvent(AggregateRootEventInterface $event, $auto_commit = true)
        {
            $this->guardEventPreConditions($event);
            if (!$this->setValues($event->getData())) {
                $errors = [];
    Severity: Minor
    Found in src/Model/Aggregate/AggregateRoot.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

    ProjectionUpdater has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ProjectionUpdater extends EventHandler
    {
        protected $data_access_service;
    
        protected $projection_type_map;
    Severity: Minor
    Found in src/Projection/EventHandler/ProjectionUpdater.php - About 2 hrs to fix

      Method createMirroredEntity has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createMirroredEntity(EntityInterface $source_entity, EntityInterface $reference_entity = null)
          {
              // compile non-list attribute values from the reference entity if available
              if ($reference_entity) {
                  foreach ($this->getAttributes() as $attribute) {
      Severity: Major
      Found in src/Projection/EntityType.php - About 2 hrs to fix

        Method connect has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function connect()
            {
                $base_uri = $this->config->get('base_uri');
                if ($this->config->has('transport') && $this->config->has('host') && $this->config->has('port')) {
                    $base_uri = sprintf(
        Severity: Major
        Found in src/Infrastructure/DataAccess/Connector/GuzzleRetryConnector.php - About 2 hrs to fix

          Method getStatus has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getStatus()
              {
                  if ($this->config->has('fake_status')) {
                      return new Status($this, $this->config->get('fake_status'));
                  }
          Severity: Major
          Found in src/Infrastructure/DataAccess/Connector/GuzzleRetryConnector.php - About 2 hrs to fix

            Method getStatus has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getStatus()
                {
                    if ($this->config->has('fake_status')) {
                        return new Status($this, $this->config->get('fake_status'));
                    }
            Severity: Minor
            Found in src/Infrastructure/DataAccess/Connector/GuzzleConnector.php - About 2 hrs to fix

              Function createMirroredEntity has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function createMirroredEntity(EntityInterface $source_entity, EntityInterface $reference_entity = null)
                  {
                      // compile non-list attribute values from the reference entity if available
                      if ($reference_entity) {
                          foreach ($this->getAttributes() as $attribute) {
              Severity: Minor
              Found in src/Projection/EntityType.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 buildSpatialFilterFor has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function buildSpatialFilterFor(CriteriaInterface $criteria)
                  {
                      $attribute_path = $criteria->getAttributePath();
                      $comparison = $criteria->getComparison();
                      $geometry = $comparison->getComparand();

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

                    protected function applyEvent(AggregateRootEventInterface $event, $auto_commit = true)
                    {
                        $this->guardEventPreConditions($event);
                        if (!$this->setValues($event->getData())) {
                            $errors = [];
                Severity: Minor
                Found in src/Model/Aggregate/AggregateRoot.php - About 1 hr to fix

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

                      protected function updateMappingsWithReindex(MigrationTarget $migration_target)
                      {
                          $client = $this->getConnection($migration_target);
                          $index_api = $client->indices();
                          $index_name = $this->getIndexName($migration_target);
                  Severity: Minor
                  Found in src/Infrastructure/Migration/ElasticsearchMigration.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

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

                      public function executeHandlers($channel_name, EventInterface $event, $subscription_index)
                      {
                          if (!$this->channel_map->hasKey($channel_name)) {
                              throw new RuntimeError(
                                  sprintf(
                  Severity: Minor
                  Found in src/Infrastructure/Event/Bus/EventBus.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

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

                      protected function translateQueries(CriteriaList $criteria_list)
                      {
                          if ($criteria_list->isEmpty()) {
                              return [ 'match_all' => [] ];
                          } else {

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

                      public function distribute($channel_name, EventInterface $event)
                      {
                          if (!$this->channel_map->hasKey($channel_name)) {
                              throw new RuntimeError(
                                  sprintf(
                  Severity: Minor
                  Found in src/Infrastructure/Event/Bus/EventBus.php - About 1 hr to fix

                    Method connect has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function connect()
                        {
                            $base_uri = $this->config->get('base_uri');
                            if ($this->config->has('transport') && $this->config->has('host') && $this->config->has('port')) {
                                $base_uri = sprintf(
                    Severity: Minor
                    Found in src/Infrastructure/DataAccess/Connector/GuzzleConnector.php - About 1 hr to fix

                      Method updateDesignDoc has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function updateDesignDoc(MigrationTarget $migration_target)
                          {
                              $views_directory = $this->getViewsDirectory();
                              if (!is_dir($views_directory)) {
                                  throw new RuntimeError(sprintf('Given views directory "%s" does not exist.', $views_directory));
                      Severity: Minor
                      Found in src/Infrastructure/Migration/CouchDbMigration.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language