keboola/syrup-component-bundle

View on GitHub

Showing 38 of 38 total issues

Job has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class Job implements JobInterface
{
    const STATUS_WAITING    = 'waiting';
    const STATUS_PROCESSING = 'processing';
    const STATUS_SUCCESS    = 'success';
Severity: Minor
Found in Job/Metadata/Job.php - About 5 hrs to fix

    Method unaccent has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function unaccent($string)
        {
            if (!preg_match('/[\x80-\xff]/', $string)) {
                return $string;
            }
    Severity: Major
    Found in Utility/Utility.php - About 4 hrs to fix

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

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $jobId = $input->getArgument('jobId');
      
              $this->logger = $this->getContainer()->get('logger');
      Severity: Major
      Found in Command/JobCommand.php - About 3 hrs to fix

        Method getJobs has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getJobs(
                $projectId = null,
                $component = null,
                $runId = null,
                $queryString = null,
        Severity: Major
        Found in Job/Metadata/JobManager.php - About 2 hrs to fix

          Function processRecord has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function processRecord(array $record)
              {
                  $request = $this->requestStack->getCurrentRequest();
                  if ($request) {
                      $record['http'] = [
          Severity: Minor
          Found in Monolog/Processor/RequestProcessor.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

          File Job.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Created by Miroslav Čillík <miro@keboola.com>
           * Date: 28/05/14
           * Time: 14:37
          Severity: Minor
          Found in Job/Metadata/Job.php - About 2 hrs to fix

            Function seemsUtf8 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function seemsUtf8($string)
                {
                    for ($i = 0; $i < strlen($string); $i++) {
                        if (ord($string[$i]) < 0x80) {
                            continue;   # 0bbbbbbb
            Severity: Minor
            Found in Utility/Utility.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 processRecord has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function processRecord(array $record)
                {
                    if (isset($record['message']) && strlen($record['message'])>1024) {
                        $record['message'] = $this->s3Uploader->uploadString('message', $record['message']);
                    }
            Severity: Major
            Found in Monolog/Processor/SyslogProcessor.php - About 2 hrs to fix

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

                  public function format(array $record)
                  {
                      if ($this->storageApi == null) {
                          try {
                              $this->storageApi = $this->storageApiService->getClient();
              Severity: Major
              Found in Monolog/Formatter/SyrupJsonFormatter.php - About 2 hrs to fix

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

                    public function format(array $record)
                    {
                        if ($this->storageApi == null) {
                            try {
                                $this->storageApi = $this->storageApiService->getClient();
                Severity: Minor
                Found in Monolog/Formatter/SyrupJsonFormatter.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 onKernelException has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function onKernelException(GetResponseForExceptionEvent $event)
                    {
                        $exception = $event->getException();
                        $exceptionId = $this->appName . '-' . md5(microtime());
                
                
                Severity: Minor
                Found in Listener/SyrupExceptionListener.php - About 1 hr to fix

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

                      public function load($resource, $type = null)
                      {
                          $collection = new RouteCollection();
                  
                          if ($this->components != null) {
                  Severity: Minor
                  Found in Routing/Loader.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 processRecord has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function processRecord(array $record)
                      {
                          if (isset($record['message']) && strlen($record['message'])>1024) {
                              $record['message'] = $this->s3Uploader->uploadString('message', $record['message']);
                          }
                  Severity: Minor
                  Found in Monolog/Processor/SyslogProcessor.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 createIndex has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function createIndex($settings = null, $mappings = null)
                      {
                          // Assemble new index name
                  
                          $nextIndexNumber = 1;
                  Severity: Minor
                  Found in Job/Metadata/JobManager.php - About 1 hr to fix

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

                        public function handle(array $record)
                        {
                            if (!$this->storageApiClient || $record['level'] == Logger::DEBUG) {
                                return false;
                            }
                    Severity: Minor
                    Found in Monolog/Handler/StorageApiHandler.php - About 1 hr to fix

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

                          protected function execute(InputInterface $input, OutputInterface $output)
                          {
                              $jobId = $input->getArgument('jobId');
                      
                              $this->logger = $this->getContainer()->get('logger');
                      Severity: Minor
                      Found in Command/JobCommand.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 logToSapi has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function logToSapi($record)
                          {
                              $sapiEvent = new Event();
                              $sapiEvent->setComponent($this->appName);
                              $sapiEvent->setMessage($record['message']);
                      Severity: Minor
                      Found in Monolog/Formatter/SyrupJsonFormatter.php - About 1 hr to fix

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

                            protected function execute(InputInterface $input, OutputInterface $output)
                            {
                                $helper = $this->getQuestionHelper();
                        
                                $question = new ConfirmationQuestion('Do you confirm generation?', true);
                        Severity: Minor
                        Found in Command/GenerateComponentCommand.php - About 1 hr to fix

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

                              public function processRecord(array $record)
                              {
                                  $request = $this->requestStack->getCurrentRequest();
                                  if ($request) {
                                      $record['http'] = [
                          Severity: Minor
                          Found in Monolog/Processor/RequestProcessor.php - About 1 hr to fix

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

                                public function generate($namespace, $bundle, $dir, $format)
                                {
                            //      $dir .= '/'.strtr($namespace, '\\', '/');
                                    if (file_exists($dir)) {
                                        if (!is_dir($dir)) {
                            Severity: Minor
                            Found in Generator/ComponentGenerator.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language