honeybee/honeybee

View on GitHub

Showing 178 of 178 total issues

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

    protected function tryToReadMetadata()
    {
        $serialized_metadata = fgets($this->file_pointer);
        if (!$serialized_metadata) {
            return new BulkStreamError(
Severity: Minor
Found in src/Model/Command/Bulk/BulkStreamIterator.php - About 1 hr to fix

    Method generate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function generate(ConnectorMap $connector_map)
        {
            $details = [];
            $failing = 0;
            $working = 0;
    Severity: Minor
    Found in src/Infrastructure/DataAccess/Connector/StatusReport.php - About 1 hr to fix

      Method guardCommandPreConditions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function guardCommandPreConditions(AggregateRootCommandInterface $command)
          {
              if ($this->getHistory()->isEmpty()) {
                  throw new HistoryEmptyError(
                      sprintf(
      Severity: Minor
      Found in src/Model/Aggregate/AggregateRoot.php - About 1 hr to fix

        Function applyValues has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function applyValues(EmbeddedEntityEventInterface $event)
            {
                if (!is_callable([$event, 'getData'])) {
                    throw new RuntimeError('Event instance is not support due to lack of a getData method.');
                }
        Severity: Minor
        Found in src/Model/Aggregate/EmbeddedEntity.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 validateValues has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function validateValues(array $values)
            {
                $errors = [];
                $sanitized_values = [];
        
        
        Severity: Minor
        Found in src/Model/Command/EmbeddedEntityCommandBuilder.php - About 1 hr to fix

          Method updateAffectedRelatives has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function updateAffectedRelatives(
                  ProjectionMap $affected_relatives_map,
                  ProjectionInterface $source_projection
              ) {
                  $referenced_identifier = $source_projection->getIdentifier();
          Severity: Minor
          Found in src/Projection/EventHandler/RelationProjectionUpdater.php - About 1 hr to fix

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

                protected function applyEmbeddedEntityEvent(
                    EmbeddedEntityEventInterface $embedded_entity_event,
                    $auto_commit = true
                ) {
                    $attribute_name = $embedded_entity_event->getParentAttributeName();
            Severity: Minor
            Found in src/Model/Aggregate/Entity.php - About 1 hr to fix

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

                  protected function moveTempFileToFinalLocation($location, EntityTypeInterface $art)
                  {
                      $from_uri = $this->filesystem_service->createTempUri($location, $art); // from temporary storage
                      $to_uri = $this->filesystem_service->createUri($location, $art); // to final storage
              
              
              Severity: Minor
              Found in src/Projection/EventHandler/ProjectionFileHandler.php - About 1 hr to fix

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

                    protected function processEmbeddedEntityCommand(CommandInterface $command, array $custom_event_state = [])
                    {
                        $event_class = $command->getEventClass();
                        $attribute_name = $command->getParentAttributeName();
                
                
                Severity: Minor
                Found in src/Model/Aggregate/AggregateRoot.php - About 1 hr to fix

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

                      protected function applyValues(EmbeddedEntityEventInterface $event)
                      {
                          if (!is_callable([$event, 'getData'])) {
                              throw new RuntimeError('Event instance is not support due to lack of a getData method.');
                          }
                  Severity: Minor
                  Found in src/Model/Aggregate/EmbeddedEntity.php - About 1 hr to fix

                    Method executeHandlers has 36 lines of code (exceeds 25 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

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

                          protected function createInitialData(
                              CreateAggregateRootCommand $create_command,
                              StateMachineInterface $state_machine
                          ) {
                              $type = $this->getType();
                      Severity: Minor
                      Found in src/Model/Aggregate/AggregateRoot.php - About 1 hr to fix

                        Method read has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function read($identifier, SettingsInterface $settings = null)
                            {
                                try {
                                    $view_params = [
                                        'startkey' => sprintf(self::STARTKEY_FILTER, $identifier),

                          Method mirrorReferencedProjection has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function mirrorReferencedProjection(EntityReferenceInterface $projection)
                              {
                                  $projection_type = $projection->getType();
                                  $mirrored_attribute_map = $projection_type->getAttributes()->filter(
                                      function (AttributeInterface $attribute) {
                          Severity: Minor
                          Found in src/Projection/EventHandler/ProjectionUpdater.php - About 1 hr to fix

                            Method translateFilters has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Method proceedWorkflow has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function proceedWorkflow(ProceedWorkflowCommand $workflow_command, StateMachineInterface $state_machine)
                                  {
                                      $this->guardCommandPreConditions($workflow_command);
                              
                                      if ($workflow_command->getCurrentStateName() !== $this->getWorkflowState()) {
                              Severity: Minor
                              Found in src/Model/Aggregate/AggregateRoot.php - About 1 hr to fix

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

                                        if ($this->databaseExists($migration_target)) {
                                            $client = $this->getConnection($migration_target);
                                            $database_name = $this->getDatabaseName($migration_target);
                                            $response = $client->delete('/' . $database_name);
                                            if ($response->getStatusCode() !== 200) {
                                Severity: Major
                                Found in src/Infrastructure/Migration/CouchDbMigration.php and 1 other location - About 1 hr to fix
                                src/Infrastructure/Migration/CouchDbMigration.php on lines 29..44

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

                                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

                                        try {
                                            $client = $this->getConnection($migration_target);
                                            $database_name = $this->getDatabaseName($migration_target);
                                            $response = $client->put('/' . $database_name);
                                            if ($response->getStatusCode() !== 201) {
                                Severity: Major
                                Found in src/Infrastructure/Migration/CouchDbMigration.php and 1 other location - About 1 hr to fix
                                src/Infrastructure/Migration/CouchDbMigration.php on lines 53..65

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

                                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 getStatus has 33 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'));
                                        }

                                  Method loadMigrations has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function loadMigrations()
                                      {
                                          $migration_dir = $this->config->get('directory');
                                          if (!is_dir($migration_dir) || !is_readable($migration_dir)) {
                                              throw new RuntimeError(sprintf('Given migration path is not a readable directory: %s', $migration_dir));
                                  Severity: Minor
                                  Found in src/Infrastructure/Migration/FileSystemLoader.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language