influxdb/influxdb-php

View on GitHub

Showing 11 of 11 total issues

Method fromDSN has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function fromDSN($dsn, $timeout = 0, $verifySSL = false, $connectTimeout = 0)
    {
        $connParams = parse_url($dsn);

        if ($connParams === false) {
Severity: Minor
Found in src/InfluxDB/Client.php - About 1 hr to fix

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

        protected function parseQuery()
        {
            $rp = '';
    
            if (is_string($this->retentionPolicy) && !empty($this->retentionPolicy)) {
    Severity: Minor
    Found in src/InfluxDB/Query/Builder.php - About 1 hr to fix

      Function parseQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function parseQuery()
          {
              $rp = '';
      
              if (is_string($this->retentionPolicy) && !empty($this->retentionPolicy)) {
      Severity: Minor
      Found in src/InfluxDB/Query/Builder.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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $host,
              $port = 8086,
              $username = '',
              $password = '',
              $ssl = false,
      Severity: Major
      Found in src/InfluxDB/Client.php - About 1 hr to fix

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

            public function getPoints($metricName = '', array $tags = [])
            {
                $points = [];
                $series = $this->getSeries();
        
        
        Severity: Minor
        Found in src/InfluxDB/ResultSet.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 executePrivilege has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function executePrivilege($type, $privilege, $username, $database = null)
            {
        
                if (!in_array($privilege, [self::PRIVILEGE_READ, self::PRIVILEGE_WRITE, self::PRIVILEGE_ALL], true)) {
                    throw new Exception($privilege . ' is not a valid privileges, allowed privileges: READ, WRITE, ALL');
        Severity: Minor
        Found in src/InfluxDB/Client/Admin.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 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $measurement,
                $value = null,
                array $tags = array(),
                array $additionalFields = array(),
                $timestamp = null
        Severity: Minor
        Found in src/InfluxDB/Point.php - About 35 mins to fix

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

              public function getSeries($queryIndex = 0)
              {
                  $results = $this->parsedResults['results'];
          
                  if ($queryIndex !== null && !array_key_exists($queryIndex, $results)) {
          Severity: Minor
          Found in src/InfluxDB/ResultSet.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 true;
          Severity: Major
          Found in src/InfluxDB/Point.php - About 30 mins to fix

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

                public function setFields($fields)
                {
                    foreach ($fields as &$field) {
                        if (is_int($field)) {
                            $field = sprintf('%di', $field);
            Severity: Minor
            Found in src/InfluxDB/Point.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($dsn, $options = [])
                {
                    if (!extension_loaded('curl')) {
                        throw new Exception('Curl extension is not enabled!');
                    }
            Severity: Minor
            Found in src/InfluxDB/Driver/Curl.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