archivesspace/archivesspace

View on GitHub
common/validations.rb

Summary

Maintainability
F
4 days
Test Coverage

File validations.rb has 624 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'date'
require 'time'
require 'barcode_check'

module JSONModel::Validations
Severity: Major
Found in common/validations.rb - About 1 day to fix

    Method check_rights_statement has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.check_rights_statement(hash)
        errors = []
    
        if hash["rights_type"] == "copyright"
          errors << ["status", "missing required property"] if hash["status"].nil?
    Severity: Minor
    Found in common/validations.rb - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Consider simplifying this complex logical expression.
    Open

        errors << [field_name, "must be in YYYY[YYY][YY][Y], YYYY[YYY][YY][Y]-MM, or YYYY-MM-DD format"] unless matches_yyyy || matches_yyyy_mm || matches_yyyy_mm_dd || matches_yyy || matches_yy || matches_y || matches_yyy_mm || matches_yy_mm || matches_y_mm || matches_mm_yyyy || matches_mm_dd_yyyy || matches_yyy_mm_dd
    Severity: Critical
    Found in common/validations.rb - About 2 hrs to fix

      Method check_structured_date_range has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.check_structured_date_range(hash)
          errors = []
      
          has_begin_expr_date = !hash["begin_date_expression"].nil? &&
                                !hash["begin_date_expression"].empty?
      Severity: Minor
      Found in common/validations.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method check_restriction_date has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.check_restriction_date(hash)
          errors = []
      
          if (rr = hash['rights_restriction'])
            begin
      Severity: Minor
      Found in common/validations.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method check_structured_date_range has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.check_structured_date_range(hash)
          errors = []
      
          has_begin_expr_date = !hash["begin_date_expression"].nil? &&
                                !hash["begin_date_expression"].empty?
      Severity: Minor
      Found in common/validations.rb - About 1 hr to fix

        Method check_sub_container has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.check_sub_container(hash)
            errors = []
        
            if (!hash["type_2"].nil? && hash["indicator_2"].nil?) || (hash["type_2"].nil? && !hash["indicator_2"].nil?)
              errors << ["type_2", "container 2 requires both a type and indicator"]
        Severity: Minor
        Found in common/validations.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method check_date has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.check_date(hash)
            errors = []
        
            begin
              begin_date = parse_sloppy_date(hash['begin']) if hash['begin']
        Severity: Minor
        Found in common/validations.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method check_date has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.check_date(hash)
            errors = []
        
            begin
              begin_date = parse_sloppy_date(hash['begin']) if hash['begin']
        Severity: Minor
        Found in common/validations.rb - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                errors << ["other_rights_basis", "missing required property"] if hash["other_rights_basis"].nil?
          Severity: Major
          Found in common/validations.rb - About 45 mins to fix

            Method check_instance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.check_instance(hash)
                errors = []
            
                if hash["instance_type"] == "digital_object"
                  errors << ["digital_object", "Can't be empty"] if hash["digital_object"].nil?
            Severity: Minor
            Found in common/validations.rb - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Avoid deeply nested control flow statements.
            Open

                  errors << ["start_date", "missing required property"] if hash["start_date"].nil?
            Severity: Major
            Found in common/validations.rb - About 45 mins to fix

              Method check_survey_dates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.check_survey_dates(hash)
                  errors = []
              
                  begin
                    begin_date = parse_sloppy_date(hash['survey_begin'])
              Severity: Minor
              Found in common/validations.rb - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Consider simplifying this complex logical expression.
              Open

                  if (hash["source_entry"].nil?     || hash["source_entry"].empty?) &&
                     (hash["descriptive_note"].nil? || hash["descriptive_note"].empty?) &&
                     (hash["file_uri"].nil?         || hash["file_uri"].empty?)
              
                    errors << ["agent_sources", "Must specify one of Source Entry, Descriptive Note or File URI"]
              Severity: Major
              Found in common/validations.rb - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                    if (hash["set_component"].nil?    || hash["set_component"].empty?) &&
                       (hash["descriptive_note"].nil? || hash["descriptive_note"].empty?) &&
                       (hash["file_uri"].nil?         || hash["file_uri"].empty?)
                
                      errors << ["agent_sources", "Must specify one of Set Component, Descriptive Note or File URI"]
                Severity: Major
                Found in common/validations.rb - About 40 mins to fix

                  Method check_structured_date_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.check_structured_date_single(hash)
                      errors = []
                  
                      if hash["date_role"].nil?
                        errors << ["date_role", "is required"]
                  Severity: Minor
                  Found in common/validations.rb - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method check_agent_alternate_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.check_agent_alternate_set(hash)
                      errors = []
                  
                      if (hash["set_component"].nil?    || hash["set_component"].empty?) &&
                         (hash["descriptive_note"].nil? || hash["descriptive_note"].empty?) &&
                  Severity: Minor
                  Found in common/validations.rb - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method check_agent_sources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.check_agent_sources(hash)
                      errors = []
                  
                      if (hash["source_entry"].nil?     || hash["source_entry"].empty?) &&
                         (hash["descriptive_note"].nil? || hash["descriptive_note"].empty?) &&
                  Severity: Minor
                  Found in common/validations.rb - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                    def self.check_agent_alternate_set(hash)
                      errors = []
                  
                      if (hash["set_component"].nil?    || hash["set_component"].empty?) &&
                         (hash["descriptive_note"].nil? || hash["descriptive_note"].empty?) &&
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 50 mins to fix
                  common/validations.rb on lines 307..317

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

                  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

                    def self.check_agent_sources(hash)
                      errors = []
                  
                      if (hash["source_entry"].nil?     || hash["source_entry"].empty?) &&
                         (hash["descriptive_note"].nil? || hash["descriptive_note"].empty?) &&
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 50 mins to fix
                  common/validations.rb on lines 320..330

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

                  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

                      begin
                        if hash['survey_end']
                          # If padding our end date with months/days would cause it to fall before
                          # the start date (e.g. if the start date was '2000-05' and the end date
                          # just '2000'), use the start date in place of end.
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 40 mins to fix
                  common/validations.rb on lines 186..200

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 38.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      begin
                        if hash['end']
                          # If padding our end date with months/days would cause it to fall before
                          # the start date (e.g. if the start date was '2000-05' and the end date
                          # just '2000'), use the start date in place of end.
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 40 mins to fix
                  common/validations.rb on lines 836..850

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 38.

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

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

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

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

                  Refactorings

                  Further Reading

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

                        errors << ["status", "missing required property"] if hash["status"].nil?
                        errors << ["jurisdiction", "missing required property"] if hash["jurisdiction"].nil?
                        errors << ["start_date", "missing required property"] if hash["start_date"].nil?
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 25 mins to fix
                  common/validations.rb on lines 406..408

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

                  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

                        errors << ["statute_citation", "missing required property"] if hash["statute_citation"].nil?
                        errors << ["jurisdiction", "missing required property"] if hash["jurisdiction"].nil?
                        errors << ["start_date", "missing required property"] if hash["start_date"].nil?
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 25 mins to fix
                  common/validations.rb on lines 397..399

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 31.

                  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

                      if (!hash["type_3"].nil? && hash["indicator_3"].nil?) || (hash["type_3"].nil? && !hash["indicator_3"].nil?)
                        errors << ["type_3", "container 3 requires both a type and indicator"]
                      end
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 20 mins to fix
                  common/validations.rb on lines 494..496

                  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

                    def self.check_field_query(hash)
                      errors = []
                  
                      if (!hash.has_key?("value") || hash["value"].empty?) && hash["comparator"] != "empty"
                        errors << ["value", "Must specify either a value or use the 'empty' comparator"]
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 20 mins to fix
                  common/validations.rb on lines 778..785

                  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

                    def self.check_date_field_query(hash)
                      errors = []
                  
                      if (!hash.has_key?("value") || hash["value"].empty?) && hash["comparator"] != "empty"
                        errors << ["value", "Must specify either a value or use the 'empty' comparator"]
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 20 mins to fix
                  common/validations.rb on lines 761..768

                  Duplicated Code

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

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

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

                  Tuning

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

                      if (!hash["type_2"].nil? && hash["indicator_2"].nil?) || (hash["type_2"].nil? && !hash["indicator_2"].nil?)
                        errors << ["type_2", "container 2 requires both a type and indicator"]
                      end
                  Severity: Minor
                  Found in common/validations.rb and 1 other location - About 20 mins to fix
                  common/validations.rb on lines 502..504

                  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

                      [ "processing_hours_per_foot_estimate", "processing_total_extent", "processing_hours_total" ].each do |k|
                        if !hash[k].nil? and hash[k] !~ /^\-?\d{0,9}(\.\d{1,5})?$/
                          errors << [k, "must be a number with no more than nine digits and five decimal places"]
                        end
                  Severity: Minor
                  Found in common/validations.rb and 3 other locations - About 15 mins to fix
                  common/validations.rb on lines 569..572
                  common/validations.rb on lines 575..578
                  common/validations.rb on lines 745..748

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

                      ["depth", "width", "height"].each do |k|
                        if !hash[k].nil? && hash[k] !~ /\A\d+(\.\d\d?)?\Z/
                          errors << [k, "must be a number with no more than 2 decimal places"]
                        end
                  Severity: Minor
                  Found in common/validations.rb and 3 other locations - About 15 mins to fix
                  common/validations.rb on lines 548..551
                  common/validations.rb on lines 569..572
                  common/validations.rb on lines 575..578

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

                      ["integer_1", "integer_2", "integer_3"].each do |k|
                        if !hash[k].nil? and hash[k] !~ /^\-?\d+$/
                          errors << [k, "must be an integer"]
                        end
                  Severity: Minor
                  Found in common/validations.rb and 3 other locations - About 15 mins to fix
                  common/validations.rb on lines 548..551
                  common/validations.rb on lines 575..578
                  common/validations.rb on lines 745..748

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

                      ["real_1", "real_2", "real_3"].each do |k|
                        if !hash[k].nil? and hash[k] !~ /^\-?\d{0,9}(\.\d{1,5})?$/
                          errors << [k, "must be a number with no more than nine digits and five decimal places"]
                        end
                  Severity: Minor
                  Found in common/validations.rb and 3 other locations - About 15 mins to fix
                  common/validations.rb on lines 548..551
                  common/validations.rb on lines 569..572
                  common/validations.rb on lines 745..748

                  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