newtheatre/history-project

View on GitHub

Showing 115 of 117 total issues

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

    def generate(site)
      Jekyll.logger.info "Generating people by..."

      @year_end = site.config['year_end']
      @role_map = site.data['role-map'].to_liquid
Severity: Minor
Found in _plugins/people_by.rb - About 1 hr to fix

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

  def to_liquid
    if @isd
      h = {
        "key" => @imageID,
        # SM named sizes aren't really used
Severity: Minor
Found in _plugins/smugmug_image.rb - About 1 hr to fix

Method fill_people_reverse_index has 27 lines of code (exceeds 25 allowed). Consider refactoring.
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 - About 1 hr to fix

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

      if person.data["careers"] and person.data["careers"].class == Array
        for item in person.data["careers"]
          (@people_by_career[item] ||= []) << person
        end
      elsif person.data["careers"] and person.data["careers"].class == String
Severity: Major
Found in _plugins/people_by.rb and 1 other location - About 1 hr to fix
_plugins/people_by.rb on lines 52..58

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

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 person.data["course"] and person.data["course"].class == Array
        for item in person.data["course"]
          (@people_by_course[item] ||= []) << person
        end
      elsif person.data["course"] and person.data["course"].class == String
Severity: Major
Found in _plugins/people_by.rb and 1 other location - About 1 hr to fix
_plugins/people_by.rb on lines 44..50

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

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

Function make_template has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def make_template(title, period, sort, season, playwright, date_start, date_end, content):
Severity: Major
Found in _bin/stub_maker.py - About 1 hr to fix

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

    def generate(site)
      if not site.config["skip_seasons"]
        @collection = site.collections["seasons"]
        Jekyll.logger.info "Generating seasons..."

Severity: Minor
Found in _plugins/season.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 generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def generate(site)
      if not site.config["skip_years"]
        @collection = site.collections["years"]
        Jekyll.logger.info "Generating years..."

Severity: Minor
Found in _plugins/year.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 generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def generate(site)
      if not site.config["skip_virtual_people"]
        @collection = site.collections["people"]
        Jekyll.logger.info "Generating virtual people..."

Severity: Minor
Found in _plugins/people.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 cache_fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def cache_fetch(id)
    if File.exist?(cache_filename(id))
      cache_file = File.open(cache_filename(id), "r")
      cache_data = JSON.load(cache_file)
      cache_file.close
Severity: Minor
Found in _plugins/smugmug.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 get_show_asset_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_show_asset_type(show, key, image_only=true)
      show.data["assets"].select do |i|
        # Skip non-images if image_only
        if image_only and not i.key?("image") then next end

Severity: Minor
Found in _plugins/show.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 get_show_display_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_show_display_image(show)
      # Assets required
      return nil unless show.data.key?("assets")

      # Find assets that fit the criteria for being a display image
Severity: Minor
Found in _plugins/show.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

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

gulp.task('late_files_images', function () {
    // Copies contents of images/ into site
    return gulp.src('images/**')
        .pipe(gulp.dest('_site/images'));
});
Severity: Minor
Found in gulpfile.js and 1 other location - About 35 mins to fix
gulpfile.js on lines 44..48

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

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

gulp.task('late_files_lib', function () {
    // Copies contents of lib/ into site
    return gulp.src('lib/**')
        .pipe(gulp.dest('_site/lib'));
});
Severity: Minor
Found in gulpfile.js and 1 other location - About 35 mins to fix
gulpfile.js on lines 56..60

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

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

Avoid too many return statements within this method.
Open

        return nil
Severity: Major
Found in _plugins/show.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return programmes[0]
Severity: Major
Found in _plugins/show.rb - About 30 mins to fix

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

def parse_person_list(pl, people_by_filename)
  """Add additional data to a person_list"""
  for pli in pl
    if pli.key?("name")
      filename = make_hp_path(pli["name"])
Severity: Minor
Found in _plugins/person_list.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

Line contains inconsistent indentation
Open

      throw err if err

Method generate_asset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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 - 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 role_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def role_map
      role_map = Hash.new
      for item in @roles
        role_map[item['role']] = item['role']

Severity: Minor
Found in _plugins/roles.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