Showing 3,246 of 4,217 total issues

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

    public function _prepare_value(&$extra, &$replace, &$params)
    {
        $name = $extra['name'];
        $is_html_array = (false !== strpos($name, '['));
        if ($is_html_array) {
Severity: Minor
Found in plugins/form2/classes/yf_form2.class.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

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

    public function _exec_method_on_action($action = 'login')
    {
        if ($action == 'login') {
            $callbacks = $this->EXEC_AFTER_LOGIN;
        } elseif ($action == 'logout') {
Severity: Minor
Found in plugins/auth/classes/auth/yf_auth_admin.class.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

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

    public function func($name, $func, $extra = [], $replace = [])
    {
        if (is_array($func)) {
            $extra = (array) $extra + $func;
            $func = '';
Severity: Minor
Found in plugins/form2/classes/yf_form2.class.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 _send_email_safe has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function _send_email_safe($email_to, $name_to, $template_name, $data = [], $old_param1 = null, $override = [])
Severity: Minor
Found in plugins/email/classes/yf_email.class.php - About 45 mins to fix

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

        public function create(array $data, $params = [])
        {
            if ( ! strlen($data['name']) || empty($data['fields'])) {
                return false;
            }
    Severity: Minor
    Found in plugins/db/classes/db/yf_db_ddl_parser_mysql.class.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

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

        public function drop_database($db_name, $extra = [], &$error = false)
        {
            if ( ! strlen($db_name)) {
                $error = 'db_name is empty';
                return false;
    Severity: Minor
    Found in plugins/db/classes/db/yf_db_utils_driver.class.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 create_function has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function create_function($name, $sql_body, $sql_returns_type, $sql_params = '', $extra = [], &$error = false)
    Severity: Minor
    Found in plugins/db/classes/db/yf_db_utils_mysql.class.php - About 45 mins to fix

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

          public function get_all($select = null, $use_cache = false, $key_name = null)
          {
              if (isset($select)) {
                  $this->select($select);
              }
      Severity: Minor
      Found in plugins/db/classes/db/yf_db_query_builder_driver.class.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

      Avoid deeply nested control flow statements.
      Open

                                          if ($next2['expr_type'] == 'reserved') {
                                              $default .= ' ' . (string) ($next2['base_expr']);
                                          }
      Severity: Major
      Found in plugins/db/classes/db/yf_db_ddl_parser_mysql.class.php - About 45 mins to fix

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

            public function delete($where = null, $as_sql = false)
            {
                if (isset($where)) {
                    $this->where($where);
                }
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_query_builder_driver.class.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

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

            public function view_unread()
            {
                if (empty(main()->USER_ID)) {
                    return;
                }
        Severity: Minor
        Found in plugins/comments/modules/yf_comments.class.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

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

            public function list_tables($db_name = '', $extra = [], &$error = false)
            {
                if (is_array($db_name)) {
                    $extra = (array) $extra + $db_name;
                    $db_name = '';
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_utils_driver.class.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

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

            public function _cleanup_column_sql_php($field_info = [])
            {
                foreach ((array) $field_info as $k => $v) {
                    $need_unset = false;
                    if ($v === null || in_array($k, ['raw', 'type_raw', 'primary', 'unique'])) {
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_migrator.class.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

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

            public function add_foreign_key($table, $index_name = '', $fields = [], $ref_table = '', $ref_fields = [], $extra = [], &$error = false)
            {
                if (is_array($table)) {
                    $extra = (array) $extra + $table;
                    $table = '';
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_utils_driver.class.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

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

            public function _load_tables_with_sys_prefix()
            {
                if ($this->_need_sys_prefix) {
                    return $this->_need_sys_prefix;
                }
        Severity: Minor
        Found in plugins/db/classes/yf_db.class.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

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

            public function alter_column($table, $col_name, $data, $extra = [], &$error = false)
            {
                if (is_array($table)) {
                    $extra = (array) $extra + $table;
                    $table = '';
        Severity: Minor
        Found in plugins/db/classes/db/yf_db_utils_driver.class.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 _set_connect_params has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function _set_connect_params($db_host = '', $db_user = '', $db_pswd = null, $db_name = null, $force = false, $params = [])
        Severity: Minor
        Found in plugins/db/classes/yf_db.class.php - About 45 mins to fix

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

              public function _get_table_structure_from_db_installer($table, &$error = false)
              {
                  // TODO: move this code into db installer class
                  if (strlen($this->db->DB_PREFIX) && substr($table, 0, strlen($this->db->DB_PREFIX)) == $this->db->DB_PREFIX) {
                      $search_table = substr($table, strlen($this->db->DB_PREFIX));
          Severity: Minor
          Found in plugins/db/classes/db/yf_db_utils_driver.class.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

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

              public function __construct($db_type = '', $db_prefix = null, $db_replication_slave = null)
              {
                  global $DEBUG;
          
                  $this->_load_tables_with_sys_prefix();
          Severity: Minor
          Found in plugins/db/classes/yf_db.class.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

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

              public function get_2d($sql, $use_cache = true)
              {
                  if ( ! strlen($sql)) {
                      return false;
                  }
          Severity: Minor
          Found in plugins/db/classes/yf_db.class.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

          Severity
          Category
          Status
          Source
          Language