mysociety/alaveteli

View on GitHub
spec/lib/user_spam_scorer_spec.rb

Summary

Maintainability
D
2 days
Test Coverage

File user_spam_scorer_spec.rb has 533 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe UserSpamScorer do

  after(:each) { described_class.reset }
Severity: Major
Found in spec/lib/user_spam_scorer_spec.rb - About 1 day to fix

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

      describe '#email_from_spam_tld?' do
    
        it 'is true if the email is from a spam tld' do
          mock_spam_tlds = %w(com net org)
          user = mock_model(User, :email_domain => 'example.net')
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 2 other locations - About 1 hr to fix
    spec/lib/user_spam_scorer_spec.rb on lines 366..381
    spec/lib/user_spam_scorer_spec.rb on lines 386..399

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

      describe '#email_from_suspicious_domain?' do
    
        it 'is true if the email is from a suspicious domain' do
          mock_suspicious_domains = %w(example.com example.net example.org)
          user = mock_model(User, :email_domain => 'example.net')
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 2 other locations - About 1 hr to fix
    spec/lib/user_spam_scorer_spec.rb on lines 386..399
    spec/lib/user_spam_scorer_spec.rb on lines 404..417

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

      describe '#email_from_spam_domain?' do
    
        it 'is true if the email is from a spam domain' do
          mock_spam_domains = %w(example.com example.net example.org)
          user = mock_model(User, :email_domain => 'example.net')
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 2 other locations - About 1 hr to fix
    spec/lib/user_spam_scorer_spec.rb on lines 366..381
    spec/lib/user_spam_scorer_spec.rb on lines 404..417

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

      describe '#name_is_garbled?' do
    
        it 'is true if the name includes 5 consecutive consonants' do
          user = mock_model(User, :name => 'JWahewKjWhebCd')
          expect(subject.name_is_garbled?(user)).to eq(true)
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 3 other locations - About 40 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 300..309
    spec/lib/user_spam_scorer_spec.rb on lines 314..323
    spec/lib/user_spam_scorer_spec.rb on lines 630..639

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

      describe '#name_is_one_word?' do
    
        it 'is true if the name is one word' do
          user = mock_model(User, :name => 'bobsmith123')
          expect(subject.name_is_one_word?(user)).to eq(true)
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 3 other locations - About 40 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 300..309
    spec/lib/user_spam_scorer_spec.rb on lines 328..337
    spec/lib/user_spam_scorer_spec.rb on lines 630..639

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

      describe '#name_is_all_lowercase?' do
    
        it 'is true if the name is all lowercase' do
          user = mock_model(User, :name => 'bob smith 123')
          expect(subject.name_is_all_lowercase?(user)).to eq(true)
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 3 other locations - About 40 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 314..323
    spec/lib/user_spam_scorer_spec.rb on lines 328..337
    spec/lib/user_spam_scorer_spec.rb on lines 630..639

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

      describe '#about_me_includes_anchor_tag?' do
    
        it 'is true if the about me includes an a tag' do
          user = mock_model(User, :about_me => 'Spam link <a href="">here</a>')
          expect(subject.about_me_includes_anchor_tag?(user)).to eq(true)
    Severity: Major
    Found in spec/lib/user_spam_scorer_spec.rb and 3 other locations - About 40 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 300..309
    spec/lib/user_spam_scorer_spec.rb on lines 314..323
    spec/lib/user_spam_scorer_spec.rb on lines 328..337

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

        it 'returns false if the user spam score is equal to the threshold' do
          user_attrs = { :name => 'genuine', :comments => [], :track_things => [] }
          user = mock_model(User, user_attrs)
          attrs = { :score_mappings => { :name_is_one_word? => 5 },
                    :spam_score_threshold => 5 }
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 35 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 238..244

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

    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 'returns false if the user spam score is below the threshold' do
          user_attrs = { :name => 'genuine', :comments => [], :track_things => [] }
          user = mock_model(User, user_attrs)
          attrs = { :score_mappings => { :name_is_one_word? => 5 },
                    :spam_score_threshold => 100 }
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 35 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 229..235

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

    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

      describe '.suspicious_domains' do
    
        it 'sets a default suspicious_domains value' do
          expect(described_class.suspicious_domains).
            to eq(described_class::DEFAULT_SUSPICIOUS_DOMAINS)
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 2 other locations - About 25 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 50..59
    spec/lib/user_spam_scorer_spec.rb on lines 106..115

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

      describe '.spam_domains' do
    
        it 'sets a default spam_domains value' do
          expect(described_class.spam_domains).
            to eq(described_class::DEFAULT_SPAM_DOMAINS )
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 2 other locations - About 25 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 36..45
    spec/lib/user_spam_scorer_spec.rb on lines 106..115

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

      describe '.spam_tlds' do
    
        it 'sets a default spam_tlds value' do
          expect(described_class.spam_tlds).
            to eq(described_class::DEFAULT_SPAM_TLDS)
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 2 other locations - About 25 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 36..45
    spec/lib/user_spam_scorer_spec.rb on lines 50..59

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

      describe '.spam_name_formats' do
    
        it 'sets a default spam_name_formats value' do
          expect(described_class.spam_name_formats).
            to eq(described_class::DEFAULT_SPAM_NAME_FORMATS)
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 25 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 78..87

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

      describe '.spam_about_me_formats' do
    
        it 'sets a default spam_about_me_formats value' do
          expect(described_class.spam_about_me_formats).
            to eq(described_class::DEFAULT_SPAM_ABOUT_ME_FORMATS)
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 25 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 64..73

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

        it 'is true if the about me matches a spammy format' do
          mock_spam_formats = [/\A.*+\n{2,}https?:\/\/[^\s]+\z/]
          user = mock_model(User, :about_me => <<-EOF.strip_heredoc)
          Some spam often looks like this spam
    
    
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 20 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 586..592

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

    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 'replaces \r\n with \n' do
          mock_spam_formats = [/\Aspam\nspam\z/]
          user = mock_model(User, :about_me => <<-EOF.strip_heredoc)
          spam\r\nspam
          EOF
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 20 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 568..576

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 27.

    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 'is false if the about me is not a spammy format' do
          mock_spam_formats = [/\A.*+\n{2,}https?:\/\/[^\s]+\z/]
          user = mock_model(User, :about_me => 'No spam here')
          scorer = described_class.new(:spam_about_me_formats => mock_spam_formats)
          expect(scorer.about_me_is_spam_format?(user)).to eq(false)
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 15 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 431..435

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

    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 'is false if the name is not a spammy format' do
          mock_spam_formats = [/\A.*support.*\z/]
          user = mock_model(User, name: 'Bob Smith')
          scorer = described_class.new(spam_name_formats: mock_spam_formats)
          expect(scorer.name_is_spam_format?(user)).to eq(false)
    Severity: Minor
    Found in spec/lib/user_spam_scorer_spec.rb and 1 other location - About 15 mins to fix
    spec/lib/user_spam_scorer_spec.rb on lines 579..583

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

    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