newtheatre/history-project

View on GitHub

Showing 115 of 117 total issues

Cyclomatic complexity for generate is too high. [12/6]
Open

    def generate(site)
      # Generate venue pages for venues without manually created pages.
      if not site.config["skip_venues"]
        @collection = site.collections["venues"]
        Jekyll.logger.info "Generating venues..."
Severity: Minor
Found in _plugins/venue.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for missing_majority is too high. [12/6]
Open

    def missing_majority(show)
      # We don't have crew_incomplete yet, so let's work it out.
      show_crew_count = show.data["crew"] ? show.data["crew"].length : 0
      amount_missing = 0 
      missing_fields = ''
Severity: Minor
Found in _plugins/show.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for show_iterator is too high. [11/6]
Open

    def show_iterator(show)
      if show.data["season"]
        # Special case, UNCUT/Fringe being the same thing
        if show.data["season"] == "UNCUT"
          season_corrected = "Fringe"
Severity: Minor
Found in _plugins/shows_by.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

    def show_iterator(show)
      if show.data["season"]
        # Special case, UNCUT/Fringe being the same thing
        if show.data["season"] == "UNCUT"
          season_corrected = "Fringe"
Severity: Minor
Found in _plugins/shows_by.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

File show.rb has 259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Jekyll
  class ShowDataGenerator < Jekyll::Generator
    priority :high

    # From years.rb
Severity: Minor
Found in _plugins/show.rb - About 2 hrs to fix

Cyclomatic complexity for fill_people_reverse_index is too high. [10/6]
Open

def fill_people_reverse_index(item, people_list, index_name, site)

  # Create the RI for this case if first time
  unless site.data.key?(index_name)
    site.data[index_name] = Hash.new
Severity: Minor
Found in _plugins/person_list.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

    def generate_person(person)
      """Method called on all people"""
      # Validate things
      if not person.data.has_key?("title")
        Jekyll.logger.abort_with("Person record #{person.basename_without_ext} missing key 'title'")
Severity: Minor
Found in _plugins/people.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 missing_majority has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def missing_majority(show)
      # We don't have crew_incomplete yet, so let's work it out.
      show_crew_count = show.data["crew"] ? show.data["crew"].length : 0
      amount_missing = 0 
      missing_fields = ''
Severity: Minor
Found in _plugins/show.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

Cyclomatic complexity for get_show_playwright is too high. [8/6]
Open

    def get_show_playwright(show)
      if show.data.key?("playwright") and not show.data["playwright"].nil?
        if show.data["playwright"] == "various"
          # Is various, special case
          ["various", nil, "Various Writers"]
Severity: Minor
Found in _plugins/show.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method generate_person has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def generate_person(person)
      """Method called on all people"""
      # Validate things
      if not person.data.has_key?("title")
        Jekyll.logger.abort_with("Person record #{person.basename_without_ext} missing key 'title'")
Severity: Minor
Found in _plugins/people.rb - About 1 hr to fix

Method generate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def generate(site)
      # Generate venue pages for venues without manually created pages.
      if not site.config["skip_venues"]
        @collection = site.collections["venues"]
        Jekyll.logger.info "Generating venues..."
Severity: Minor
Found in _plugins/venue.rb - About 1 hr to fix

Method missing_majority has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def missing_majority(show)
      # We don't have crew_incomplete yet, so let's work it out.
      show_crew_count = show.data["crew"] ? show.data["crew"].length : 0
      amount_missing = 0 
      missing_fields = ''
Severity: Minor
Found in _plugins/show.rb - About 1 hr to fix

Cyclomatic complexity for generate_asset is too high. [7/6]
Open

    def generate_asset(show, asset)
      """Method called for each asset in the asset attribute"""
      # Assign the show as an attr of the asset
      asset["show"] = show

Severity: Minor
Found in _plugins/assets.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Error: invalid syntax (<unknown>, line 50)</unknown>
Open

        print "Writing {}".format(filename)
Severity: Minor
Found in _bin/stub_maker.py by radon

We encountered an error attempting to analyze this line.

Method roles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def roles(set)
      roles = Set.new
      unless set.nil?
        for ri in set
          for role in ri['roles']
Severity: Minor
Found in _plugins/people_index.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 get_show_playwright has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get_show_playwright(show)
      if show.data.key?("playwright") and not show.data["playwright"].nil?
        if show.data["playwright"] == "various"
          # Is various, special case
          ["various", nil, "Various Writers"]
Severity: Minor
Found in _plugins/show.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 people_iterator has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def people_iterator(person)
      if person.data["shows"]
        # If had shows
        for record in person.data["shows"]
          # Loop through each show with involvement
Severity: Minor
Found in _plugins/people_by.rb - About 1 hr to fix

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

    return gulp.src('_coffee/app/*.coffee')
        .pipe(sourcemaps.init())
        .pipe(coffee({bare: true}).on('error', gutil.log))
        .pipe(concat('app.js'))
Severity: Major
Found in gulpfile.js and 1 other location - About 1 hr to fix
gulpfile.js on lines 114..117

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

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

    return gulp.src('_coffee/scripts/*.coffee')
        .pipe(sourcemaps.init())
        .pipe(coffee({bare: true}).on('error', gutil.log))
        .pipe(sourcemaps.write('.'))
Severity: Major
Found in gulpfile.js and 1 other location - About 1 hr to fix
gulpfile.js on lines 97..100

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

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 role_icons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def role_icons
      role_icons = Hash.new
      for item in @roles
        if item.key?('role') and item.key?('icon')
          role_icons[item['role']] = item['icon']
Severity: Minor
Found in _plugins/roles.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

Severity
Category
Status
Source
Language