consul/consul

View on GitHub
spec/lib/graphql_spec.rb

Summary

Maintainability
F
3 days
Test Coverage

File graphql_spec.rb has 468 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "rails_helper"

def execute(query_string, context = {}, variables = {})
  ConsulSchema.execute(query_string, context: context, variables: variables)
end
Severity: Minor
Found in spec/lib/graphql_spec.rb - About 7 hrs to fix

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

        it "only retruns tags with kind nil or category" do
          create(:tag, name: "Parks")
          create(:tag, :category, name: "Health")
          create(:tag, name: "Admin tag", kind: "admin")
    
    
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 1 other location - About 1 hr to fix
    spec/lib/graphql_spec.rb on lines 240..250

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

    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

        it "only retruns tags with kind nil or category" do
          create(:tag, name: "Parks")
          create(:tag, :category, name: "Health")
          create(:tag, name: "Admin tag", kind: "admin")
    
    
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 1 other location - About 1 hr to fix
    spec/lib/graphql_spec.rb on lines 172..182

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

    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

        it "does not include votes of comments from a hidden debate" do
          visible_debate = create(:debate)
          hidden_debate  = create(:debate, :hidden)
    
          create(:comment, id: 1, commentable: visible_debate, voters: [create(:user)])
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 1 other location - About 1 hr to fix
    spec/lib/graphql_spec.rb on lines 579..589

    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

        it "does not include votes of comments from a hidden proposal" do
          visible_proposal = create(:proposal)
          hidden_proposal  = create(:proposal, :hidden)
    
          create(:comment, id: 1, commentable: visible_proposal, voters: [create(:user)])
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 1 other location - About 1 hr to fix
    spec/lib/graphql_spec.rb on lines 592..602

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

        it "includes debates of authors even if public activity is set to false" do
          visible_author = create(:user, public_activity: true)
          hidden_author  = create(:user, public_activity: false)
    
          visible_debate = create(:debate, author: visible_author)
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 55 mins to fix
    spec/lib/graphql_spec.rb on lines 139..149
    spec/lib/graphql_spec.rb on lines 267..277

    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

        it "includes proposals of authors even if public activity is set to false" do
          visible_author = create(:user, public_activity: true)
          hidden_author  = create(:user, public_activity: false)
    
          visible_proposal = create(:proposal, author: visible_author)
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 55 mins to fix
    spec/lib/graphql_spec.rb on lines 207..217
    spec/lib/graphql_spec.rb on lines 267..277

    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

        it "displays comments of authors even if public activity is set to false" do
          visible_author = create(:user, public_activity: true)
          hidden_author  = create(:user, public_activity: false)
    
          visible_comment = create(:comment, user: visible_author)
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 55 mins to fix
    spec/lib/graphql_spec.rb on lines 139..149
    spec/lib/graphql_spec.rb on lines 207..217

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

        it "does not include comments from hidden debates" do
          visible_debate = create(:debate)
          hidden_debate  = create(:debate, :hidden)
    
          create(:comment, commentable: visible_debate, body: "I can see the debate")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 45 mins to fix
    spec/lib/graphql_spec.rb on lines 300..310
    spec/lib/graphql_spec.rb on lines 326..336
    spec/lib/graphql_spec.rb on lines 416..426

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

    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

        it "does not include comments from hidden proposals" do
          visible_proposal = create(:proposal)
          hidden_proposal  = create(:proposal, :hidden)
    
          create(:comment, commentable: visible_proposal, body: "I can see the proposal")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 45 mins to fix
    spec/lib/graphql_spec.rb on lines 313..323
    spec/lib/graphql_spec.rb on lines 326..336
    spec/lib/graphql_spec.rb on lines 416..426

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

    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

        it "does not include comments from hidden polls" do
          visible_poll = create(:poll)
          hidden_poll  = create(:poll, :hidden)
    
          create(:comment, commentable: visible_poll, body: "I can see the poll")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 45 mins to fix
    spec/lib/graphql_spec.rb on lines 300..310
    spec/lib/graphql_spec.rb on lines 313..323
    spec/lib/graphql_spec.rb on lines 416..426

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

    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

        it "does not include proposal notifications for hidden proposals" do
          visible_proposal = create(:proposal)
          hidden_proposal  = create(:proposal, :hidden)
    
          create(:proposal_notification, proposal: visible_proposal, title: "I can see the proposal")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 45 mins to fix
    spec/lib/graphql_spec.rb on lines 300..310
    spec/lib/graphql_spec.rb on lines 313..323
    spec/lib/graphql_spec.rb on lines 326..336

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

    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

        it "does not include votes of hidden comments" do
          create(:comment, id: 1, voters: [create(:user)])
          create(:comment, :hidden, id: 2, voters: [create(:user)])
    
          response = execute("{ votes { edges { node { votable_id } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 40 mins to fix
    spec/lib/graphql_spec.rb on lines 549..556
    spec/lib/graphql_spec.rb on lines 559..566

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

    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

        it "does not include votes from hidden debates" do
          create(:debate, id: 1, voters: [create(:user)])
          create(:debate, :hidden, id: 2, voters: [create(:user)])
    
          response = execute("{ votes { edges { node { votable_id } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 40 mins to fix
    spec/lib/graphql_spec.rb on lines 559..566
    spec/lib/graphql_spec.rb on lines 569..576

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

    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

        it "does not include votes of hidden proposals" do
          create(:proposal, id: 1, voters: [create(:user)])
          create(:proposal, :hidden, id: 2, voters: [create(:user)])
    
          response = execute("{ votes { edges { node { votable_id } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 40 mins to fix
    spec/lib/graphql_spec.rb on lines 549..556
    spec/lib/graphql_spec.rb on lines 569..576

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

    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

        it "only returns date and hour for created_at" do
          created_at = Time.zone.parse("2017-12-31 9:30:15")
          create(:proposal_notification, created_at: created_at)
    
          response = execute("{ proposal_notifications { edges { node { public_created_at } } } }")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 4 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 162..169
    spec/lib/graphql_spec.rb on lines 230..237
    spec/lib/graphql_spec.rb on lines 383..390
    spec/lib/graphql_spec.rb on lines 635..642

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

    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

        it "only returns date and hour for created_at" do
          created_at = Time.zone.parse("2017-12-31 9:30:15")
          create(:comment, created_at: created_at)
    
          response = execute("{ comments { edges { node { public_created_at } } } }")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 4 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 162..169
    spec/lib/graphql_spec.rb on lines 230..237
    spec/lib/graphql_spec.rb on lines 440..447
    spec/lib/graphql_spec.rb on lines 635..642

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

    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

        it "only returns date and hour for created_at" do
          created_at = Time.zone.parse("2017-12-31 9:30:15")
          create(:proposal, created_at: created_at)
    
          response = execute("{ proposals { edges { node { public_created_at } } } }")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 4 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 230..237
    spec/lib/graphql_spec.rb on lines 383..390
    spec/lib/graphql_spec.rb on lines 440..447
    spec/lib/graphql_spec.rb on lines 635..642

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

    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

        it "does not link author if public activity is set to false" do
          create(:user, :with_debate, username: "public",  public_activity: true)
          create(:user, :with_debate, username: "private", public_activity: false)
    
          response = execute("{ debates { edges { node { public_author { username } } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 152..159
    spec/lib/graphql_spec.rb on lines 280..287

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

    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

        it "does not link author if public activity is set to false" do
          create(:user, :with_comment, username: "public",  public_activity: true)
          create(:user, :with_comment, username: "private", public_activity: false)
    
          response = execute("{ comments { edges { node { public_author { username } } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 152..159
    spec/lib/graphql_spec.rb on lines 220..227

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

    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

        it "does not include comments of proposals that are not public" do
          not_public_proposal = create(:proposal)
          not_public_proposal_comment = create(:comment, commentable: not_public_proposal)
          allow(Comment).to receive(:public_for_api).and_return([])
    
    
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 361..369
    spec/lib/graphql_spec.rb on lines 429..437

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

    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

        it "only returns date and hour for created_at" do
          created_at = Time.zone.parse("2017-12-31 9:30:15")
          create(:debate, created_at: created_at)
    
          response = execute("{ debates { edges { node { public_created_at } } } }")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 4 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 162..169
    spec/lib/graphql_spec.rb on lines 383..390
    spec/lib/graphql_spec.rb on lines 440..447
    spec/lib/graphql_spec.rb on lines 635..642

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

    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

        it "only returns date and hour for created_at" do
          created_at = Time.zone.parse("2017-12-31 9:30:15")
          create(:vote, created_at: created_at)
    
          response = execute("{ votes { edges { node { public_created_at } } } }")
    Severity: Major
    Found in spec/lib/graphql_spec.rb and 4 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 162..169
    spec/lib/graphql_spec.rb on lines 230..237
    spec/lib/graphql_spec.rb on lines 383..390
    spec/lib/graphql_spec.rb on lines 440..447

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

    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

        it "does not include comments of polls that are not public" do
          not_public_poll = create(:poll)
          not_public_poll_comment = create(:comment, commentable: not_public_poll)
          allow(Comment).to receive(:public_for_api).and_return([])
    
    
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 350..358
    spec/lib/graphql_spec.rb on lines 429..437

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

    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

        it "does not link author if public activity is set to false" do
          create(:user, :with_proposal, username: "public",  public_activity: true)
          create(:user, :with_proposal, username: "private", public_activity: false)
    
          response = execute("{ proposals { edges { node { public_author { username } } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 220..227
    spec/lib/graphql_spec.rb on lines 280..287

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

    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

        it "does not include proposal notifications for proposals that are not public" do
          not_public_proposal = create(:proposal)
          not_public_proposal_notification = create(:proposal_notification, proposal: not_public_proposal)
          allow(ProposalNotification).to receive(:public_for_api).and_return([])
    
    
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 35 mins to fix
    spec/lib/graphql_spec.rb on lines 350..358
    spec/lib/graphql_spec.rb on lines 361..369

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

    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

        it "does not include votes of debates that are not public" do
          allow(Vote).to receive(:public_for_api).and_return([])
          not_public_debate = create(:debate, voters: [create(:user)])
    
          response = execute("{ votes { edges { node { votable_id } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 30 mins to fix
    spec/lib/graphql_spec.rb on lines 615..622
    spec/lib/graphql_spec.rb on lines 625..632

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

    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

        it "does not include votes of a hidden proposals" do
          allow(Vote).to receive(:public_for_api).and_return([])
          not_public_proposal = create(:proposal, voters: [create(:user)])
    
          response = execute("{ votes { edges { node { votable_id } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 30 mins to fix
    spec/lib/graphql_spec.rb on lines 605..612
    spec/lib/graphql_spec.rb on lines 625..632

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

    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

        it "does not include votes of a hidden comments" do
          allow(Vote).to receive(:public_for_api).and_return([])
          not_public_comment = create(:comment, voters: [create(:user)])
    
          response = execute("{ votes { edges { node { votable_id } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 30 mins to fix
    spec/lib/graphql_spec.rb on lines 605..612
    spec/lib/graphql_spec.rb on lines 615..622

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

    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

        it "does not include hidden comments" do
          create(:comment, body: "Visible")
          create(:comment, :hidden, body: "Hidden")
    
          response = execute("{ comments { edges { node { body } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 25 mins to fix
    spec/lib/graphql_spec.rb on lines 129..136
    spec/lib/graphql_spec.rb on lines 197..204
    spec/lib/graphql_spec.rb on lines 505..512

    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

        it "does not include hidden proposals" do
          create(:proposal, title: "Visible")
          create(:proposal, :hidden, title: "Hidden")
    
          response = execute("{ proposals { edges { node { title } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 25 mins to fix
    spec/lib/graphql_spec.rb on lines 197..204
    spec/lib/graphql_spec.rb on lines 290..297
    spec/lib/graphql_spec.rb on lines 505..512

    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

        it "does not display tags for hidden proposals" do
          create(:proposal, tag_list: "Health")
          create(:proposal, :hidden, tag_list: "SPAM")
    
          response = execute("{ tags { edges { node { name } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 25 mins to fix
    spec/lib/graphql_spec.rb on lines 129..136
    spec/lib/graphql_spec.rb on lines 197..204
    spec/lib/graphql_spec.rb on lines 290..297

    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

        it "does not include hidden debates" do
          create(:debate, title: "Visible")
          create(:debate, :hidden, title: "Hidden")
    
          response = execute("{ debates { edges { node { title } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 3 other locations - About 25 mins to fix
    spec/lib/graphql_spec.rb on lines 129..136
    spec/lib/graphql_spec.rb on lines 290..297
    spec/lib/graphql_spec.rb on lines 505..512

    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

          it "works OK when both tags are present for proposals" do
            create(:proposal).tags = [uppercase_tag]
            create(:proposal).tags = [lowercase_tag]
    
            response = execute("{ tags { edges { node { name } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 1 other location - About 25 mins to fix
    spec/lib/graphql_spec.rb on lines 494..501

    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

          it "works OK when both tags are present for proposals" do
            create(:debate).tags = [uppercase_tag]
            create(:debate).tags = [lowercase_tag]
    
            response = execute("{ tags { edges { node { name } } } }")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 1 other location - About 25 mins to fix
    spec/lib/graphql_spec.rb on lines 484..491

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

        it "does not link debates if activity is not public" do
          create(:debate, author: user)
    
          response = execute("{ user(id: #{user.id}) { public_debates { edges { node { title } } } } }")
          received_debates = dig(response, "data.user.public_debates.edges")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 15 mins to fix
    spec/lib/graphql_spec.rb on lines 109..115
    spec/lib/graphql_spec.rb on lines 118..124

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

        it "does not link proposals if activity is not public" do
          create(:proposal, author: user)
    
          response = execute("{ user(id: #{user.id}) { public_proposals { edges { node { title } } } } }")
          received_proposals = dig(response, "data.user.public_proposals.edges")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 15 mins to fix
    spec/lib/graphql_spec.rb on lines 100..106
    spec/lib/graphql_spec.rb on lines 118..124

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

        it "does not link comments if activity is not public" do
          create(:comment, author: user)
    
          response = execute("{ user(id: #{user.id}) { public_comments { edges { node { body } } } } }")
          received_comments = dig(response, "data.user.public_comments.edges")
    Severity: Minor
    Found in spec/lib/graphql_spec.rb and 2 other locations - About 15 mins to fix
    spec/lib/graphql_spec.rb on lines 100..106
    spec/lib/graphql_spec.rb on lines 109..115

    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

    There are no issues that match your filters.

    Category
    Status