XoopsModules25x/apcal

View on GitHub

Showing 26,336 of 26,336 total issues

Function HistogramStretch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function HistogramStretch(&$gdimg, $band = '*', $method = 0, $threshold = 0.1)
    {
        // equivalent of "Auto Contrast" in Adobe Photoshop
        // method 0 stretches according to RGB colors. Gives a more conservative stretch.
        // method 1 band stretches according to grayscale which is color-biased (59% green, 30% red, 11% blue). May give a punchier / more aggressive stretch, possibly appearing over-saturated
Severity: Minor
Found in thumbs/phpthumb.filters.php - About 3 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

Function URLreadFsock has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public static function URLreadFsock($host, $file, &$errstr, $successonly = true, $port = 80, $timeout = 10)
    {
        if (!function_exists('fsockopen') || phpthumb_functions::FunctionIsDisabled('fsockopen')) {
            $errstr = 'fsockopen() unavailable';

Severity: Minor
Found in thumbs/phpthumb.functions.php - About 3 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 ErrorImage has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function ErrorImage($text, $width = 0, $height = 0, $forcedisplay = false)
    {
        $width  = ($width ?: $this->config_error_image_width);
        $height = ($height ?: $this->config_error_image_height);

Severity: Major
Found in thumbs/phpthumb.class.php - About 3 hrs to fix

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

                this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
                    && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
    Severity: Major
    Found in assets/images/js/highslide/highslide-full.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-with-gallery.js on lines 1824..1825
    assets/images/js/highslide/highslide-with-html.js on lines 1820..1821
    assets/images/js/highslide/highslide.js on lines 1380..1381

    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 103.

    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 4 locations. Consider refactoring.
    Open

                this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
                    && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
    Severity: Major
    Found in assets/images/js/highslide/highslide.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-full.js on lines 2325..2326
    assets/images/js/highslide/highslide-with-gallery.js on lines 1824..1825
    assets/images/js/highslide/highslide-with-html.js on lines 1820..1821

    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 103.

    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 4 locations. Consider refactoring.
    Open

                this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
                    && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
    Severity: Major
    Found in assets/images/js/highslide/highslide-with-gallery.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-full.js on lines 2325..2326
    assets/images/js/highslide/highslide-with-html.js on lines 1820..1821
    assets/images/js/highslide/highslide.js on lines 1380..1381

    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 103.

    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 4 locations. Consider refactoring.
    Open

                this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
                    && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
    Severity: Major
    Found in assets/images/js/highslide/highslide-with-html.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-full.js on lines 2325..2326
    assets/images/js/highslide/highslide-with-gallery.js on lines 1824..1825
    assets/images/js/highslide/highslide.js on lines 1380..1381

    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 103.

    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

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

            if ($this->m_img->m_gih->m_bLocalClr) {
                $nColors = $this->m_img->m_gih->m_nTableSize;
                $rgbq    = $this->m_img->m_gih->m_colorTable->toRGBQuad();
                if ($bgColor != -1) {
                    $bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
    Severity: Major
    Found in thumbs/phpthumb.gif.php and 1 other location - About 3 hrs to fix
    thumbs/phpthumb.gif.php on lines 1147..1162

    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 150.

    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

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

            if ($this->m_img->m_gih->m_bLocalClr) {
                $nColors = $this->m_img->m_gih->m_nTableSize;
                $pal     = $this->m_img->m_gih->m_colorTable->toString();
                if ($bgColor != -1) {
                    $bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
    Severity: Major
    Found in thumbs/phpthumb.gif.php and 1 other location - About 3 hrs to fix
    thumbs/phpthumb.gif.php on lines 1044..1059

    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 150.

    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 4 locations. Consider refactoring.
    Open

            connectOutline: function () {
                var outline = this.outline = hs.pendingOutlines[this.outlineType];
                outline.exp = this;
                outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
                hs.pendingOutlines[this.outlineType] = null;
    Severity: Major
    Found in assets/images/js/highslide/highslide-full.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-with-gallery.js on lines 1270..1275
    assets/images/js/highslide/highslide-with-html.js on lines 1262..1267
    assets/images/js/highslide/highslide.js on lines 1081..1086

    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 102.

    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 4 locations. Consider refactoring.
    Open

            connectOutline: function () {
                var outline = this.outline = hs.pendingOutlines[this.outlineType];
                outline.exp = this;
                outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
                hs.pendingOutlines[this.outlineType] = null;
    Severity: Major
    Found in assets/images/js/highslide/highslide.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-full.js on lines 1467..1472
    assets/images/js/highslide/highslide-with-gallery.js on lines 1270..1275
    assets/images/js/highslide/highslide-with-html.js on lines 1262..1267

    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 102.

    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 4 locations. Consider refactoring.
    Open

            connectOutline: function () {
                var outline = this.outline = hs.pendingOutlines[this.outlineType];
                outline.exp = this;
                outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
                hs.pendingOutlines[this.outlineType] = null;
    Severity: Major
    Found in assets/images/js/highslide/highslide-with-html.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-full.js on lines 1467..1472
    assets/images/js/highslide/highslide-with-gallery.js on lines 1270..1275
    assets/images/js/highslide/highslide.js on lines 1081..1086

    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 102.

    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 4 locations. Consider refactoring.
    Open

            connectOutline: function () {
                var outline = this.outline = hs.pendingOutlines[this.outlineType];
                outline.exp = this;
                outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
                hs.pendingOutlines[this.outlineType] = null;
    Severity: Major
    Found in assets/images/js/highslide/highslide-with-gallery.js and 3 other locations - About 3 hrs to fix
    assets/images/js/highslide/highslide-full.js on lines 1467..1472
    assets/images/js/highslide/highslide-with-html.js on lines 1262..1267
    assets/images/js/highslide/highslide.js on lines 1081..1086

    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 102.

    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

    The class PatTemplate has 31 non-getter- and setter-methods. Consider refactoring PatTemplate to keep number of methods under 25.
    Open

        class PatTemplate
        {
            /**
             * Constructor
             *
    Severity: Minor
    Found in include/patTemplate.php by phpmd

    TooManyMethods

    Since: 0.1

    A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    The default was changed from 10 to 25 in PHPMD 2.3.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanymethods

    The class Text_Diff_Renderer has 13 public methods. Consider refactoring Text_Diff_Renderer to keep number of public methods under 10.
    Open

    class Text_Diff_Renderer
    {
        /**
         * Number of leading context "lines" to preserve.
         *
    Severity: Minor
    Found in include/Text_Diff_Renderer.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class PatTemplate has an overall complexity of 198 which is very high. The configured complexity threshold is 50.
    Open

        class PatTemplate
        {
            /**
             * Constructor
             *
    Severity: Minor
    Found in include/patTemplate.php by phpmd

    The class Text_Diff_Engine_native has an overall complexity of 95 which is very high. The configured complexity threshold is 50.
    Open

    class Text_Diff_Engine_native
    {
        /**
         * @param $from_lines
         * @param $to_lines
    Severity: Minor
    Found in include/Text_Diff.php by phpmd

    The class PatTemplate has 31 public methods. Consider refactoring PatTemplate to keep number of public methods under 10.
    Open

        class PatTemplate
        {
            /**
             * Constructor
             *
    Severity: Minor
    Found in include/patTemplate.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class APCal has an overall complexity of 792 which is very high. The configured complexity threshold is 50.
    Open

        class APCal
        {
            // SKELTON (they will be defined in language files)
            public $holidays           = array();
            public $date_short_names   = array();
    Severity: Minor
    Found in class/APCal.php by phpmd

    The class APCal has 29 non-getter- and setter-methods. Consider refactoring APCal to keep number of methods under 25.
    Open

        class APCal
        {
            // SKELTON (they will be defined in language files)
            public $holidays           = array();
            public $date_short_names   = array();
    Severity: Minor
    Found in class/APCal.php by phpmd

    TooManyMethods

    Since: 0.1

    A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    The default was changed from 10 to 25 in PHPMD 2.3.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanymethods

    Severity
    Category
    Status
    Source
    Language