discourse/discourse

View on GitHub
plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb

Summary

Maintainability
F
4 days
Test Coverage

File new_user_narrative_spec.rb has 734 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

describe DiscourseNarrativeBot::NewUserNarrative do
  let!(:welcome_topic) { Fabricate(:topic, title: 'Welcome to Discourse') }
  let(:discobot_user) { User.find(-2) }

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

          describe 'when user replies to the topic' do
            it 'should create the right reply' do
              narrative.input(:reply, user, post: other_post)
              new_post = Post.last
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 426..451
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 500..525
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 592..614

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

    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

            describe 'when reply contains the skip trigger' do
              it 'should create the right reply' do
                post.update!(raw: "@#{discobot_user.username} #{skip_trigger.upcase}")
                described_class.any_instance.expects(:enqueue_timeout_job).with(user)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 166..179

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

    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 'should create the right reply' do
            post.update!(
              raw: '@discobot hello how are you doing today?'
            )
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 344..358

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

    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 'should create the right reply' do
              post.update!(raw: 'https://en.wikipedia.org/wiki/ROT13')
    
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 804..822

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

    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

            describe 'when reply contains the skip trigger' do
              it 'should create the right reply' do
                post.update!(raw: skip_trigger)
                described_class.any_instance.expects(:enqueue_timeout_job).with(user)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 786..800

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

    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

          describe 'when reply contains the skip trigger' do
            it 'should create the right reply' do
              post.update!(raw: skip_trigger)
              described_class.any_instance.expects(:enqueue_timeout_job).with(user)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 697..711

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

    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

          describe "when user has not liked bot's post" do
            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
              new_post = Post.last
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 282..289

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

    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

          describe 'when post being flagged does not belong to discobot ' do
            it 'should not do anything' do
              narrative.expects(:enqueue_timeout_job).with(user).never
              flag.update!(post: other_post)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 836..842

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

    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

          describe 'when post flagged is not for the right topic' do
            it 'should not do anything' do
              narrative.expects(:enqueue_timeout_job).with(user).never
              flag.update!(post: other_post)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 846..852

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

    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

          describe 'when post does not contain onebox' do
            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
              new_post = Post.last
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 293..300

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

    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

          describe 'when post does not contain any formatting' do
            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 609..615
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 686..692
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 918..927

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

          describe 'when post does not contain any quotes' do
            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 545..551
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 686..692
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 918..927

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

            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user).once
    
              narrative.input(:reply, user, post: post)
              new_post = Post.last
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 216..226

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

          describe 'when post does not contain any emoji' do
            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 545..551
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 609..615
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 918..927

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

          describe 'when post does not contain the right answer' do
            it 'should create the right reply' do
              narrative.expects(:enqueue_timeout_job).with(user)
              narrative.input(:reply, user, post: post)
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 545..551
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 609..615
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 686..692

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 272..278
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 375..381
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 535..541
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 676..682
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 760..766
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 908..914

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

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 272..278
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 375..381
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 535..541
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 599..605
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 760..766
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 908..914

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

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 272..278
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 375..381
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 535..541
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 599..605
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 676..682
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 908..914

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

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 272..278
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 375..381
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 535..541
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 599..605
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 676..682
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 760..766

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

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 272..278
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 535..541
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 599..605
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 676..682
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 760..766
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 908..914

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

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 272..278
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 375..381
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 599..605
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 676..682
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 760..766
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 908..914

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

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

          describe 'when post is not in the right topic' do
            it 'should not do anything' do
              other_post
              narrative.expects(:enqueue_timeout_job).with(user).never
    
    
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 142..148
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 413..422
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 582..588
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 643..649
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 375..381
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 535..541
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 599..605
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 676..682
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 760..766
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 908..914

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

    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

          let(:topic) do
            topic_allowed_user = Fabricate.build(:topic_allowed_user, user: user)
            bot = Fabricate.build(:topic_allowed_user, user: discobot_user)
            Fabricate(:private_message_topic, topic_allowed_users: [topic_allowed_user, bot])
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 59..62
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb on lines 686..689

    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

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

          expect(Post.last.raw).to eq(I18n.t(
            'discourse_narrative_bot.timeout.message',
            username: user.username,
            skip_trigger: skip_trigger,
            reset_trigger: "#{reset_trigger} #{described_class.reset_trigger}",
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 41..47

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 25.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status