virgild/resumetools

View on GitHub

Showing 14 of 14 total issues

Method from_text has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

      def from_text(text)
        parser = ResumeTools::ResumeGrammarParser.new
        result = parser.parse(text)
        
        if result.nil?
Severity: Minor
Found in lib/resumetools/resume/text_reader.rb - About 4 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 render_pdf has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def render_pdf(opts={}, &blk)
        default_font = opts.delete(:default_font) || "SourceSansPro"

        pdf = Prawn::Document.new(
          :info => {},
Severity: Major
Found in lib/resumetools/resume/pdf.rb - About 2 hrs to fix

    Method from_text has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def from_text(text)
            parser = ResumeTools::ResumeGrammarParser.new
            result = parser.parse(text)
            
            if result.nil?
    Severity: Major
    Found in lib/resumetools/resume/text_reader.rb - About 2 hrs to fix

      Method render_pdf has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def render_pdf(opts={}, &blk)
              default_font = opts.delete(:default_font) || "SourceSansPro"
      
              pdf = Prawn::Document.new(
                :info => {},
      Severity: Minor
      Found in lib/resumetools/resume/pdf.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 write_contact_info has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_contact_info(info)
            # TODO: make this smoother
            case info
            when :full_name
              line "#N #{@resume.full_name}" unless @resume.full_name.blank?
      Severity: Minor
      Found in lib/resumetools/resume/export.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 line has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def line
            elements = []
            elements << self.organization if self.has_organization?
            elements << self.location if self.has_location?
            if self.has_dtstart? && self.has_dtend?
      Severity: Minor
      Found in lib/resumetools/resume/resume.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 render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def render(opts={})
              @opts = {
                :item_bullet => '-',
                :header_filler => '-',
                :newline => "\n",
      Severity: Minor
      Found in lib/resumetools/resume/plain_text.rb - About 1 hr to fix

        Method render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def render(opts={})
                @opts = {
                  :item_bullet => '-',
                  :header_filler => '-',
                  :newline => "\n",
        Severity: Minor
        Found in lib/resumetools/resume/plain_text.rb - About 55 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 write_dates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_dates(period)
              text = ""
              if period.has_dtstart? && period.has_dtend?
                text = "#{period.dtstart} to #{period.dtend}"
              elsif period.has_dtstart? && !period.has_dtend?
        Severity: Minor
        Found in lib/resumetools/resume/export.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

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

        Severity: Minor
        Found in lib/text/format.rb and 1 other location - About 35 mins to fix
        lib/text/format.rb on lines 872..877

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

        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

        Severity: Minor
        Found in lib/text/format.rb and 1 other location - About 35 mins to fix
        lib/text/format.rb on lines 931..936

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

        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

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

              def render_period(period)
                add_line(period.title) if period.title
                add_line period.line
                
                if period.has_items?
        Severity: Minor
        Found in lib/resumetools/resume/plain_text.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

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

        Severity: Minor
        Found in lib/text/format.rb and 1 other location - About 20 mins to fix
        lib/text/format.rb on lines 609..616

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

        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

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

        Severity: Minor
        Found in lib/text/format.rb and 1 other location - About 20 mins to fix
        lib/text/format.rb on lines 626..633

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

        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

        Severity
        Category
        Status
        Source
        Language