18F/team_hub

View on GitHub

Showing 7 of 7 total issues

Method create_team_by_email_index has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def self.create_team_by_email_index(team)
      team_by_email = {}
      team.each do |i|
        # A Hash containing only a 'private' property is a list of team
        # members whose information is completely private.
Severity: Minor
Found in lib/team_hub/joiner.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 xref_locations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def xref_locations
      locations = CrossReferencer.create_index(@site_data['team'], 'location')
      locations = locations.to_a.sort!.map do |entry|
        team = entry[1]
        result = {'code' => entry[0], 'team' => team}
Severity: Minor
Found in lib/team_hub/cross_referencer.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

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(site, page_dir, filename, layout, title)
Severity: Minor
Found in lib/team_hub/page.rb - About 35 mins to fix

    Method generate has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.generate(site, page_dir, filename, layout, title)
    Severity: Minor
    Found in lib/team_hub/page.rb - About 35 mins to fix

      Method join_snippet_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def join_snippet_data(snippet_versions)
            standardized = ::WeeklySnippets::Version.standardize_versions(
              @join_source['snippets'], snippet_versions)
            team = {}
            @data['team'].each {|i| team[i['name']] = i}
      Severity: Minor
      Found in lib/team_hub/joiner.rb - About 35 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 create_xrefs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.create_xrefs(sources, source_key, targets, target_key)
            (sources || []).each do |source|
              (source[source_key] || []).map! do |target_id|
                target = targets[target_id]
                (target[target_key] ||= Array.new) << source if target
      Severity: Minor
      Found in lib/team_hub/cross_referencer.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(site)
            @site = site
            @data = site.data
            @public_mode = site.config['public']
      
      
      Severity: Minor
      Found in lib/team_hub/joiner.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

      Severity
      Category
      Status
      Source
      Language