sleepepi/sleepportal

View on GitHub

Showing 436 of 436 total issues

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

        init: function (el, values, options, width, height) {
Severity: Minor
Found in app/assets/javascripts/external/jquery.sparkline.js - About 35 mins to fix

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

            _drawShape: function (shapeid, path, lineColor, fillColor, lineWidth) {
    Severity: Minor
    Found in app/assets/javascripts/external/jquery.sparkline.js - About 35 mins to fix

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

              init: function (el, values, options, width, height) {
      Severity: Minor
      Found in app/assets/javascripts/external/jquery.sparkline.js - About 35 mins to fix

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

                drawNormalRange: function (canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey) {
        Severity: Minor
        Found in app/assets/javascripts/external/jquery.sparkline.js - About 35 mins to fix

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

                  init: function (el, values, options, width, height) {
          Severity: Minor
          Found in app/assets/javascripts/external/jquery.sparkline.js - About 35 mins to fix

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

                    if (color && color.linearGradient) {
                        gradName = 'linearGradient';
                    } else if (color && color.radialGradient) {
                        gradName = 'radialGradient';
                    }
            Severity: Minor
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 5228..5232

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

            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 (color && color.linearGradient) {
                        fillType = 'gradient';
                    } else if (color && color.radialGradient) {
                        fillType = 'pattern';
                    }
            Severity: Minor
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 3947..3951

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

            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 (leftContY > lastY && leftContY > plotY) {
                            leftContY = mathMax(lastY, plotY);
                            rightContY = 2 * plotY - leftContY; // mirror of left control point
                        } else if (leftContY < lastY && leftContY < plotY) {
                            leftContY = mathMin(lastY, plotY);
            Severity: Minor
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 15544..15550

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

            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 (rightContY > nextY && rightContY > plotY) {
                            rightContY = mathMax(nextY, plotY);
                            leftContY = 2 * plotY - rightContY;
                        } else if (rightContY < nextY && rightContY < plotY) {
                            rightContY = mathMin(nextY, plotY);
            Severity: Minor
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 15537..15543

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

            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

            Method file_type_count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def file_type_count(current_user, file_type)
                source_files = {}
                selected_report_concepts = []
                Variable.current.with_source(self.sources.collect{|s| s.id}).where( variable_type: 'file' ).each do |variable|
                  selected_report_concepts << ReportConcept.new( variable_id: variable.id )
            Severity: Minor
            Found in app/models/search.rb - 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 map has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              Array.prototype.map = function(fun /*, thisp*/)
              {
                var len = this.length;
                if (typeof fun != "function")
                  throw new TypeError();
            Severity: Minor
            Found in app/assets/javascripts/compatibility/prototype_map.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

            Method set_searches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_searches
                  @cases = current_user.all_searches.find_by_id(params[:cases_id])
                  @controls = current_user.all_searches.find_by_id(params[:controls_id])
                  @controls_per_case = (params[:controls_per_case].to_i <= 4 and params[:controls_per_case].to_i >= 1) ? params[:controls_per_case].to_i : 1
                  @sources = (@cases ? @cases.sources.to_a : []) & (@controls ? @controls.sources.to_a : [])
            Severity: Minor
            Found in app/controllers/matching_controller.rb - 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

            Method table_columns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def table_columns(current_user, table, page = 1, per_page = -1, filter_unmapped = false, search = '')
                result_hash = Aqueduct::Builder.wrapper(self, current_user).table_columns(table)
            
                columns = result_hash[:columns]
                error = result_hash[:error]
            Severity: Minor
            Found in app/models/source.rb - 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

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

                                if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
                                    if ($(data.results).filter(
                                        function () {
                                            return equal(self.id(this), self.id(def));
                                        }).length === 0) {
            Severity: Minor
            Found in app/assets/javascripts/external/select2.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/select2.js on lines 475..484

            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

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

                    pressedState = merge(normalState, {
                        stroke: '#68A',
                        fill: {
                            linearGradient: verticalGradient,
                            stops: [
            Severity: Minor
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 3445..3454

            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

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

                                    return (this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px');
            Severity: Minor
            Found in app/assets/javascripts/external/select2.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/select2.js on lines 1333..1333

            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

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

                    hoverState = merge(normalState, {
                        stroke: '#68A',
                        fill: {
                            linearGradient: verticalGradient,
                            stops: [
            Severity: Minor
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 3459..3468

            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

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

                                return this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px';
            Severity: Minor
            Found in app/assets/javascripts/external/select2.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/select2.js on lines 1354..1354

            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

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

                            if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
                                dupe = false;
                                for (i = 0, l = selection.length; i < l; i++) {
                                    if (equal(opts.id(token), opts.id(selection[i]))) {
                                        dupe = true; break;
            Severity: Minor
            Found in app/assets/javascripts/external/select2.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/external/select2.js on lines 1238..1245

            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;
            Severity: Major
            Found in app/assets/javascripts/external/select2.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language