honeybadger-io/honeybadger-php

View on GitHub

Showing 6 of 6 total issues

Function synchronizeLocalCheckIns has a Cognitive Complexity of 17 (exceeds 6 allowed). Consider refactoring.
Open

    private function synchronizeLocalCheckIns(string $projectId, array $localCheckIns, array $remoteCheckIns): array
    {
        $result = [];

        foreach ($localCheckIns as $localCheckIn) {
Severity: Minor
Found in src/CheckInsManager.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 mergeConfig has 43 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    private function mergeConfig($config = []): array
    {
        return array_merge([
            'api_key' => null,
            'personal_auth_token' => null,
Severity: Minor
Found in src/Config.php - About 1 hr to fix

    Method format has 31 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

        private function format(): array
        {
            return [
                'breadcrumbs' => [
                    'enabled' => $this->config['breadcrumbs']['enabled'],
    Severity: Minor
    Found in src/ExceptionNotification.php - About 1 hr to fix

      Function get has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring.
      Open

          public static function get($array, $key, $default = null)
          {
              if (! static::accessible($array)) {
                  return $default;
              }
      Severity: Minor
      Found in src/Support/Arr.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 $array;
      Severity: Major
      Found in src/Support/Arr.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return ServiceException::unexpectedResponseCode($this->response->getStatusCode());
        Severity: Major
        Found in src/Exceptions/ServiceExceptionFactory.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language