kai-jacobsen/kontentblocks

View on GitHub

Showing 398 of 4,293 total issues

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

    function save($postId, $postObj)
    {

        $request = Utilities::getRequest();
        // get the real postId
Severity: Minor
Found in core/Backend/EditScreens/PostEditScreen.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 addScript has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function addScript($args, $where = 'both')
    {
        $defaults = array(
            'handle' => null,
            'src' => null,
Severity: Minor
Found in core/Hooks/Enqueues.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 validateBoolRecursive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function validateBoolRecursive($array)
    {
        foreach ($array as $k => $v) {

            if (is_array($v)) {
Severity: Minor
Found in core/Utils/Utilities.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 set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function set($data)
    {
        if (is_array($data)) {
            foreach ($data as $key => $v) {
                if (is_null($v)) {
Severity: Minor
Found in core/Common/Data/ValueObject.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 setupData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setupData($modData, $addData)
    {
        if ($addData) {
            $data = wp_parse_args($addData, $modData);
        } else {
Severity: Minor
Found in core/Templating/ModuleView.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 getSize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSize($size = 'thumbnail', $crop = true, $upscale = true)
    {
        if (!isset($this->file['sizes']) && !is_array($size)) {
            return null;
        }
Severity: Minor
Found in core/Utils/AttachmentHandler.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 export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function export()
    {
        $data = $this->data;
        $exportData = [];
        foreach ($data as $key => $value) {
Severity: Minor
Found in core/Common/Data/ValueObject.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 renderFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderFields()
    {
        $out = '';
        $subtabs = apply_filters('kb.fields.subtabs', false);
        if ($this->section->args['subtabs'] === true) {
Severity: Minor
Found in core/Fields/Renderer/RenderSection.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 addFieldTemplate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addFieldTemplate($tplid)
    {
        $registry = fieldRegistry();
        $tplid = (array)$tplid;
        foreach ($tplid as $id) {
Severity: Minor
Found in core/Fields/Definitions/FlexFields/FlexFieldsSection.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setup()
    {
        $options = get_site_option('kb.capabilities.setup');
        if (empty($options)) {
            update_site_option('kb.capabilities.setup', time());
Severity: Minor
Found in core/Hooks/Capabilities.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 addGroup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addGroup($groupkey, $args = array())
    {
        if (!isset($args['priority']) || is_numeric($args['priority'])) {
            $args['priority'] = $this->getPriorityIndex();
        }
Severity: Minor
Found in core/Fields/StandardFieldSection.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 getExportValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getExportValue()
    {
        $data = '';
        if (empty($this->getArg('context', null))) {
            return $data;
Severity: Minor
Found in core/Fields/Definitions/Context.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 flattenFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function flattenFields()
    {
        $flat = array();
        $types = $this->getArg('fields');
        /** @var FlexFieldsType $type */
Severity: Minor
Found in core/Fields/Definitions/FlexibleFields.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 setupModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setupModules($modules)
    {
        $collect = array();
        if (empty($modules)) {
            return $collect;
Severity: Minor
Found in core/Frontend/ModuleIterator.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 uploadFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function uploadFilter($param)
    {

        $dir = filter_input(INPUT_POST, 'upload_folder', FILTER_DEFAULT, FILTER_SANITIZE_STRING);

Severity: Minor
Found in core/Fields/Definitions/File.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 imageTag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function imageTag($withsizes = false, $alt = false)
    {
        if (is_null($this->src)) {
            $this->resize();
        }
Severity: Minor
Found in core/Fields/Definitions/ReturnObjects/ImageReturn.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 uploadFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function uploadFilter($param)
    {


        $dir = filter_input(INPUT_POST, 'upload_folder', FILTER_DEFAULT, FILTER_SANITIZE_STRING);
Severity: Minor
Found in core/Fields/Definitions/FileMultiple.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 addFieldTemplate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addFieldTemplate($tplid)
    {
        $registry = fieldRegistry();
        $tplid = (array)$tplid;
        foreach ($tplid as $id) {
Severity: Minor
Found in core/Fields/StandardFieldSection.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