mambax7/smartfaq

View on GitHub

Showing 649 of 649 total issues

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

function isFunction(fnRef) {
    var rtn = true;

    if (typeof fnRef == 'object') {
        for (var i = 0; i < fnRef.length; i++) {
Severity: Minor
Found in assets/js/overlib/overlib.js - 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

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

function parseFrameExtras(pf, i, ar) {
    var k = i, v;

    if (k < ar.length) {
        if (ar[k] == FRAME) {
Severity: Minor
Found in assets/js/overlib/overlib_crossframe.js - 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

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

function disp(statustext) {
    runHook("disp", FBEFORE);
    if (o3_allowmove == 0) {
        runHook("placeLayer", FREPLACE);
        (olNs6 && olShowId < 0) ? olShowId = setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over);
Severity: Minor
Found in assets/js/overlib/mini/overlib_mini.js - 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

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

function cleanUpShadowEffects() {
    if (olNs4) return;
    else {
        var dpObj = (olIe4 ? o3_frame.document.all['backdrop'] : o3_frame.document.getElementById('backdrop'));
        if (olIe4 && !isMac && dpObj.filters.Beta) dpObj.filters.Beta.enabled = false;
Severity: Minor
Found in assets/js/overlib/overlib_shadow.js - 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

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

function parseFrameExtras(pf, i, ar) {
    var k = i, v;
    if (k < ar.length) {
        if (ar[k] == FRAME) {
            v = ar[++k];
Severity: Minor
Found in assets/js/overlib/mini/overlib_crossframe_mini.js - 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

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

function cleanUpShadowEffects() {
    if (olNs4) return; else {
        var dpObj = (olIe4 ? o3_frame.document.all['backdrop'] : o3_frame.document.getElementById('backdrop'));
        if (olIe4 && !isMac && dpObj.filters.Beta) dpObj.filters.Beta.enabled = false; else if (typeof(dpObj.style.MozOpacity) == 'string') dpObj.style.MozOpacity = 1.0;
    }
Severity: Minor
Found in assets/js/overlib/mini/overlib_shadow_mini.js - 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

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

function layerWrite(txt) {
    txt += "\n";
    if (olNs4) {
        var lyr = o3_frame.document.overDiv.document
        lyr.write(txt)
Severity: Minor
Found in assets/js/overlib/mini/overlib_mini.js - 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

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

function isFunction(fnRef) {
    var rtn = true;
    if (typeof fnRef == 'object') {
        for (var i = 0; i < fnRef.length; i++) {
            if (typeof fnRef[i] == 'function') continue;
Severity: Minor
Found in assets/js/overlib/mini/overlib_mini.js - 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

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

function opt_MULTIPLEARGS(i, args, parameter) {
    var k = i, l, re, pV, str = '';

    for (k = i; k < args.length; k++) {
        str += args[k] + ',';
Severity: Minor
Found in assets/js/overlib/overlib.js - 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

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

    public static function getEditor($helper = null, $options = null)
    {
        /** @var Helper $helper */
        if (null === $options) {
            $options           = [];
Severity: Minor
Found in class/Common/SysUtility.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

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

function xoops_module_update_smartfaq($module)
{
    /*
    // Load SmartDbUpdater from the SmartObject Framework if present
    $smartdbupdater = XOOPS_ROOT_PATH . '/modules/smartobject/class/smartdbupdater.php';
Severity: Minor
Found in include/onupdate.inc.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

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

    public function __construct($id = null)
    {
        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
        $this->initVar('categoryid', \XOBJ_DTYPE_INT, null, false);
        $this->initVar('parentid', \XOBJ_DTYPE_INT, null, false);
Severity: Minor
Found in class/Category.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

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

    public function toArray($faq = [], $category = null, $linkInQuestion = true)
    {
        /** @var Smartfaq\Helper $helper */
        $helper = Smartfaq\Helper::getInstance();

Severity: Minor
Found in class/Faq.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

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

    private function renderOptionTree(&$tree, $option, $prefix, $parentIds = []): void
    {
        $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="';
        // If there are parent elements, add javascript that will
        // make them selecteded when this element is checked to make
Severity: Minor
Found in class/GroupFormCheckBox.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

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

    public function __construct($id = null)
    {
        $this->db = \XoopsDatabaseFactory::getDatabaseConnection();
        $this->initVar('answerid', \XOBJ_DTYPE_INT, null, false);
        $this->initVar('status', \XOBJ_DTYPE_INT, -1, false);
Severity: Minor
Found in class/Answer.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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function setShadowVariables() {
    o3_shadow = ol_shadow;
    o3_shadowcolor = ol_shadowcolor;
    o3_shadowimage = ol_shadowimage;
    o3_shadowopacity = ol_shadowopacity;
Severity: Minor
Found in assets/js/overlib/overlib_shadow.js and 1 other location - About 35 mins to fix
assets/js/overlib/mini/overlib_shadow_mini.js on lines 26..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function setShadowVariables() {
    o3_shadow = ol_shadow;
    o3_shadowcolor = ol_shadowcolor;
    o3_shadowimage = ol_shadowimage;
    o3_shadowopacity = ol_shadowopacity;
Severity: Minor
Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 35 mins to fix
assets/js/overlib/overlib_shadow.js on lines 54..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this function.
Open

            return k;
Severity: Major
Found in assets/js/overlib/mini/overlib_cssstyle_mini.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return false
    Severity: Major
    Found in assets/js/overlib/mini/overlib_anchor_mini.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return k;
      Severity: Major
      Found in assets/js/overlib/mini/overlib_cssstyle_mini.js - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language