RocketFuelLeak/RocketFuelLeakSite

View on GitHub

Showing 43 of 43 total issues

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

    def accept
        authorize! :accept, @application
        @application.accept
        respond_to do |format|
            if @application.save
Severity: Major
Found in app/controllers/applications_controller.rb and 4 other locations - About 1 hr to fix
app/controllers/applications_controller.rb on lines 113..122
app/controllers/applications_controller.rb on lines 145..154
app/controllers/forum/topics_controller.rb on lines 78..87
app/controllers/forum/topics_controller.rb on lines 94..103

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

    def lock
        authorize! :lock, @topic
        @topic.lock
        respond_to do |format|
            if @topic.save
Severity: Major
Found in app/controllers/forum/topics_controller.rb and 4 other locations - About 1 hr to fix
app/controllers/applications_controller.rb on lines 113..122
app/controllers/applications_controller.rb on lines 129..138
app/controllers/applications_controller.rb on lines 145..154
app/controllers/forum/topics_controller.rb on lines 94..103

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

    def lock
        authorize! :pin, @topic
        @topic.pin
        respond_to do |format|
            if @topic.save
Severity: Major
Found in app/controllers/forum/topics_controller.rb and 4 other locations - About 1 hr to fix
app/controllers/applications_controller.rb on lines 113..122
app/controllers/applications_controller.rb on lines 129..138
app/controllers/applications_controller.rb on lines 145..154
app/controllers/forum/topics_controller.rb on lines 78..87

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

    def create
        respond_to do |format|
            if @character.save
                format.html { redirect_to @character, notice: 'Character was successfully created.' }
                format.json { render action: 'show', status: :created, location: @character }
Severity: Major
Found in app/controllers/characters_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/comments_controller.rb on lines 29..36
app/controllers/posts_controller.rb on lines 44..51
app/controllers/users_controller.rb on lines 36..43

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

    def create
        respond_to do |format|
            if @comment.save
                format.html { redirect_to @commentable, notice: 'Comment was successfully created.' }
                format.json { render action: 'show', status: :created, location: @comment }
Severity: Major
Found in app/controllers/comments_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/characters_controller.rb on lines 55..62
app/controllers/posts_controller.rb on lines 44..51
app/controllers/users_controller.rb on lines 36..43

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

    def create
        respond_to do |format|
            if @post.save
                format.html { redirect_to @post, notice: 'Post was successfully created.' }
                format.json { render action: 'show', status: :created, location: @post }
Severity: Major
Found in app/controllers/posts_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/characters_controller.rb on lines 55..62
app/controllers/comments_controller.rb on lines 29..36
app/controllers/users_controller.rb on lines 36..43

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

    def create
        respond_to do |format|
            if @user.save
                format.html { redirect_to @user, notice: 'User was successfully created.' }
                format.json { render action: 'show', status: :created, location: @user }
Severity: Major
Found in app/controllers/users_controller.rb and 3 other locations - About 55 mins to fix
app/controllers/characters_controller.rb on lines 55..62
app/controllers/comments_controller.rb on lines 29..36
app/controllers/posts_controller.rb on lines 44..51

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

Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(data)
            @name = data['name']
            @realm = data['realm']
            if data.key? 'members'
                @members = Hash.new
Severity: Minor
Found in lib/wow/guild.rb - About 55 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 caret has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

