lib/site_linking.rb

Summary

Maintainability
A
35 mins
Test Coverage

Method has too many lines. [18/10]
Open

    def error_linking_site
      set_kete_net_urls
      top_message = I18n.t('site_linking_lib.error_linking_site.error_occured')
      site_listing
      if @site_listing.blank?
Severity: Minor
Found in lib/site_linking.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [15/10]
Open

    def site_listing
      check_nessesary_constants_set
      set_kete_net_urls
      @site_listing = nil
      SiteLinkingResource.find(:all, params: { url: SystemSetting.full_site_url }).each do |link|
Severity: Minor
Found in lib/site_linking.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

    def site_listing
      check_nessesary_constants_set
      set_kete_net_urls
      @site_listing = nil
      SiteLinkingResource.find(:all, params: { url: SystemSetting.full_site_url }).each do |link|
Severity: Minor
Found in lib/site_linking.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

Use the return of the conditional for variable assignment and comparison.
Open

      if @site_listing.nil?
        @site_listing = ''
      else
        @site_listing = "#{@kete_sites}/#{@site_listing['id']}"
      end
Severity: Minor
Found in lib/site_linking.rb by rubocop

Use the return of the conditional for variable assignment and comparison.
Open

      if @site_listing.blank?
        top_message += I18n.t(
          'site_linking_lib.error_linking_site.manual_linking',
          new_kete_site: @new_kete_site
        )
Severity: Minor
Found in lib/site_linking.rb by rubocop

There are no issues that match your filters.

Category
Status