extinctionrebellion/RebelsManager

View on GitHub

Showing 11 of 37 total issues

Function exports has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 2 hrs to fix

    Method section_heading has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def section_heading(heading:, extra: nil, spacing: :hr, count: nil, icon: nil)
        out = ActiveSupport::SafeBuffer.new
        if spacing == :hr
          out << content_tag(:div, class: "grid-x") do
            content_tag(:div, class: "cell auto") do
    Severity: Minor
    Found in app/helpers/ui_helper.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 create_fields has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_fields(mailtrain_list_id)
        MailtrainService.instance.create_field(
          mailtrain_list_id,
          {
            "NAME": "Postcode",
    Severity: Major
    Found in app/jobs/mailtrain/create_list_fields_job.rb - About 2 hrs to fix

      Method section_heading has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def section_heading(heading:, extra: nil, spacing: :hr, count: nil, icon: nil)
          out = ActiveSupport::SafeBuffer.new
          if spacing == :hr
            out << content_tag(:div, class: "grid-x") do
              content_tag(:div, class: "cell auto") do
      Severity: Minor
      Found in app/helpers/ui_helper.rb - About 1 hr to fix

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

            def rebel_params(params)
              params
                .require(:rebel)
                .permit(
                  :agree_with_principles,
        Severity: Minor
        Found in app/services/rebels/update_service.rb - About 1 hr to fix

          Method decorate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def decorate(model, cache: false, reload: true)
              if model.present?
                base = model.class.name.underscore.gsub("/", "__")
                decorator_class = "#{model.class.name}Decorator".constantize
                decorator_var = "@#{base}_decorator"
          Severity: Minor
          Found in app/decorators/decorator_helpers.rb - About 55 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 callout has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def callout(type, content:, tiny: false, link_label: nil, link_href: nil, link_options: {})
              out = ActiveSupport::SafeBuffer.new
              if link_label && link_href
                out << content_tag(:div, class: "cell small-12 medium-shrink") do
                  if tiny
          Severity: Minor
          Found in app/helpers/ui_helper.rb - About 55 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 render_menu_items has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def render_menu_items(menu_items, level, options = {})
              if menu_items.present?
                ul_options = { class: ['menu', options[:class]] }
                if options[:dropdown]
                  ul_options[:class] << 'dropdown'
          Severity: Minor
          Found in app/presenters/components/menu_presenter.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              service = Rebels::ImportService.new
              if service.run(params)
                @csv_import = service.csv_import
                if !@csv_import.import_errors.any?
          Severity: Minor
          Found in app/controllers/rebels/imports_controller.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

          Function animateCss has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            animateCss(node, animationName, callback) {
              node.classList.add('animated')
              if (animationName instanceof Array) {
                animationName.forEach((animationClass, i) => {
                  node.classList.add(animationClass)
          Severity: Minor
          Found in app/javascript/js/animations.js - 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 catch_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def catch_error(context: {})
              block_given? ? yield : false
            rescue => e
              Raven.capture_exception(e) if report_errors?
              Rails.logger.debug("#{e.class.name} - #{e.message}")
          Severity: Minor
          Found in app/services/service_base.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