$.fn.caret = function (begin, end) {
    if (this.length == 0)
        return;
    
    if (typeof begin == 'number') {
Severity: Minor
Found in app/assets/javascripts/jquery_caret.js - About 55 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 index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def index
        status = params[:status].downcase.to_sym if params[:status].present?
        if [:all, :closed].include? status
            @status = status
        else
Severity: Minor
Found in app/controllers/applications_controller.rb - About 55 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 6 locations. Consider refactoring.
Open

    def update
        respond_to do |format|
            if @category.update(forum_category_params)
                format.html { redirect_to @category, notice: 'Category was successfully updated.' }
                format.json { head :no_content }
Severity: Major
Found in app/controllers/forum/categories_controller.rb and 5 other locations - About 45 mins to fix
app/controllers/characters_controller.rb on lines 69..76
app/controllers/comments_controller.rb on lines 43..50
app/controllers/forum/forums_controller.rb on lines 47..54
app/controllers/forum/topics_controller.rb on lines 54..61
app/controllers/posts_controller.rb on lines 58..65

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

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

    def update
        respond_to do |format|
            if @forum.update(forum_params)
                format.html { redirect_to @forum, notice: 'Forum was successfully updated.' }
                format.json { head :no_content }
Severity: Major
Found in app/controllers/forum/forums_controller.rb and 5 other locations - About 45 mins to fix
app/controllers/characters_controller.rb on lines 69..76
app/controllers/comments_controller.rb on lines 43..50
app/controllers/forum/categories_controller.rb on lines 44..51
app/controllers/forum/topics_controller.rb on lines 54..61
app/controllers/posts_controller.rb on lines 58..65

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

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

    def update
        respond_to do |format|
            if @character.update(character_params)
                format.html { redirect_to @character, notice: 'Character was successfully updated.' }
                format.json { head :no_content }
Severity: Major
Found in app/controllers/characters_controller.rb and 5 other locations - About 45 mins to fix
app/controllers/comments_controller.rb on lines 43..50
app/controllers/forum/categories_controller.rb on lines 44..51
app/controllers/forum/forums_controller.rb on lines 47..54
app/controllers/forum/topics_controller.rb on lines 54..61
app/controllers/posts_controller.rb on lines 58..65

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

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

    def update
        respond_to do |format|
            if @post.update(post_params)
                format.html { redirect_to @post, notice: 'Post was successfully updated.' }
                format.json { head :no_content }
Severity: Major
Found in app/controllers/posts_controller.rb and 5 other locations - About 45 mins to fix
app/controllers/characters_controller.rb on lines 69..76
app/controllers/comments_controller.rb on lines 43..50
app/controllers/forum/categories_controller.rb on lines 44..51
app/controllers/forum/forums_controller.rb on lines 47..54
app/controllers/forum/topics_controller.rb 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 41.

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

    def update
        respond_to do |format|
            if @comment.update(comment_params)
                format.html { redirect_to @commentable, notice: 'Comment was successfully updated.' }
                format.json { head :no_content }
Severity: Major
Found in app/controllers/comments_controller.rb and 5 other locations - About 45 mins to fix
app/controllers/characters_controller.rb on lines 69..76
app/controllers/forum/categories_controller.rb on lines 44..51
app/controllers/forum/forums_controller.rb on lines 47..54
app/controllers/forum/topics_controller.rb on lines 54..61
app/controllers/posts_controller.rb on lines 58..65

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

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

    def update
        respond_to do |format|
            if @topic.update(topic_params)
                format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }
                format.json { head :no_content }
Severity: Major
Found in app/controllers/forum/topics_controller.rb and 5 other locations - About 45 mins to fix
app/controllers/characters_controller.rb on lines 69..76
app/controllers/comments_controller.rb on lines 43..50
app/controllers/forum/categories_controller.rb on lines 44..51
app/controllers/forum/forums_controller.rb on lines 47..54
app/controllers/posts_controller.rb on lines 58..65

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

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 deeply nested control flow statements.
Open

                  if (!found) {
                    //print("not found. l:", uneval(l));
                    wanted_depth++;
                    if ( wanted_depth <= stack.length ) {
                      stack.splice(wanted_depth, stack.length - wanted_depth);
Severity: Major
Found in app/assets/javascripts/markdown.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                      for ( i = 0; i < stack.length; i++ ) {
                        if ( stack[ i ].indent !== m[1] )
                          continue;
    
                        list = stack[ i ].list;
    Severity: Major
    Found in app/assets/javascripts/markdown.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if ( --open_parens === 0) {
                        consumed -= url.length - len;
                        url = url.substring(0, len);
                      }
      Severity: Major
      Found in app/assets/javascripts/markdown.js - About 45 mins to fix

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

            def patch_confirm
                if current_user.character
                    if current_user.character.confirmed
                        flash[:error] = 'You have already confirmed your character.'
                        redirect_to root_path
        Severity: Minor
        Found in app/controllers/characters_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

        Severity
        Category
        Status
        Source
        Language