helpyio/helpy

View on GitHub

Showing 68 of 242 total issues

Function main has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function main() {
      //your widget code goes here

        jQuery(document).ready(function ($) {

Severity: Minor
Found in app/assets/javascripts/widget.v2.js - About 1 hr to fix

    Function main has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function main() {
          //your widget code goes here
    
            jQuery(document).ready(function ($) {
    
    
    Severity: Minor
    Found in app/assets/javascripts/widget.v1.js - About 1 hr to fix

      Method create_internal_ticket has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create_internal_ticket
          @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 1 hr to fix

        Method create_reply_from_email has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def self.create_reply_from_email(email, email_address, email_name, subject, raw, message, token, to, sitename, cc, number_of_attachments, spam_score, spam_report)      
        Severity: Major
        Found in lib/email_processor.rb - About 1 hr to fix

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

            def create
              params[:id].nil? ? @forum = Forum.find(params[:topic][:forum_id]) : @forum = Forum.find(params[:id])
          
              @topic = @forum.topics.new(
                name: params[:topic][:name],
          Severity: Minor
          Found in app/controllers/topics_controller.rb - About 1 hr to fix

            Method create_reply_from_email has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.create_reply_from_email(email, email_address, email_name, subject, raw, message, token, to, sitename, cc, number_of_attachments, spam_score, spam_report)      
                
                # flag as spam if below spam score threshold
                ticket_status = (spam_score > AppSettings["email.spam_assassin_filter"].to_f) ? "spam" : "new"
                    
            Severity: Minor
            Found in lib/email_processor.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_settings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def update_settings
                # NOTE: We iterate through settings here to establish our universe of settings to save
                # this means if you add a setting, you MUST declare a default value in the "default_settings intializer"
                @settings = AppSettings.get_all
                # iterate through
            Severity: Minor
            Found in app/controllers/admin/settings_controller.rb - About 1 hr to fix

              Method create_new_ticket_from_email has 12 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def self.create_new_ticket_from_email(email, email_address, email_name, subject, raw, message, token, to, cc, number_of_attachments, spam_score, spam_report)
              Severity: Major
              Found in lib/email_processor.rb - About 1 hr to fix

                Method ticketing_ui has a Cognitive Complexity of 12 (exceeds 5 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

                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 new_post has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def new_post(post_id)
                    @post = Post.find(post_id)
                    @topic = @post.topic
                    @posts = @topic.posts.where.not(id: @post.id).ispublic.active.reverse
                    @header = Doc.where(title: 'Customer_header').first.present? ? Doc.where(title: 'Customer_header').first.body : ""
                Severity: Minor
                Found in app/mailers/post_mailer.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 create_new_ticket_from_email has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.create_new_ticket_from_email(email, email_address, email_name, subject, raw, message, token, to, cc, number_of_attachments, spam_score, spam_report)
                
                    # flag as spam if below spam score threshold
                    ticket_status = (spam_score > AppSettings["email.spam_assassin_filter"].to_f) ? "spam" : "new"
                
                
                Severity: Minor
                Found in lib/email_processor.rb - About 1 hr to fix

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

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

                    Method create_forwarded_message_from_email has 32 lines of code (exceeds 25 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 1 hr to fix

                      Method split_topic has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def split_topic
                          parent_topic = Topic.find(params[:topic_id])
                          parent_post = Post.find(params[:post_id])
                      
                          @topic = Topic.new(
                      Severity: Minor
                      Found in app/controllers/admin/topics_controller.rb - About 1 hr to fix

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

                          def create
                            @topic = Topic.find(params[:topic_id])
                            # @post = Post.new(:body => params[:post][:body],
                            #                  :topic_id => @topic.id,
                            #                  :user_id => current_user.id,
                        Severity: Minor
                        Found in app/controllers/admin/posts_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 create_new_ticket_from_email has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.create_new_ticket_from_email(email, email_address, email_name, subject, raw, message, token, to, cc, number_of_attachments, spam_score, spam_report)
                        
                            # flag as spam if below spam score threshold
                            ticket_status = (spam_score > AppSettings["email.spam_assassin_filter"].to_f) ? "spam" : "new"
                        
                        
                        Severity: Minor
                        Found in lib/email_processor.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 import has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def import(file_path, file_name, klass, user, import)
                            started_at = Time.now
                            spreadsheet = open_spreadsheet(file_path, file_name)
                            header = spreadsheet.row(1)
                            if true #header == klass.new.attributes.keys
                        Severity: Minor
                        Found in app/jobs/import_job.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 topic_search has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def topic_search
                        
                            # search for user, if [one] found, we'll give details on that person
                            # if more than one found, we'll list them, if search is for "users" then show all
                            if params[:q] == 'users'
                        Severity: Minor
                        Found in app/controllers/admin/search_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 serialize_autocomplete_result has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def serialize_autocomplete_result(results)
                            serialized_result = []
                            results.each do |result|
                              if result.searchable_type == "Topic"
                                serialized_result << {
                        Severity: Minor
                        Found in app/controllers/result_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 create_forwarded_message_from_email has 10 arguments (exceeds 4 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)
                        Severity: Major
                        Found in lib/email_processor.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language