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 428..453
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 502..527
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 594..616

    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

            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 806..824

    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 346..360

    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: "@#{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 168..181

    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 788..802

    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 699..713

    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 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 838..844

    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 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 284..291

    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 848..854

    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 295..302

    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 611..617
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 688..694
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 920..929

    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 547..553
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 611..617
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 920..929

    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 547..553
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 611..617
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 688..694

    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 547..553
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 688..694
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 920..929

    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 218..228

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 274..280
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 377..383
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 537..543
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 601..607
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 678..684
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 762..768

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 274..280
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 537..543
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 601..607
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 678..684
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 762..768
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 910..916

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 274..280
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 377..383
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 601..607
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 678..684
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 762..768
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 910..916

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 274..280
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 377..383
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 537..543
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 678..684
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 762..768
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 910..916

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 377..383
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 537..543
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 601..607
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 678..684
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 762..768
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 910..916

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 274..280
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 377..383
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 537..543
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 601..607
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 762..768
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 910..916

    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 144..150
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 415..424
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 584..590
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb on lines 645..651
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 274..280
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 377..383
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 537..543
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 601..607
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 678..684
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb on lines 910..916

    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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 25.

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

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

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

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

    Refactorings

    Further Reading

    Similar blocks of code found in 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 61..64
    plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb on lines 688..691

    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