ImpressCMS/impresscms

View on GitHub
htdocs/include/color-picker.js

Summary

Maintainability
C
1 day
Test Coverage

Function TCGenerateMac has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function TCGenerateMac() {
    var s = '';
    var c = 0,n = 1;
    var r,g,b;
    for (j = 0; j < 15; j ++) {
Severity: Minor
Found in htdocs/include/color-picker.js - About 2 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 TCDraw has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function TCDraw(o_win, o_doc) {
    this.win = o_win;
    this.doc = o_doc;
    var 
    s_tag_openT  = o_doc.layers ? 
Severity: Minor
Found in htdocs/include/color-picker.js - About 2 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 TCGenerateMac has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function TCGenerateMac() {
    var s = '';
    var c = 0,n = 1;
    var r,g,b;
    for (j = 0; j < 15; j ++) {
Severity: Minor
Found in htdocs/include/color-picker.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                        if(n<=14){
                            r = 255-(n * 17);
                            g=b=0;
                        }else if(n>14 && n<=28){
                            g = 255-((n-14) * 17);
    Severity: Major
    Found in htdocs/include/color-picker.js - About 45 mins to fix

      Function TCBuildCell has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function TCBuildCell (R, G, B, w, h) {
      Severity: Minor
      Found in htdocs/include/color-picker.js - About 35 mins to fix

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

        function TCPaint(c, b_noPref) {
            c = (b_noPref ? '' : '#') + c.toUpperCase();
            if (this.o_samp) 
                this.o_samp.innerHTML = '<font face=Tahoma size=2>' + c +' <font color=white>' + c + '</font></font>'
            if(this.doc.layers)
        Severity: Minor
        Found in htdocs/include/color-picker.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 TCGenerateSafe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function TCGenerateSafe() {
            var s = '';
            for (j = 0; j < 12; j ++) {
                s += "<tr>";
                for (k = 0; k < 3; k ++)
        Severity: Minor
        Found in htdocs/include/color-picker.js - 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 TCGenerateWind has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function TCGenerateWind() {
            var s = '';
            for (j = 0; j < 12; j ++) {
                s += "<tr>";
                for (k = 0; k < 3; k ++)
        Severity: Minor
        Found in htdocs/include/color-picker.js - 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

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

            this.hide = document.layers ? 
                function (div) { this.divs[div].visibility = 'hide' } :
                function (div) { this.divs[div].visibility = 'hidden' };
        Severity: Major
        Found in htdocs/include/color-picker.js and 1 other location - About 1 hr to fix
        htdocs/include/color-picker.js on lines 130..132

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

        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

            this.show = document.layers ? 
                function (div) { this.divs[div].visibility = 'show' } :
                function (div) { this.divs[div].visibility = 'visible' };
        Severity: Major
        Found in htdocs/include/color-picker.js and 1 other location - About 1 hr to fix
        htdocs/include/color-picker.js on lines 133..135

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

        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

        Unexpected trailing spaces found.
        Open

            if (this.o_samp) 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            else { 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

                ',left=' + ((screen.width - w) >> 1) + ',top=' + ((screen.height - h) >> 1) : '', 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            var 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            move = screen ? 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

                    ? o_doc.layers['p' + k] : o_doc.all 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            this.show = document.layers ? 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            s_tag_openT  = o_doc.layers ? 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            return s    
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

                'layer visibility=hidden top=30 left=5 width=182' : 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

                
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

                this.divs[k] = o_doc.layers 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            this.hide = document.layers ? 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            this.sample = o_doc.layers ? o_doc.layers['sam'] : 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

            if (!o_doc.layers && o_doc.body.innerHTML) 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        Unexpected trailing spaces found.
        Open

                this.o_samp = o_doc.all 
        Severity: Minor
        Found in htdocs/include/color-picker.js by editorconfig

        There are no issues that match your filters.

        Category
        Status