next-l/enju_leaf

View on GitHub
lib/tasks/attachment.rb

Summary

Maintainability
D
2 days
Test Coverage
F
3%

Method migrate_attachment_s3 has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def migrate_attachment_s3
  AgentImportFile.where.not(agent_import_file_name: nil).find_each do |file|
    file.attachment.attach(
      io: URI(Paperclip::Attachment.new(
        :agent_import,
Severity: Major
Found in lib/tasks/attachment.rb - About 5 hrs to fix

    Method migrate_attachment has 124 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def migrate_attachment
      option = {
        path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
      }
    
    
    Severity: Major
    Found in lib/tasks/attachment.rb - About 4 hrs to fix

      File attachment.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      def migrate_attachment
        option = {
          path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
        }
      
      
      Severity: Minor
      Found in lib/tasks/attachment.rb - About 2 hrs to fix

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

          EventImportFile.where.not(event_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :event_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          EventExportFile.where.not(event_export_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :event_export,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          AgentImportFile.where.not(agent_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :agent_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          EventExportFile.where.not(event_export_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :event_export,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          CarrierType.where.not(attachment_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :attachment,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          CarrierType.where.not(attachment_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :attachment,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          Manifestation.where.not(attachment_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :attachment,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          UserImportFile.where.not(user_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :user_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266

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

          LibraryGroup.where.not(header_logo_file_name: nil).find_each do |file|
            file.header_logo.attach(
              io: File.open(Paperclip::Attachment.new(
                :header_logo,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          ResourceImportFile.where.not(resource_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :resource_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          UserExportFile.where.not(user_export_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :user_export,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          Manifestation.where.not(attachment_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :attachment,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          UserExportFile.where.not(user_export_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :user_export,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 128..136

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

          UserImportFile.where.not(user_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :user_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125

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

          AgentImportFile.where.not(agent_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :agent_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          InventoryFile.where.not(inventory_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :inventory,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          InventoryFile.where.not(inventory_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :inventory,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          ResourceExportFile.where.not(resource_export_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :resource_export,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 196..204
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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 11 locations. Consider refactoring.
        Open

          ResourceExportFile.where.not(resource_export_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :resource_export,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          EventImportFile.where.not(event_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :event_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 106..114
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          ResourceImportFile.where.not(resource_import_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: File.open(Paperclip::Attachment.new(
                :resource_import,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 6..14
        lib/tasks/attachment.rb on lines 17..25
        lib/tasks/attachment.rb on lines 28..36
        lib/tasks/attachment.rb on lines 39..47
        lib/tasks/attachment.rb on lines 50..58
        lib/tasks/attachment.rb on lines 61..69
        lib/tasks/attachment.rb on lines 72..80
        lib/tasks/attachment.rb on lines 95..103
        lib/tasks/attachment.rb on lines 117..125
        lib/tasks/attachment.rb on lines 128..136

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

          LibraryGroup.where.not(header_logo_file_name: nil).find_each do |file|
            file.attachment.attach(
              io: URI(Paperclip::Attachment.new(
                :header_logo,
                file,
        Severity: Major
        Found in lib/tasks/attachment.rb and 10 other locations - About 15 mins to fix
        lib/tasks/attachment.rb on lines 141..149
        lib/tasks/attachment.rb on lines 152..160
        lib/tasks/attachment.rb on lines 163..171
        lib/tasks/attachment.rb on lines 174..182
        lib/tasks/attachment.rb on lines 185..193
        lib/tasks/attachment.rb on lines 207..215
        lib/tasks/attachment.rb on lines 236..244
        lib/tasks/attachment.rb on lines 247..255
        lib/tasks/attachment.rb on lines 258..266
        lib/tasks/attachment.rb on lines 269..277

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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