osbridge/openconferenceware

View on GitHub

Showing 66 of 90 total issues

Avoid too many return statements within this method.
Open

        return false
Severity: Major
Found in app/controllers/open_conference_ware/application_controller.rb - About 30 mins to fix

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

      def get_content
        if self.page.exists?
          if self.page.content.kind_of?(Hash) and value = self.page.content['content']
            return value
          else
    Severity: Minor
    Found in lib/rwikibot_page_drone.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 snippet_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def snippet_for(slug, use_simple_format=true)
          record = snippet_record_for(slug)
          string = record.content
          if admin?
            if matcher = string.match(%r{(.+)(</(?:div|p)>)\s*$}s)
    Severity: Minor
    Found in app/helpers/open_conference_ware/snippets_helper.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 validate_url_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate_url_attribute(*attributes)
            valid = true
            for attribute in [attributes].flatten
              value = self.read_attribute(attribute)
              next if value.blank?
    Severity: Minor
    Found in app/mixins/open_conference_ware/normalize_url_mixin.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 overlaps? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def overlaps?(object)
          raise ArgumentError unless object.respond_to?(:start_time) && object.respond_to?(:end_time)
          if self.start_time != self.end_time && object.start_time != object.end_time
            (self.start_time.to_i..self.end_time.to_i).overlaps?(object.start_time.to_i..object.end_time.to_i) && (self.end_time != object.start_time && self.start_time != object.end_time)
          else
    Severity: Minor
    Found in app/mixins/open_conference_ware/schedule_overlaps_mixin.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 assert_accepting_proposals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def assert_accepting_proposals
          unless accepting_proposals? || admin?
            flash[:failure] = Snippet.content_for(:proposals_not_accepted_error)
            redirect_to @event ? event_proposals_path(@event) : proposals_path
          end
    Severity: Minor
    Found in app/controllers/open_conference_ware/proposals_controller.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