apeeyush/Data-Analytics-Log-Manager

View on GitHub

Showing 21 of 34 total issues

Function monitor has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function monitor(){
  // Collect parameters for HTML form fields
  var application = $('#monitor').find("select[name='monitor[application]']").val();
  var activity = $('#monitor').find("select[name='monitor[activity]']").val();
  // Initialize graph
Severity: Major
Found in app/assets/javascripts/dashboard.js - About 3 hrs to fix

    Function QueryViewModel has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function QueryViewModel() {
        //Data
        var self = this;
        this.filter = ko.observableArray();
        this.filter_having_keys = ko.observable({
    Severity: Major
    Found in app/assets/javascripts/knockout_binding.js - About 2 hrs to fix

      Function doGroupAnalysis has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function doGroupAnalysis(data) {
        var parent_keys = data.template.parent_keys;
        var child_keys = data.template.child_keys;
        var kParentCollectionName = "Parent Table";
        var kChildCollectionName = "Child Table";
      Severity: Major
      Found in app/assets/javascripts/codap.js - About 2 hrs to fix

        Method filter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.filter(filter_list)
            logs = self
            logs_columns = Log.column_lists
            string_columns = logs_columns["string_columns"]
            time_columns = logs_columns["time_columns"]
        Severity: Minor
        Found in app/models/log.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

        Function doSingleTableAnalysis has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function doSingleTableAnalysis(data){
          var kParentCollectionName = "Parent Table";
        
          codapPhone.call({
            action: 'reset'
        Severity: Minor
        Found in app/assets/javascripts/codap.js - About 1 hr to fix

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

            def index
              query = JSON.parse(json_escape(params["json-textarea"]))
          
              logs = Log.access_filter(current_user)
              logs = logs.filter(query["filter"]) if (query["filter"].present?)
          Severity: Minor
          Found in app/controllers/table_transform_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 compute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.compute(logs, parent, synthetic_data, parents_list, child_keys)
              computed_logs = []
              if synthetic_data["rule"] != nil && synthetic_data["rule"]["pattern"] != nil
                pattern = synthetic_data["rule"]["pattern"]
              end
          Severity: Minor
          Found in lib/add_synthetic_data.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 index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              if @query["group"] != nil && %w{username activity application session event}.include?(@query["group"])
                initialize_group_transform
                if @query["child_query"].present?
                  if @query["child_query"]["add_child_data"] == true
          Severity: Minor
          Found in app/controllers/group_transform_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 filter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.filter(filter_list)
              logs = self
              logs_columns = Log.column_lists
              string_columns = logs_columns["string_columns"]
              time_columns = logs_columns["time_columns"]
          Severity: Minor
          Found in app/models/log.rb - About 1 hr to fix

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

              def self.compute(logs, parent, synthetic_data, parents_list, child_keys)
                computed_logs = []
                if synthetic_data["rule"] != nil && synthetic_data["rule"]["pattern"] != nil
                  pattern = synthetic_data["rule"]["pattern"]
                end
            Severity: Minor
            Found in lib/add_synthetic_data.rb - About 1 hr to fix

              Function fnServerParams has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  fnServerParams: function(aoData) {
                    var activityName, applicationName, endPeriod, startPeriod, timeZone;
                    applicationName = $("#filter_application").val();
                    aoData.push({
                      name: "applicationName",
              Severity: Minor
              Found in app/assets/javascripts/logs.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                          if key != "sessionID" && key != "uname" && key != "application" && key != "activity" && key != "event" && key != "timestamp" && key != "parameters"
                            new_log[:extras][key] = value
                          end
                Severity: Major
                Found in app/controllers/api/is_controller.rb - About 1 hr to fix

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

                    def value(key)
                        if self[key].present?
                        self[key].class != ActiveSupport::TimeWithZone ? self[key] : self[key].to_i
                      elsif self[:parameters].present? && self[:parameters][key].present?
                        return self[:parameters][key]
                  Severity: Minor
                  Found in app/models/log.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 index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def index
                        # If the request body contains a single log (request body is not an array)
                        if ( !JSON.parse(request.body.read).is_a?(Array) )
                          log_data = JSON.parse(request.body.read)
                          status, log = create_new_is_log(log_data)
                  Severity: Minor
                  Found in app/controllers/api/is_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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def create
                        # If the request body contains a single log (request body is not an array)
                        if ( !JSON.parse(request.body.read).is_a?(Array) )
                          log_data = JSON.parse(request.body.read)
                          status, log = create_new_log(log_data)
                  Severity: Minor
                  Found in app/controllers/api/logs_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 column_lists has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.column_lists
                      string_columns, time_columns, hstore_concat_string = [], [], ""
                      columns_hash = Hash.new
                      Log.columns.each do |column|
                        columns_hash[column.name] = column.type
                  Severity: Minor
                  Found in app/models/log.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 filter_having_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.filter_having_keys(filter)
                      logs = self
                      logs_columns = Log.column_lists
                      string_columns = logs_columns["string_columns"]
                      time_columns = logs_columns["time_columns"]
                  Severity: Minor
                  Found in app/models/log.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 compute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def self.compute(logs, parent, synthetic_data, parents_list, child_keys)
                  Severity: Minor
                  Found in lib/add_synthetic_data.rb - About 35 mins to fix

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

                      def fetch_logs
                        logs = Log.where(application: @application_list)
                        logs = logs.order("#{sort_column} #{sort_direction}")
                        if params[:applicationName].present?
                          logs = logs.where(application: params[:applicationName])
                    Severity: Minor
                    Found in app/datatables/logs_datatable.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

                    Avoid too many return statements within this method.
                    Open

                          return flash_type.to_s
                    Severity: Major
                    Found in app/helpers/application_helper.rb - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language