hendrikmaus/spas

View on GitHub

Showing 16 of 43 total issues

Method configure has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function configure()
    {
        $this
            ->setName('run')
            ->setDescription('Run test suite')
Severity: Major
Found in src/Command/RunCommand.php - About 3 hrs to fix

    Function indent has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        private function indent($json) : string
        {
            $result = '';
            $pos = 0;
            $strLen = strlen($json);
    Severity: Minor
    Found in src/Formatter/JsonFormatter.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 onBeforeEach has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function onBeforeEach(BeforeEach $event)
        {
            $request  = $event->getRequest();
            $config   = $request->getRepetitionConfig();
            $name     = strtolower($request->getName());
    Severity: Minor
    Found in src/Hook/Repeat.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 doRequest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function doRequest(ParsedRequest $request, $attempt = 0)
        {
            $attempt++;
    
            $pollingThreshhold = $this->input->getOption('polling_count') - 1;
    Severity: Minor
    Found in src/Request/RequestProcessor.php - About 1 hr to fix

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

          private function indent($json) : string
          {
              $result = '';
              $pos = 0;
              $strLen = strlen($json);
      Severity: Minor
      Found in src/Formatter/JsonFormatter.php - About 1 hr to fix

        Method process has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function process(ParsedRequest $request)
            {
                if ($this->shouldExit($request)) {
                    return;
                }
        Severity: Minor
        Found in src/Request/RequestProcessor.php - About 1 hr to fix

          Method computeGuzzleOptions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function computeGuzzleOptions(ParsedRequest $request): array
              {
                  $options                                  = [];
                  $options[RequestOptions::ALLOW_REDIRECTS] = false;
                  $options[RequestOptions::CONNECT_TIMEOUT] = 30;
          Severity: Minor
          Found in src/Request/HttpClient.php - About 1 hr to fix

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

                    InputInterface $input,
                    LoggerInterface $logger,
                    EventDispatcherInterface $dispatcher,
                    ValidatorService $validatorService,
                    HttpClient $http,
            Severity: Major
            Found in src/Request/RequestProcessor.php - About 1 hr to fix

              Method onBeforeEach has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function onBeforeEach(BeforeEach $event)
                  {
                      $request  = $event->getRequest();
                      $config   = $request->getRepetitionConfig();
                      $name     = strtolower($request->getName());
              Severity: Minor
              Found in src/Hook/Repeat.php - About 1 hr to fix

                Function onBeforeEach has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function onBeforeEach(BeforeEach $event)
                    {
                        $request = $event->getRequest();
                        $name    = $request->getName();
                
                
                Severity: Minor
                Found in src/Hook/EnableDisable.php - About 55 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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function validate(ParsedRequest $request, ParsedResponse $response)
                    {
                        $expected = $request->getExpectedResponse()->getHeaders();
                        $actual   = $response->getHeaders();
                
                
                Severity: Minor
                Found in src/Validation/Validator/Header.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

                        InputInterface $input,
                        EventDispatcherInterface $dispatcher,
                        LoggerInterface $logger,
                        Filesystem $filesystem,
                        ParameterBag $parameterBag,
                Severity: Minor
                Found in src/Request/HookHandler.php - About 45 mins to fix

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

                      public function includeHooks()
                      {
                          foreach ($this->getHookFiles() as $hookname) {
                              if (class_exists($hookname)) {
                                  /** @var Hook $hook */
                  Severity: Minor
                  Found in src/Request/HookHandler.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

                  Avoid too many return statements within this method.
                  Open

                          return $this->doRequest($request, $attempt);
                  Severity: Major
                  Found in src/Request/RequestProcessor.php - About 30 mins to fix

                    Function getFormatterByContentType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getFormatterByContentType(string $type) : Formatter
                        {
                            foreach ($this->formatters as $formatter) {
                                foreach ($formatter->getContentTypes() as $contentType) {
                                    if (strpos($type, $contentType) !== false) {
                    Severity: Minor
                    Found in src/Formatter/FormatterService.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

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

                        public function format($data) : string
                        {
                            $result = [];
                    
                            /** @var Validator $validator */
                    Severity: Minor
                    Found in src/Formatter/ValidationErrorFormatter.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