metaminded/tabulatr2

View on GitHub

Showing 626 of 626 total issues

Class has too many lines. [111/100]
Open

class Tabulatr::Renderer

  def initialize(klass, view,
      filter:              Tabulatr.filter,
      search:              Tabulatr.search,
Severity: Minor
Found in lib/tabulatr/renderer/renderer.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Function tabulatrInitialize has 218 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function tabulatrInitialize() {
  tabulatr_tables = [];

  $('th.tabulatr-sortable').click(function(){
    var th = $(this);
Severity: Major
Found in app/assets/javascripts/tabulatr/_events.js - About 1 day to fix

    Module has too many lines. [105/100]
    Open

    module Tabulatr::Data::DSL
    
      def main_class
        target_class_name # to get auto setting @target_class
        @target_class
    Severity: Minor
    Found in lib/tabulatr/data/dsl.rb by rubocop

    This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Class has too many lines. [101/100]
    Open

    class Tabulatr::Renderer::Column
      include ActiveModel::Model
    
      attr_accessor *%i{name klass table_name col_options output block}
    
    
    Severity: Minor
    Found in lib/tabulatr/renderer/column.rb by rubocop

    This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for apply_sorting is too high. [35.06/15]
    Open

      def apply_sorting(sortparam)
        if sortparam.present?
          clname, orientation = sortparam.split(' ')
          if clname[':']
            splitted = clname.split(':')
    Severity: Minor
    Found in lib/tabulatr/data/sorting.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [28/10]
    Open

      def data_for_table(params, locals: {}, default_order: nil, controller: nil, &block)
    
        @batch_actions = block if block_given?
        @controller    = controller
        @default_order = default_order
    Severity: Minor
    Found in lib/tabulatr/data/data.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for data_for_table is too high. [33.12/15]
    Open

      def data_for_table(params, locals: {}, default_order: nil, controller: nil, &block)
    
        @batch_actions = block if block_given?
        @controller    = controller
        @default_order = default_order
    Severity: Minor
    Found in lib/tabulatr/data/data.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Function updatePagination has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

      updatePagination: function(currentPage){
        var $paginatorUl = $('.pagination[data-table='+ this.tableId +'] > ul');
        $paginatorUl.html(this.createResetButton());
        if(this.pageCount < 13){
          for(var i = 1; i <= this.pageCount; i++){
    Severity: Minor
    Found in app/assets/javascripts/tabulatr/_pagination.js - About 3 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

    Assignment Branch Condition size for tabulatr_for is too high. [31.38/15]
    Open

      def tabulatr_for(relation, tabulatr_data_class: nil, serializer: nil, render_action: nil, default_order: nil, locals: {}, &block)
        klass = relation.respond_to?(:klass) ? relation.klass : relation
        locals[:current_user] ||= current_user if respond_to?(:current_user)
        if batch_params(klass, params).present?
          response = klass.tabulatr(relation, tabulatr_data_class).data_for_table(params, locals: locals, controller: self, &block)

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [25/10]
    Open

      def apply_sorting(sortparam)
        if sortparam.present?
          clname, orientation = sortparam.split(' ')
          if clname[':']
            splitted = clname.split(':')
    Severity: Minor
    Found in lib/tabulatr/data/sorting.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [23/10]
    Open

      def tabulatr_for(relation, tabulatr_data_class: nil, serializer: nil, render_action: nil, default_order: nil, locals: {}, &block)
        klass = relation.respond_to?(:klass) ? relation.klass : relation
        locals[:current_user] ||= current_user if respond_to?(:current_user)
        if batch_params(klass, params).present?
          response = klass.tabulatr(relation, tabulatr_data_class).data_for_table(params, locals: locals, controller: self, &block)

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for initialize is too high. [26.19/15]
    Open

      def initialize(relation)
        @relation   = relation
        @base       = self.class.main_class rescue nil
        @base       ||= relation.respond_to?(:klass) ? relation.klass : relation
        @table_name = @base.table_name
    Severity: Minor
    Found in lib/tabulatr/data/data.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for get_requested_columns is too high. [24.84/15]
    Open

      def get_requested_columns(available_columns, requested_columns)
        main_table_name = @klass.table_name.to_sym
        requested_columns.collect do |r|
          if r.is_a?(Hash) && r.count == 1
            r = "#{r.keys.first}:#{r.values.first}"
    Severity: Minor
    Found in lib/tabulatr/renderer/renderer.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [18/10]
    Open

      def self.build(data, klass, requested_attributes, id="id")
        if klass && ActiveModel.const_defined?(:ArraySerializer)
          ActiveModel::ArraySerializer.new(data,
            { root: "data", meta: data.__pagination,
              each_serializer: klass
    Severity: Minor
    Found in lib/tabulatr/json_builder.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [18/10]
    Open

      def initialize(klass, view,
          filter:              Tabulatr.filter,
          search:              Tabulatr.search,
          paginate:            Tabulatr.paginate,
          pagesize:            Tabulatr.pagesize,
    Severity: Minor
    Found in lib/tabulatr/renderer/renderer.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    File _tabulatr.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    function Tabulatr(id){
      this.id = id;
      this.name = '';
      this.moreResults = true;
      this.currentData = null;
    Severity: Minor
    Found in app/assets/javascripts/tabulatr/_tabulatr.js - About 2 hrs to fix

      prototype has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Tabulatr.prototype = {
        constructor: Tabulatr,
      
        updateTable: function(hash, forceReload) {
          var $table = $('#'+ this.id);
      Severity: Minor
      Found in app/assets/javascripts/tabulatr/_tabulatr.js - About 2 hrs to fix

        Assignment Branch Condition size for determine_appropriate_filter! is too high. [20.42/15]
        Open

          def determine_appropriate_filter!
            typ = self.klass.columns_hash[self.name.to_s].type.to_sym rescue nil
            case typ
            when :integer then self.col_options.filter = filter_type_for_integer
            when :enum then self.col_options.filter = :enum
        Severity: Minor
        Found in lib/tabulatr/renderer/column.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [15/10]
        Open

          def column(name, opts = {}, &block)
            @table_columns ||= []
            sql_options = determine_sql(opts, main_class.quoted_table_name, name)
            opts = {
                    sort_sql: sql_options[:sort_sql],
        Severity: Minor
        Found in lib/tabulatr/data/dsl.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Assignment Branch Condition size for association is too high. [20.83/15]
        Open

          def association(assoc, name, opts = {}, &block)
            @table_columns ||= []
            assoc_klass = main_class.reflect_on_association(assoc.to_sym)
            tname = assoc_klass.try(:quoted_table_name) || assoc_klass.try(:klass).try(:quoted_table_name)
            sql_options = determine_sql(opts, tname, name)
        Severity: Minor
        Found in lib/tabulatr/data/dsl.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Severity
        Category
        Status
        Source
        Language