fastbolt/entity-importer

View on GitHub

Showing 9 of 9 total issues

Method loadBulkData has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function loadBulkData(int $offset): void
    {
        /** @var Api $importSourceDefinition */
        $importSourceDefinition = $this->importSourceDefinition;
        $clientFactory = $this->clientFactory;
Severity: Major
Found in src/Reader/ApiReader.php - About 2 hrs to fix

    Function import has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function import(
            EntityImporterDefinition $definition,
            callable $statusCallback,
            callable $errorCallback,
            ?int $limit
    Severity: Minor
    Found in src/EntityImporter.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 import has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function import(
            EntityImporterDefinition $definition,
            callable $statusCallback,
            callable $errorCallback,
            ?int $limit
    Severity: Major
    Found in src/EntityImporter.php - About 2 hrs to fix

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

          public function render(StyleInterface $io, ImportResult $importResult): void
          {
              $errors     = $importResult->getErrors();
              $numErrors  = count($errors);
              $numSuccess = $importResult->getSuccess();
      Severity: Minor
      Found in src/Console/ImportCommandResultRenderer.php - About 1 hr to fix

        Function setData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setData(EntityImporterDefinition $definition, object $entity, array $row): object
            {
                $converters    = $definition->getFieldConverters();
                $skippedFields = $definition->getSkippedFields();
                foreach ($row as $key => $value) {
        Severity: Minor
        Found in src/Factory/EntityUpdater.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

        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                SplFileObject $file,
                array $columnHeaders,
                ?int $headerRowNumber = null,
                string $delimiter = ',',
                string $enclosure = '"',
        Severity: Minor
        Found in src/Reader/CsvReader.php - About 45 mins to fix

          Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  string $importFile,
                  ArchivingStrategy $archivingStrategy,
                  string $delimiter = ';',
                  string $enclosure = '"',
                  string $escape = '\\',
          Severity: Minor
          Found in src/Types/ImportSourceDefinition/Csv.php - About 45 mins to fix

            Function getErrors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getErrors(): array
                {
                    if (null === $this->errors) {
                        $this->errors = [];
                        /**
            Severity: Minor
            Found in src/Reader/XlsxReader.php - About 35 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 detectSetter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function detectSetter(EntityImporterDefinition $definition, object $entity, string $key, $value): ?string
                {
                    $entityClass = get_class($entity);
                    if (null !== ($setter = $this->setterCache[$entityClass][$key] ?? null)) {
                        return $setter;
            Severity: Minor
            Found in src/Factory/EntityUpdater.php - 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

            Severity
            Category
            Status
            Source
            Language