reek warnings
mcandre opened this issue · 1 comments
mcandre commented
I ran reek over multi_json to look for potential sources of bugs:
$ reek lib/
lib//multi_json.rb -- 4 warnings:
MultiJson#default_adapter has approx 10 statements (TooManyStatements)
MultiJson#load_adapter calls new_adapter.to_s twice (DuplicateMethodCall)
MultiJson#load_adapter has approx 7 statements (TooManyStatements)
MultiJson::LoadError has no descriptive comment (IrresponsibleModule)
lib//multi_json/adapter.rb -- 3 warnings:
MultiJson::Adapter has no descriptive comment (IrresponsibleModule)
MultiJson::Adapter#collect_options has the variable name 'r' (UncommunicativeVariableName)
MultiJson::Adapter#defaults contains iterators nested 2 deep (NestedIterators)
lib//multi_json/adapters/gson.rb -- 2 warnings:
MultiJson::Adapters::Gson#dump doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::Gson#load doesn't depend on instance state (UtilityFunction)
lib//multi_json/adapters/jr_jackson.rb -- 1 warning:
MultiJson::Adapters::JrJackson#dump has unused parameter 'options' (UnusedParameters)
lib//multi_json/adapters/json_common.rb -- 6 warnings:
MultiJson::Adapters::JsonCommon has no descriptive comment (IrresponsibleModule)
MultiJson::Adapters::JsonCommon#dump doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::JsonCommon#dump refers to options more than self (FeatureEnvy)
MultiJson::Adapters::JsonCommon#load doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::JsonCommon#load refers to string more than self (FeatureEnvy)
MultiJson::Adapters::JsonCommon#self.activate! calls gem_name twice (DuplicateMethodCall)
lib//multi_json/adapters/json_gem.rb -- 0 warnings
lib//multi_json/adapters/json_pure.rb -- 0 warnings
lib//multi_json/adapters/nsjsonserialization.rb -- 6 warnings:
MultiJson::Adapters::Nsjsonserialization has no descriptive comment (IrresponsibleModule)
MultiJson::Adapters::Nsjsonserialization#dump doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::Nsjsonserialization#dump has approx 6 statements (TooManyStatements)
MultiJson::Adapters::Nsjsonserialization#dump refers to object more than self (FeatureEnvy)
MultiJson::Adapters::Nsjsonserialization#load has approx 6 statements (TooManyStatements)
MultiJson::Adapters::Nsjsonserialization#load refers to string more than self (FeatureEnvy)
lib//multi_json/adapters/oj.rb -- 4 warnings:
MultiJson::Adapters::Oj#dump doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::Oj#dump refers to options more than self (FeatureEnvy)
MultiJson::Adapters::Oj#load doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::Oj#load refers to options more than self (FeatureEnvy)
lib//multi_json/adapters/ok_json.rb -- 3 warnings:
MultiJson::Adapters::OkJson has no descriptive comment (IrresponsibleModule)
MultiJson::Adapters::OkJson#dump has unused parameter 'options' (UnusedParameters)
MultiJson::Adapters::OkJson#load refers to string more than self (FeatureEnvy)
lib//multi_json/adapters/yajl.rb -- 2 warnings:
MultiJson::Adapters::Yajl#load doesn't depend on instance state (UtilityFunction)
MultiJson::Adapters::Yajl#load refers to options more than self (FeatureEnvy)
lib//multi_json/convertible_hash_keys.rb -- 5 warnings:
MultiJson::ConvertibleHashKeys#prepare_object calls prepare_object(value, &key_modifier) twice (DuplicateMethodCall)
MultiJson::ConvertibleHashKeys#prepare_object has approx 9 statements (TooManyStatements)
MultiJson::ConvertibleHashKeys#prepare_object refers to object more than self (FeatureEnvy)
MultiJson::ConvertibleHashKeys#stringify_keys refers to key more than self (FeatureEnvy)
MultiJson::ConvertibleHashKeys#symbolize_keys refers to key more than self (FeatureEnvy)
lib//multi_json/options.rb -- 3 warnings:
MultiJson::Options#get_options calls value.arity twice (DuplicateMethodCall)
MultiJson::Options#get_options has approx 7 statements (TooManyStatements)
MultiJson::Options#get_options refers to value more than self (FeatureEnvy)
lib//multi_json/vendor/okjson.rb -- 143 warnings:
MultiJson::OkJson#abbrev doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#abbrev has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#abbrev has the variable name 'p' (UncommunicativeVariableName)
MultiJson::OkJson#abbrev has the variable name 't' (UncommunicativeVariableName)
MultiJson::OkJson#abbrev refers to t more than self (FeatureEnvy)
MultiJson::OkJson#arrenc has the parameter name 'a' (UncommunicativeParameterName)
MultiJson::OkJson#arrenc has the variable name 'x' (UncommunicativeVariableName)
MultiJson::OkJson#arrparse calls (arr << v) twice (DuplicateMethodCall)
MultiJson::OkJson#arrparse calls (ts[0][0] == "]") 3 times (DuplicateMethodCall)
MultiJson::OkJson#arrparse calls ts[(1..-1)] 3 times (DuplicateMethodCall)
MultiJson::OkJson#arrparse calls ts[0] 3 times (DuplicateMethodCall)
MultiJson::OkJson#arrparse calls ts[0][0] 3 times (DuplicateMethodCall)
MultiJson::OkJson#arrparse calls valparse(ts) twice (DuplicateMethodCall)
MultiJson::OkJson#arrparse has approx 11 statements (TooManyStatements)
MultiJson::OkJson#arrparse has the variable name 'v' (UncommunicativeVariableName)
MultiJson::OkJson#arrparse refers to ts more than self (FeatureEnvy)
MultiJson::OkJson#decode has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#decode has the variable name 'v' (UncommunicativeVariableName)
MultiJson::OkJson#eat calls ts[0] twice (DuplicateMethodCall)
MultiJson::OkJson#eat refers to ts more than self (FeatureEnvy)
MultiJson::OkJson#encode has the parameter name 'x' (UncommunicativeParameterName)
MultiJson::OkJson#falsetok doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#falsetok has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#falsetok refers to s more than self (FeatureEnvy)
MultiJson::OkJson#hexdec4 has the name 'hexdec4' (UncommunicativeMethodName)
MultiJson::OkJson#hexdec4 has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#keyenc has the parameter name 'k' (UncommunicativeParameterName)
MultiJson::OkJson#lex has approx 6 statements (TooManyStatements)
MultiJson::OkJson#lex has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#lex has the variable name 's' (UncommunicativeVariableName)
MultiJson::OkJson#lex performs a nil-check. (NilCheck)
MultiJson::OkJson#lex refers to s more than self (FeatureEnvy)
MultiJson::OkJson#nibble calls c.ord 3 times (DuplicateMethodCall)
MultiJson::OkJson#nibble has the parameter name 'c' (UncommunicativeParameterName)
MultiJson::OkJson#nibble refers to c more than self (FeatureEnvy)
MultiJson::OkJson#nulltok doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#nulltok has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#nulltok refers to s more than self (FeatureEnvy)
MultiJson::OkJson#numenc has the parameter name 'x' (UncommunicativeParameterName)
MultiJson::OkJson#numenc refers to x more than self (FeatureEnvy)
MultiJson::OkJson#numtok calls m[0] 5 times (DuplicateMethodCall)
MultiJson::OkJson#numtok calls m[2] twice (DuplicateMethodCall)
MultiJson::OkJson#numtok calls m[3] twice (DuplicateMethodCall)
MultiJson::OkJson#numtok has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#numtok has the variable name 'm' (UncommunicativeVariableName)
MultiJson::OkJson#numtok refers to m more than self (FeatureEnvy)
MultiJson::OkJson#objenc has the parameter name 'x' (UncommunicativeParameterName)
MultiJson::OkJson#objenc has the variable name 'k' (UncommunicativeVariableName)
MultiJson::OkJson#objenc has the variable name 'v' (UncommunicativeVariableName)
MultiJson::OkJson#objparse calls (ts[0][0] == "}") 3 times (DuplicateMethodCall)
MultiJson::OkJson#objparse calls obj[k] = v twice (DuplicateMethodCall)
MultiJson::OkJson#objparse calls pairparse(ts) twice (DuplicateMethodCall)
MultiJson::OkJson#objparse calls ts[(1..-1)] 3 times (DuplicateMethodCall)
MultiJson::OkJson#objparse calls ts[0] 3 times (DuplicateMethodCall)
MultiJson::OkJson#objparse calls ts[0][0] 3 times (DuplicateMethodCall)
MultiJson::OkJson#objparse has approx 11 statements (TooManyStatements)
MultiJson::OkJson#objparse has the variable name 'k' (UncommunicativeVariableName)
MultiJson::OkJson#objparse has the variable name 'v' (UncommunicativeVariableName)
MultiJson::OkJson#objparse refers to ts more than self (FeatureEnvy)
MultiJson::OkJson#pairparse has the variable name 'k' (UncommunicativeVariableName)
MultiJson::OkJson#pairparse has the variable name 'v' (UncommunicativeVariableName)
MultiJson::OkJson#strenc calls s[r] twice (DuplicateMethodCall)
MultiJson::OkJson#strenc calls t.putc("\"") twice (DuplicateMethodCall)
MultiJson::OkJson#strenc has approx 20 statements (TooManyStatements)
MultiJson::OkJson#strenc has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#strenc has the variable name 'c' (UncommunicativeVariableName)
MultiJson::OkJson#strenc has the variable name 'n' (UncommunicativeVariableName)
MultiJson::OkJson#strenc has the variable name 'r' (UncommunicativeVariableName)
MultiJson::OkJson#strenc has the variable name 't' (UncommunicativeVariableName)
MultiJson::OkJson#strenc refers to t more than self (FeatureEnvy)
MultiJson::OkJson#strtok calls m[0] twice (DuplicateMethodCall)
MultiJson::OkJson#strtok has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#strtok has the variable name 'm' (UncommunicativeVariableName)
MultiJson::OkJson#subst doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#subst has the parameter name 'u1' (UncommunicativeParameterName)
MultiJson::OkJson#subst has the parameter name 'u2' (UncommunicativeParameterName)
MultiJson::OkJson#subst refers to u1 more than self (FeatureEnvy)
MultiJson::OkJson#subst refers to u2 more than self (FeatureEnvy)
MultiJson::OkJson#surrogate? doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#surrogate? has the parameter name 'u' (UncommunicativeParameterName)
MultiJson::OkJson#surrogate? refers to u more than self (FeatureEnvy)
MultiJson::OkJson#tok calls s[0, 1] 14 times (DuplicateMethodCall)
MultiJson::OkJson#tok has approx 11 statements (TooManyStatements)
MultiJson::OkJson#tok has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#tok refers to s more than self (FeatureEnvy)
MultiJson::OkJson#truetok doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#truetok has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#truetok refers to s more than self (FeatureEnvy)
MultiJson::OkJson#ucharcopy calls c1.&(Umaskx) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharcopy calls c2.&(Umaskx) twice (DuplicateMethodCall)
MultiJson::OkJson#ucharcopy calls raise(Utf8Error) 12 times (DuplicateMethodCall)
MultiJson::OkJson#ucharcopy calls t.putc(c0) 4 times (DuplicateMethodCall)
MultiJson::OkJson#ucharcopy calls t.putc(c1) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharcopy calls t.putc(c2) twice (DuplicateMethodCall)
MultiJson::OkJson#ucharcopy has approx 35 statements (TooManyStatements)
MultiJson::OkJson#ucharcopy has the parameter name 'i' (UncommunicativeParameterName)
MultiJson::OkJson#ucharcopy has the parameter name 's' (UncommunicativeParameterName)
MultiJson::OkJson#ucharcopy has the parameter name 't' (UncommunicativeParameterName)
MultiJson::OkJson#ucharcopy has the variable name 'c0' (UncommunicativeVariableName)
MultiJson::OkJson#ucharcopy has the variable name 'c1' (UncommunicativeVariableName)
MultiJson::OkJson#ucharcopy has the variable name 'c2' (UncommunicativeVariableName)
MultiJson::OkJson#ucharcopy has the variable name 'c3' (UncommunicativeVariableName)
MultiJson::OkJson#ucharcopy has the variable name 'n' (UncommunicativeVariableName)
MultiJson::OkJson#ucharcopy has the variable name 'u' (UncommunicativeVariableName)
MultiJson::OkJson#ucharenc calls (i + 0) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls (i + 1) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls (i + 2) twice (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls (u >> 12) twice (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls (u >> 6) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls (u >> 6).&(Umaskx) twice (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls Utagx.|((u >> 6).&(Umaskx)) twice (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls Utagx.|((u >> 6).&(Umaskx)).chr twice (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls Utagx.|(u.&(Umaskx)) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls Utagx.|(u.&(Umaskx)).chr 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharenc calls u.&(Umaskx) 3 times (DuplicateMethodCall)
MultiJson::OkJson#ucharenc doesn't depend on instance state (UtilityFunction)
MultiJson::OkJson#ucharenc has approx 14 statements (TooManyStatements)
MultiJson::OkJson#ucharenc has the parameter name 'a' (UncommunicativeParameterName)
MultiJson::OkJson#ucharenc has the parameter name 'i' (UncommunicativeParameterName)
MultiJson::OkJson#ucharenc has the parameter name 'u' (UncommunicativeParameterName)
MultiJson::OkJson#ucharenc refers to u more than self (FeatureEnvy)
MultiJson::OkJson#unquote calls (r + 1) 5 times (DuplicateMethodCall)
MultiJson::OkJson#unquote calls (r + 6) twice (DuplicateMethodCall)
MultiJson::OkJson#unquote calls (w + 1) 4 times (DuplicateMethodCall)
MultiJson::OkJson#unquote calls q.length 3 times (DuplicateMethodCall)
MultiJson::OkJson#unquote calls q[r, 4] twice (DuplicateMethodCall)
MultiJson::OkJson#unquote calls q[r] 5 times (DuplicateMethodCall)
MultiJson::OkJson#unquote calls rubydoesenc? twice (DuplicateMethodCall)
MultiJson::OkJson#unquote has approx 28 statements (TooManyStatements)
MultiJson::OkJson#unquote has the parameter name 'q' (UncommunicativeParameterName)
MultiJson::OkJson#unquote has the variable name 'a' (UncommunicativeVariableName)
MultiJson::OkJson#unquote has the variable name 'c' (UncommunicativeVariableName)
MultiJson::OkJson#unquote has the variable name 'e' (UncommunicativeVariableName)
MultiJson::OkJson#unquote has the variable name 'q' (UncommunicativeVariableName)
MultiJson::OkJson#unquote has the variable name 'r' (UncommunicativeVariableName)
MultiJson::OkJson#unquote has the variable name 'uchar1' (UncommunicativeVariableName)
MultiJson::OkJson#unquote has the variable name 'w' (UncommunicativeVariableName)
MultiJson::OkJson#unquote refers to q more than self (FeatureEnvy)
MultiJson::OkJson#valenc has approx 8 statements (TooManyStatements)
MultiJson::OkJson#valenc has the parameter name 'x' (UncommunicativeParameterName)
MultiJson::OkJson#valenc performs a nil-check. (NilCheck)
MultiJson::OkJson::Error has no descriptive comment (IrresponsibleModule)
MultiJson::OkJson::Utf8Error has no descriptive comment (IrresponsibleModule)
lib//multi_json/version.rb -- 0 warnings
I'm not familiar enough with multi_json to resolve these myself, just thought I'd mention. Maybe consider ignoring some of these warnings in a .reek
file?
rwz commented
Feel free to send pull-request fixing any of these warnings.