mysociety/alaveteli

View on GitHub
spec/models/outgoing_message_spec.rb

Summary

Maintainability
F
1 wk
Test Coverage

File outgoing_message_spec.rb has 1419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

describe OutgoingMessage do

  describe '.fill_in_salutation' do
Severity: Major
Found in spec/models/outgoing_message_spec.rb - About 3 days to fix

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

            it 'handles log lines where a delivery status cant be parsed' do
              message = FactoryGirl.create(:initial_request)
              body_email = message.info_request.public_body.request_email
              request_email = message.info_request.incoming_email
              request_subject = message.info_request.email_subject_request(:html => false)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 4 hrs to fix
    spec/models/outgoing_message_spec.rb on lines 1432..1458

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

    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 'finds logs passed through an indirect router' do
              message = FactoryGirl.create(:initial_request)
              body_email = message.info_request.public_body.request_email
              request_email = message.info_request.incoming_email
              request_subject = message.info_request.email_subject_request(:html => false)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 4 hrs to fix
    spec/models/outgoing_message_spec.rb on lines 1462..1484

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

    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 text with censor rules belonging to the user' do
          data = 'There was a mouse called Stilton.'
          expected = 'There was a cat called Jarlsberg.'
    
          rules = [
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 55 mins to fix
    spec/models/incoming_message_spec.rb on lines 277..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 46.

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

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

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

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

    Refactorings

    Further Reading

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

        it 'replaces text with censor rules belonging to the info request' do
          data = 'There was a mouse called Stilton.'
          expected = 'There was a cat called Jarlsberg.'
    
          rules = [
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 55 mins to fix
    spec/models/incoming_message_spec.rb on lines 260..274
    spec/models/info_request_spec.rb on lines 2264..2278

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 45.

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

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

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

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

    Refactorings

    Further Reading

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

          it 'returns a delivery status for a bounced message' do
            log_lines = <<-EOF.strip_heredoc.split("\n")
            Nov 19 22:56:04 host postfix/qmgr[5216]: 3742D3602065: removed
            Nov 19 22:56:04 host postfix/bounce[26532]: 3742D3602065: sender non-delivery notification: 4301E3602066
            Nov 19 22:56:04 host postfix/smtp[26054]: 3742D3602065: to=<foi@example.com>, relay=none, delay=0.06, delays=0.05/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=example.com type=A: Host not found)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1719..1731
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

          it 'returns a delivery status for a redelivered message' do
            log_lines = <<-EOF.strip_heredoc.split("\n")
            Nov 19 22:56:04 host postfix/qmgr[5216]: 3742D3602065: removed
            Nov 19 22:56:04 host postfix/bounce[26532]: 3742D3602065: sender non-delivery notification: 4301E3602066
            Nov 19 22:56:04 host postfix/smtp[26054]: 3742D3602065: to=<foi@example.com>, relay=none, delay=0.06, delays=0.05/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=example.com type=A: Host not found)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1719..1731

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

            it 'returns a delivery status for a redelivered message' do
              log_lines = <<-EOF.strip_heredoc.split("\n")
              2016-04-06 12:01:07 [14928] 1anlCt-0003sm-LG <= request-326806-hk82iwn7@localhost U=alaveteli P=local S=1923 id=ogm-531356+5704ec7388370-456e@localhost T="Freedom of Information request - Some Information" from <request-326806-hk82iwn7@localhost> for foi@example.net foi@example.net
              2016-04-06 12:01:08 [14933] 1anlCt-0003sm-LG ** foi@example.net F=<request-326806-hk82iwn7@localhost>: all relevant MX records point to non-existent hosts
              2016-04-06 12:01:08 [14933] 1anlCt-0003sm-LG ** foi@example.net F=<request-326806-hk82iwn7@localhost>: all relevant MX records point to non-existent hosts
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1719..1731
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

          it 'returns a delivery status for a deferred message' do
            log_lines = <<-EOF.strip_heredoc.split("\n")
            Oct  3 16:39:35 host postfix/pickup[2257]: CB55836EE58C: uid=1003 from=<foi+request-14-e0e09f97@example.com>
            Oct  3 16:39:35 host postfix/cleanup[7674]: CB55836EE58C: message-id=<ogm-15+506bdda7a4551-20ee@example.com>
            Oct  3 16:39:35 host postfix/qmgr[1673]: 9634B16F7F7: from=<foi+request-10-1234@example.com>, size=368, nrcpt=1 (queue active)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1719..1731
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

            it 'returns a delivery status for the most recent line with a parsable status' do
              log_lines = <<-EOF.strip_heredoc.split("\n")
              2015-10-30 19:24:16 [17814] 1ZsFHb-0004dK-SM <= request-123-abc987@example.net U=alaveteli P=local S=2252 id=ogm-14+537f69734b97c-1ebd@localhost T="FOI Request about stuff" from <request-123-abc987@example.net> for authority@example.com authority@example.com
              2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM => authority@example.com F=<request-123-abc987@example.net> P=<request-123-abc987@example.net> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM junk
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1719..1731
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

            it 'returns a delivery status for a bounced message' do
              log_lines = <<-EOF.strip_heredoc.split("\n")
              2016-04-06 12:01:07 [14928] 1anlCt-0003sm-LG <= request-326806-hk82iwn7@localhost U=alaveteli P=local S=1923 id=ogm-326806+5704ec7388370-456e@localhost.com T="Freedom of Information request - Computers" from <request-326806-hk82iwn7@localhost> for foi@authority.net foi@authority.net
              2016-04-06 12:01:08 [14933] 1anlCt-0003sm-LG ** foi@authority.net F=<request-326806-hk82iwn7@localhost>: all relevant MX records point to non-existent hosts
              2016-04-06 12:01:08 [14933] 1anlCt-0003sm-LG ** foi@authority.net F=<request-326806-hk82iwn7@localhost>: all relevant MX records point to non-existent hosts
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1719..1731
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

          it 'returns a delivery status for the most recent line with a parsable status' do
            log_lines = <<-EOF.strip_heredoc.split("\n")
            Oct  3 16:39:35 host postfix/pickup[2257]: CB55836EE58C: uid=1003 from=<foi+request-14-e0e09f97@example.com>
            Oct  3 16:39:35 host postfix/cleanup[7674]: CB55836EE58C: message-id=<ogm-15+506bdda7a4551-20ee@example.com>
            Oct  3 16:39:35 host postfix/qmgr[15615]: CB55836EE58C: from=<foi+request-14-e0e09f97@example.com>, size=1695, nrcpt=1 (queue active)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1613..1622
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

          it 'returns an unknown delivery status if we cannot parse a status' do
            log_lines = <<-EOF.strip_heredoc.split("\n")
            junk
            garbage
            EOF
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1632..1642
    spec/models/outgoing_message_spec.rb on lines 1645..1658
    spec/models/outgoing_message_spec.rb on lines 1661..1672
    spec/models/outgoing_message_spec.rb on lines 1686..1700
    spec/models/outgoing_message_spec.rb on lines 1703..1716
    spec/models/outgoing_message_spec.rb on lines 1719..1731
    spec/models/outgoing_message_spec.rb on lines 1734..1752

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

          it 'produces the expected text for a followup' do
            public_body = FactoryGirl.build(:public_body,
                                            name: 'a test public body')
            info_request = FactoryGirl.build(:info_request,
                                             title: 'A test title',
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 646..659
    spec/models/outgoing_message_spec.rb on lines 1783..1795

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

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

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

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

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

    Refactorings

    Further Reading

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

      it 'should produce the expected text for an internal review request' do
        public_body = FactoryGirl.build(:public_body, name: 'A test public body')
        info_request = FactoryGirl.build(:info_request,
                                         title: 'A test title',
                                         public_body: public_body)
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 646..659
    spec/models/outgoing_message_spec.rb on lines 688..701

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

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

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

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

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

    Refactorings

    Further Reading

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

          it 'produces the expected text for a batch request template' do
            public_body = FactoryGirl.build(:public_body,
                                            name: 'a test public body')
            info_request = FactoryGirl.build(:info_request,
                                             title: 'A test title',
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 688..701
    spec/models/outgoing_message_spec.rb on lines 1783..1795

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

    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 'prefixes the incoming message subject if it is not prefixed with Re:' do
            request = FactoryGirl.create(:info_request, :title => 'Example Request')
            message = FactoryGirl.build(:new_information_followup,
                                        :info_request => request)
    
    
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 243..254

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 39.

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

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

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

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

    Refactorings

    Further Reading

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

          it 'uses the incoming message subject if it is already prefixed with Re:' do
            request = FactoryGirl.create(:info_request, :title => 'Example Request')
            message = FactoryGirl.build(:new_information_followup,
                                        :info_request => request)
    
    
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 45 mins to fix
    spec/models/outgoing_message_spec.rb on lines 257..268

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 39.

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

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

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

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

    Refactorings

    Further Reading

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 2ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 2ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1138..1140
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 3ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 3ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1138..1140
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 1ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1138..1140
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 3ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 3ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 1ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1138..1140
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 1ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1138..1140
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM => #{ body_email } F=<#{ request_email }> P=<#{ request_email }> R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
              2015-10-30 19:24:16 [17814] 1ZsFHb-0004dK-SM <= #{ request_email } U=alaveteli P=local S=2252 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1138..1140
    spec/models/outgoing_message_spec.rb on lines 1343..1356

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

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

              load_mail_server_logs <<-EOF.strip_heredoc
              2016-02-03 06:58:10 [16003] cwd=/var/www/alaveteli/alaveteli 7 args: /usr/sbin/sendmail -i -t -f request-313973-1650c56a@localhost --
              foi@body.example.com
              2016-02-03 06:58:11 [16003] 1aQrOE-0004A7-TL <= request-313973-1650c56a@localhost U=alaveteli P=local S=3098 id=ogm-512169+56b3a50ac0cf4-6717@localhost T="Freedom of Information request - Rspec" from <request-313973-1650c56a@localhost> for foi@body.example.com foi@body.example.com
              2016-02-03 06:58:11 [16006] cwd=/var/spool/exim4 3 args: /usr/sbin/exim4 -Mc 1aQrOE-0004A7-TL
    Severity: Major
    Found in spec/models/outgoing_message_spec.rb and 7 other locations - About 35 mins to fix
    spec/models/outgoing_message_spec.rb on lines 988..990
    spec/models/outgoing_message_spec.rb on lines 1020..1022
    spec/models/outgoing_message_spec.rb on lines 1040..1042
    spec/models/outgoing_message_spec.rb on lines 1061..1063
    spec/models/outgoing_message_spec.rb on lines 1085..1087
    spec/models/outgoing_message_spec.rb on lines 1102..1104
    spec/models/outgoing_message_spec.rb on lines 1138..1140

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

    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

              expected_lines = <<-EOF.strip_heredoc
              2016-02-03 06:58:56 [16287] 1aQrOy-0004Eh-H7 <= #{ request_email } U=alaveteli P=local S=2329 id=#{ smtp_message_id } T="#{ request_subject }" from <#{ request_email }> for #{ body_email } #{ body_email }
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 25 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1560..1579

    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

              load_mail_server_logs <<-EOF.strip_heredoc
              Jun 15 20:59:18 host postfix/qmgr[5216]: 053EF36F5B67: removed
              Jun 15 20:59:18 host postfix/pickup[17736]: 053EF36F5B67: uid=1003 from=<#{ request_email }>
              Jun 15 20:59:18 host postfix/cleanup[4358]: 053EF36F5B67: message-id=<#{ smtp_message_id }>
              Jun 15 20:59:18 host postfix/qmgr[5216]: 053EF36F5B67: from=<#{ request_email }>, size=2070, nrcpt=1 (queue active)
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 25 mins to fix
    spec/models/outgoing_message_spec.rb on lines 1366..1367

    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

        context 'when sending an initial request' do
    
          it 'uses the request title with the law prefixed' do
            request = FactoryGirl.create(:info_request, :title => 'Example Request')
            message = FactoryGirl.build(:initial_request, :info_request => request)
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 25 mins to fix
    spec/models/outgoing_message_spec.rb on lines 273..279

    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

        context 'when requesting an internal review' do
    
          it 'prefixes the request title with the internal review message' do
            request = FactoryGirl.create(:info_request, :title => 'Example Request')
            message = FactoryGirl.build(:internal_review_request, :info_request => request)
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 25 mins to fix
    spec/models/outgoing_message_spec.rb on lines 189..195

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

        it 'replaces text with global censor rules' do
          data = 'There was a mouse called Stilton, he wished that he was blue'
          expected = 'There was a mouse called Stilton, he said that he was blue'
    
          opts = { :text => 'wished',
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 25 mins to fix
    spec/models/incoming_message_spec.rb on lines 247..257
    spec/models/info_request_spec.rb on lines 2234..2244

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 29.

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

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

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

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

    Refactorings

    Further Reading

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

          it "adds an error message if the signature block is incomplete" do
            outgoing_message =
              OutgoingMessage.new(:status => 'ready',
                                  :message_type => 'initial_request',
                                  :what_doing => 'normal_sort',
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 3 other locations - About 20 mins to fix
    spec/models/outgoing_message_spec.rb on lines 363..372
    spec/models/outgoing_message_spec.rb on lines 500..509
    spec/models/outgoing_message_spec.rb on lines 544..553

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

          it "adds an error message if the text has not been changed" do
            outgoing_message =
              OutgoingMessage.new(:status => 'ready',
                                  :message_type => 'initial_request',
                                  :what_doing => 'normal_sort',
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 3 other locations - About 20 mins to fix
    spec/models/outgoing_message_spec.rb on lines 375..384
    spec/models/outgoing_message_spec.rb on lines 500..509
    spec/models/outgoing_message_spec.rb on lines 544..553

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

            it "adds an error message if the text has not been changed" do
              outgoing_message =
                OutgoingMessage.new(:status => 'ready',
                                    :message_type => 'followup',
                                    :what_doing => 'normal_sort',
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 3 other locations - About 20 mins to fix
    spec/models/outgoing_message_spec.rb on lines 363..372
    spec/models/outgoing_message_spec.rb on lines 375..384
    spec/models/outgoing_message_spec.rb on lines 500..509

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

            it "adds an error message if the text has not been changed" do
              outgoing_message =
                OutgoingMessage.new(:status => 'ready',
                                    :message_type => 'followup',
                                    :what_doing => 'internal_review',
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 3 other locations - About 20 mins to fix
    spec/models/outgoing_message_spec.rb on lines 363..372
    spec/models/outgoing_message_spec.rb on lines 375..384
    spec/models/outgoing_message_spec.rb on lines 544..553

    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 text with masks belonging to the info request' do
          data = "He emailed #{ @message.info_request.incoming_email }"
          expected = "He emailed [FOI ##{ @message.info_request.id } email]"
          result = @message.apply_masks(data, 'text/plain')
          expect(result).to eq(expected)
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 1 other location - About 20 mins to fix
    spec/models/incoming_message_spec.rb on lines 294..298

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

        it 'returns the body attribute' do
          attrs = { :status => 'ready',
                    :message_type => 'initial_request',
                    :body => 'abc',
                    :what_doing => 'normal_sort' }
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 15 mins to fix
    spec/models/outgoing_message_spec.rb on lines 298..305
    spec/models/outgoing_message_spec.rb on lines 308..315

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 25.

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

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

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

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

    Refactorings

    Further Reading

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

        it 'removes excess linebreaks that unnecessarily space it out' do
          attrs = { :status => 'ready',
                    :message_type => 'initial_request',
                    :body => "ab\n\nc\n\n",
                    :what_doing => 'normal_sort' }
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 15 mins to fix
    spec/models/outgoing_message_spec.rb on lines 288..295
    spec/models/outgoing_message_spec.rb on lines 298..305

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 25.

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

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

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

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

    Refactorings

    Further Reading

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

        it 'strips the body of leading and trailing whitespace' do
          attrs = { :status => 'ready',
                    :message_type => 'initial_request',
                    :body => ' abc ',
                    :what_doing => 'normal_sort' }
    Severity: Minor
    Found in spec/models/outgoing_message_spec.rb and 2 other locations - About 15 mins to fix
    spec/models/outgoing_message_spec.rb on lines 288..295
    spec/models/outgoing_message_spec.rb on lines 308..315

    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