techvision/brails4

View on GitHub

Showing 157 of 157 total issues

Avoid too many return statements within this function.
Open

      return false;
Severity: Major
Found in app/assets/javascripts/tabPanel.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return false;
    Severity: Major
    Found in app/assets/javascripts/tabPanel.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return true;
      Severity: Major
      Found in app/assets/javascripts/tabPanel.js - About 30 mins to fix

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

            this.$panel.find('#' + $newTab.attr('aria-controls')).show().attr('aria-hidden', 'false');
        Severity: Minor
        Found in app/assets/javascripts/tabPanel.js and 1 other location - About 30 mins to fix
        app/assets/javascripts/tabPanel.js on lines 89..89

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

        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 true;
        Severity: Major
        Found in app/assets/javascripts/tabPanel.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return this
          Severity: Major
          Found in app/assets/javascripts/bootstrap.js - About 30 mins to fix

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

                                            comments = dc.range[dc.range.current.month].comments[dc.range.current.year],
            Severity: Minor
            Found in app/assets/javascripts/calendar_generator.js and 2 other locations - About 30 mins to fix
            app/assets/javascripts/calendar_generator.js on lines 286..286
            app/assets/javascripts/calendar_generator.js on lines 387..387

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

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

                                                                var tooltipDC = dc.children[0], year = dc.range[dc.range.current.month].comments[dc.range.current.year],
            Severity: Minor
            Found in app/assets/javascripts/calendar_generator.js and 2 other locations - About 30 mins to fix
            app/assets/javascripts/calendar_generator.js on lines 286..286
            app/assets/javascripts/calendar_generator.js on lines 288..288

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

            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

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

            function ytAttachEventListener(target, eventType, functionRef, capture)
            {
              if (typeof target.addEventListener != "undefined") 
              {
                target.addEventListener(eventType, functionRef, capture);
            Severity: Minor
            Found in app/assets/javascripts/ytp.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 4 locations. Consider refactoring.
            Open

              def find_questionable
                klass = [Level,Topic,Content].detect { |c| params["#{c.name.underscore}_id"]}
                @questionable = klass.find(params["#{klass.name.underscore}_id"])
            Severity: Minor
            Found in app/controllers/questions_controller.rb and 3 other locations - About 25 mins to fix
            app/controllers/admin/questions_controller.rb on lines 58..60
            app/controllers/attempts_controller.rb on lines 33..35
            app/controllers/comments_controller.rb on lines 56..58

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

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

              def find_questionable
                klass = [Level,Topic,Content].detect { |c| params["#{c.name.underscore}_id"]}
                @questionable = klass.find(params["#{klass.name.underscore}_id"])
            Severity: Minor
            Found in app/controllers/admin/questions_controller.rb and 3 other locations - About 25 mins to fix
            app/controllers/attempts_controller.rb on lines 33..35
            app/controllers/comments_controller.rb on lines 56..58
            app/controllers/questions_controller.rb on lines 10..12

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

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

              def find_attemptable
                klass = [Level,Topic,Content].detect { |c| params["#{c.name.underscore}_id"]}
                @attemptable = klass.find(params["#{klass.name.underscore}_id"])
            Severity: Minor
            Found in app/controllers/attempts_controller.rb and 3 other locations - About 25 mins to fix
            app/controllers/admin/questions_controller.rb on lines 58..60
            app/controllers/comments_controller.rb on lines 56..58
            app/controllers/questions_controller.rb on lines 10..12

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

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

              def find_commentable
                klass = [Level,Topic,Content].detect { |c| params["#{c.name.underscore}_id"]}
                @commentable = klass.find(params["#{klass.name.underscore}_id"])
            Severity: Minor
            Found in app/controllers/comments_controller.rb and 3 other locations - About 25 mins to fix
            app/controllers/admin/questions_controller.rb on lines 58..60
            app/controllers/attempts_controller.rb on lines 33..35
            app/controllers/questions_controller.rb on lines 10..12

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

            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

              def destroy
                @content = Content.find(params[:id])
                if @content.destroy
                  redirect_to admin_topic_contents_path(@content.topic_id), notice: "Content successfully deleted."
                else
            Severity: Minor
            Found in app/controllers/admin/contents_controller.rb and 1 other location - About 15 mins to fix
            app/controllers/admin/topics_controller.rb on lines 43..49

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

            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

              def update
                @content = Content.find(params[:id])
                if @content.update_attributes(content_params)
                  redirect_to admin_topic_path(@content.topic_id), notice: "Content successfully updated."
                else
            Severity: Minor
            Found in app/controllers/admin/contents_controller.rb and 1 other location - About 15 mins to fix
            app/controllers/admin/topics_controller.rb on lines 34..40

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

            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

              def destroy
                @topic = Topic.find(params[:id])
                if @topic.destroy
                  redirect_to admin_level_path(@topic.level_id), notice: "Topic successfully deleted."
                else
            Severity: Minor
            Found in app/controllers/admin/topics_controller.rb and 1 other location - About 15 mins to fix
            app/controllers/admin/contents_controller.rb on lines 41..47

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

            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

              def update
                @topic = Topic.find(params[:id])
                if @topic.update_attributes(topic_params)
                  redirect_to admin_level_path(@topic.level_id), notice: "Topic successfully updated."
                else
            Severity: Minor
            Found in app/controllers/admin/topics_controller.rb and 1 other location - About 15 mins to fix
            app/controllers/admin/contents_controller.rb on lines 32..38

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

            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

            Severity
            Category
            Status
            Source
            Language