pboling/flag_shih_tzu

View on GitHub
REEK

Summary

Maintainability
Test Coverage
lib/flag_shih_tzu.rb -- 60 warnings:
  [4]:FlagShihTzu has no descriptive comment (IrresponsibleModule)
  [423, 431, 438, 445, 573]:FlagShihTzu takes parameters [colmn, flag] to 5 methods (DataClump)
  [532]:FlagShihTzu#chained_flags_with_signature has approx 6 statements (TooManyStatements)
  [566]:FlagShihTzu#collect_flags doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
  [433, 435]:FlagShihTzu#disable_flag calls self.class 2 times (DuplicateMethodCall)
  [432]:FlagShihTzu#disable_flag performs a nil-check (NilCheck)
  [425, 427]:FlagShihTzu#enable_flag calls self.class 2 times (DuplicateMethodCall)
  [424]:FlagShihTzu#enable_flag performs a nil-check (NilCheck)
  [446]:FlagShihTzu#flag_disabled? performs a nil-check (NilCheck)
  [439]:FlagShihTzu#flag_enabled? performs a nil-check (NilCheck)
  [502, 511, 512, 514, 515]:FlagShihTzu#update_flag! calls self.class 5 times (DuplicateMethodCall)
  [512, 515]:FlagShihTzu#update_flag! calls self.class.primary_key 2 times (DuplicateMethodCall)
  [500]:FlagShihTzu#update_flag! has approx 6 statements (TooManyStatements)
  [500]:FlagShihTzu#update_flag! has boolean parameter 'update_instance' (BooleanParameter)
  [503]:FlagShihTzu#update_flag! is controlled by argument update_instance (ControlParameter)
  [23]:FlagShihTzu::ClassMethods has no descriptive comment (IrresponsibleModule)
  [244, 257, 367, 386, 391]:FlagShihTzu::ClassMethods takes parameters [colmn, flag] to 5 methods (DataClump)
  [299, 301]:FlagShihTzu::ClassMethods#chained_flags_values calls flag.to_s 2 times (DuplicateMethodCall)
  [295]:FlagShihTzu::ClassMethods#chained_flags_values has approx 10 statements (TooManyStatements)
  [274, 276]:FlagShihTzu::ClassMethods#chained_flags_with calls chained_flags_condition(column, *args) 2 times (DuplicateMethodCall)
  [249, 249]:FlagShihTzu::ClassMethods#check_flag calls flag_mapping[colmn] 2 times (DuplicateMethodCall)
  [249]:FlagShihTzu::ClassMethods#check_flag performs a nil-check (NilCheck)
  [330]:FlagShihTzu::ClassMethods#check_flag_column has approx 11 statements (TooManyStatements)
  [346]:FlagShihTzu::ClassMethods#check_flag_column performs a nil-check (NilCheck)
  [263]:FlagShihTzu::ClassMethods#determine_flag_colmn_for performs a nil-check (NilCheck)
  [74, 80]:FlagShihTzu::ClassMethods#has_flags calls 1 << (flag_key - 1) 2 times (DuplicateMethodCall)
  [35, 42]:FlagShihTzu::ClassMethods#has_flags calls caller.first 2 times (DuplicateMethodCall)
  [139, 212, 220]:FlagShihTzu::ClassMethods#has_flags calls colmn.singularize 3 times (DuplicateMethodCall)
  [74, 80]:FlagShihTzu::ClassMethods#has_flags calls flag_key - 1 2 times (DuplicateMethodCall)
  [58, 74, 80]:FlagShihTzu::ClassMethods#has_flags calls flag_mapping[colmn] 3 times (DuplicateMethodCall)
  [157, 228]:FlagShihTzu::ClassMethods#has_flags calls flag_options[colmn] 2 times (DuplicateMethodCall)
  [34, 36, 38]:FlagShihTzu::ClassMethods#has_flags calls opts[:column] 3 times (DuplicateMethodCall)
  [61, 62]:FlagShihTzu::ClassMethods#has_flags calls self.flag_columns 2 times (DuplicateMethodCall)
  [52, 55]:FlagShihTzu::ClassMethods#has_flags calls self.flag_mapping 2 times (DuplicateMethodCall)
  [24]:FlagShihTzu::ClassMethods#has_flags has approx 26 statements (TooManyStatements)
  [55]:FlagShihTzu::ClassMethods#has_flags performs a nil-check (NilCheck)
  [411]:FlagShihTzu::ClassMethods#named_scope_method doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
  [315, 317]:FlagShihTzu::ClassMethods#parse_flag_options calls args.shift 2 times (DuplicateMethodCall)
  [314]:FlagShihTzu::ClassMethods#parse_flag_options doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
  [314]:FlagShihTzu::ClassMethods#parse_flag_options has approx 7 statements (TooManyStatements)
  [257]:FlagShihTzu::ClassMethods#set_flag_sql has 4 parameters (LongParameterList)
  [258]:FlagShihTzu::ClassMethods#set_flag_sql performs a nil-check (NilCheck)
  [373, 373]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_mapping[colmn] 2 times (DuplicateMethodCall)
  [373, 373]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_mapping[colmn][flag] 2 times (DuplicateMethodCall)
  [370, 374]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_options[colmn] 2 times (DuplicateMethodCall)
  [370, 374]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_options[colmn][:flag_query_mode] 2 times (DuplicateMethodCall)
  [367]:FlagShihTzu::ClassMethods#sql_condition_for_flag has 4 parameters (LongParameterList)
  [367]:FlagShihTzu::ClassMethods#sql_condition_for_flag has approx 7 statements (TooManyStatements)
  [367]:FlagShihTzu::ClassMethods#sql_condition_for_flag has boolean parameter 'enabled' (BooleanParameter)
  [373, 378]:FlagShihTzu::ClassMethods#sql_condition_for_flag is controlled by argument enabled (ControlParameter)
  [391]:FlagShihTzu::ClassMethods#sql_set_for_flag has 4 parameters (LongParameterList)
  [391]:FlagShihTzu::ClassMethods#sql_set_for_flag has boolean parameter 'enabled' (BooleanParameter)
  [391]:FlagShihTzu::ClassMethods#sql_set_for_flag has unused parameter 'custom_table_name' (UnusedParameters)
  [393]:FlagShihTzu::ClassMethods#sql_set_for_flag is controlled by argument enabled (ControlParameter)
  [404]:FlagShihTzu::ClassMethods#valid_flag_column_name? doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
  [396]:FlagShihTzu::ClassMethods#valid_flag_key? doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
  [400]:FlagShihTzu::ClassMethods#valid_flag_name? doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
  [21]:FlagShihTzu::DuplicateFlagColumnException has no descriptive comment (IrresponsibleModule)
  [20]:FlagShihTzu::NoSuchFlagException has no descriptive comment (IrresponsibleModule)
  [19]:FlagShihTzu::NoSuchFlagQueryModeException has no descriptive comment (IrresponsibleModule)
lib/flag_shih_tzu/validators.rb -- 3 warnings:
  [29, 30]:ActiveModel::Validations::PresenceOfFlagsValidator#check_flag calls record.class 2 times (DuplicateMethodCall)
  [29, 30]:ActiveModel::Validations::PresenceOfFlagsValidator#check_flag calls record.class.flag_columns 2 times (DuplicateMethodCall)
  [29, 30]:ActiveModel::Validations::PresenceOfFlagsValidator#check_flag refers to record more than self (maybe move it to another class?) (FeatureEnvy)
63 total warnings