MiraitSystems/enju_trunk

View on GitHub
app/models/barcode_list.rb

Summary

Maintainability
D
1 day
Test Coverage

Method create_pdf_sheet has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def create_pdf_sheet(start_number,end_number)
      dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
      FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
      #filename = "barcode#{Time.now.strftime('%s')}.pdf"
      filename = "barcode.pdf"
Severity: Minor
Found in app/models/barcode_list.rb - About 2 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

Method create_pdf_sheet_custom has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def create_pdf_sheet_custom(custom_barcodes)
      dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
      FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
      #filename = "barcode#{Time.now.strftime('%s')}.pdf"
      filename = "barcode.pdf"
Severity: Minor
Found in app/models/barcode_list.rb - About 2 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

Method create_pdf_user_number_list has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def create_pdf_user_number_list(start_number, end_number)
    dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
    FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)

    filename = "barcode.pdf"
Severity: Minor
Found in app/models/barcode_list.rb - About 2 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

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

  def create_pdf_item_identifier_list(start_number, end_number)
    dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
    FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)

    filename = "barcode.pdf"
Severity: Minor
Found in app/models/barcode_list.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 create_pdf_user_number_list has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_pdf_user_number_list(start_number, end_number)
    dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
    FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)

    filename = "barcode.pdf"
Severity: Minor
Found in app/models/barcode_list.rb - About 1 hr to fix

    Method create_pdf_item_identifier_list has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_pdf_item_identifier_list(start_number, end_number)
        dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
        FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
    
        filename = "barcode.pdf"
    Severity: Minor
    Found in app/models/barcode_list.rb - About 1 hr to fix

      Method create_pdf_sheet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create_pdf_sheet(start_number,end_number)
            dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
            FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
            #filename = "barcode#{Time.now.strftime('%s')}.pdf"
            filename = "barcode.pdf"
      Severity: Minor
      Found in app/models/barcode_list.rb - About 1 hr to fix

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

          def create_pdf_sheet_custom(custom_barcodes)
              dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
              FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
              #filename = "barcode#{Time.now.strftime('%s')}.pdf"
              filename = "barcode.pdf"
        Severity: Minor
        Found in app/models/barcode_list.rb - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status