helpyio/helpy

View on GitHub

Showing 68 of 242 total issues

Method anonymize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def anonymize
    return if self.is_admin?

    # anonymize own attributes
    self.update!(
Severity: Minor
Found in app/models/user.rb - About 1 hr to fix

    Method create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        @topic = Topic.find(params[:topic_id])
        @post = @topic.posts.new(post_params)
        @post.topic_id = @topic.id
        @post.user_id = current_user.id
    Severity: Minor
    Found in app/controllers/posts_controller.rb - About 1 hr to fix

      Method get_tickets_by_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_tickets_by_status
          @status = params[:status] || "active"
          if current_user.is_restricted? && teams?
            topics_raw = Topic.all.tagged_with(current_user.team_list, any: true)
          else
      Severity: Minor
      Found in app/controllers/admin/base_controller.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 find_for_oauth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.find_for_oauth(auth)
          user = find_by(email: auth.info.email)
          if user
            user.tap do |u|
              u.provider = auth.provider
      Severity: Minor
      Found in app/models/user.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 update_waiting_on_cache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def update_waiting_on_cache
      
          status = self.topic.current_status
          waiting_on = self.topic.waiting_on
      
      
      Severity: Minor
      Found in app/models/post.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 ticketing_ui has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def ticketing_ui
          @updated_topics = @topics
          if params[:q].present?
            search_date_from_params
            search_topics
      Severity: Minor
      Found in app/controllers/admin/topics_controller.rb - About 1 hr to fix

        Method user_params has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def user_params
            params.require(:user).permit(
              :profile_image,
              :name,
              :bio,
        Severity: Minor
        Found in app/controllers/admin/users_controller.rb - About 1 hr to fix

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

            def index
              #@topics = Topic.mine(current_user.id).pending.page params[:page]
          
              if (current_user.is_admin? || current_user.is_agent?) && (forums? || tickets?)
                redirect_to admin_topics_path
          Severity: Minor
          Found in app/controllers/admin/dashboard_controller.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              @user = User.find(params[:id])
          
              fetch_counts
          
          
          Severity: Minor
          Found in app/controllers/admin/users_controller.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 create_forwarded_message_from_email has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.create_forwarded_message_from_email(email, subject, raw, message, token, to, cc, number_of_attachments, spam_score, spam_report)
          
              # Parse from out of the forwarded raw body
              from = raw[/From: .*<(.*?)>/, 1]
              from_token = from.split("@")[0]
          Severity: Minor
          Found in lib/email_processor.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 perform has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def perform(category, action, label, value, client_id, ga_id)
          Severity: Minor
          Found in app/jobs/tracker_job.rb - About 45 mins to fix

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

              def update_topic
            
                bulk_post_attributes = []
                if params[:change_status].present?
                  user_id = current_user.id || 2
            Severity: Minor
            Found in app/controllers/admin/topics_controller.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 index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                @forum = Forum.ispublic.where(id: params[:forum_id]).first
                if @forum
                  if @forum.allow_topic_voting == true
                    @topics = @forum.topics.ispublic.by_popularity.page(params[:page]).per(15)
            Severity: Minor
            Found in app/controllers/topics_controller.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 upper_nav_item has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def upper_nav_item(label, path, controllers, actions, icon="")
            Severity: Minor
            Found in app/helpers/admin_helper.rb - About 35 mins to fix

              Method navbar_expanding_link has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def navbar_expanding_link(url, icon, text, target="", remote=false)
              Severity: Minor
              Found in app/helpers/admin_helper.rb - About 35 mins to fix

                Method import has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def import(file_path, file_name, klass, user, import)
                Severity: Minor
                Found in app/jobs/import_job.rb - About 35 mins to fix

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

                    def create_customer_conversation
                      @forum = Forum.find(1)
                      @user = User.where("lower(email) = ?", params[:topic][:user][:email].downcase).first
                  
                      @topic = @forum.topics.new(
                  Severity: Minor
                  Found in app/controllers/admin/topics_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

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

                    def create
                      @user = User.new(user_params)
                      fetch_counts
                  
                      # Set the password if it is not provided
                  Severity: Minor
                  Found in app/controllers/admin/users_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

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

                    def show
                      @category = Category.publicly.active.where(id: params[:id]).first
                      if @category
                        if I18n.available_locales.count > 1
                          @docs = @category.docs.ordered.active.with_translations(I18n.locale).page(params[:page]).includes(tags: :taggings)
                  Severity: Minor
                  Found in app/controllers/categories_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

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

                    def self.handle_attachments(email, post)
                      return unless email.attachments.present?
                      if AppSettings['cloudinary.cloud_name'].present? && AppSettings['cloudinary.api_key'].present? && AppSettings['cloudinary.api_secret'].present?
                        array_of_files = []
                        email.attachments.each do |attachment|
                  Severity: Minor
                  Found in lib/email_processor.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

                  Severity
                  Category
                  Status
                  Source
                  Language