False Positive : Literal get occurs several times in one or more files
dawesi opened this issue · comments
Chris Dawes commented
Literal get occurs several times in one or more files. Consider giving it a name and not hard coding values.cflint(GLOBAL_LITERAL_VALUE_USED_TOO_OFTEN)
reports lines getRandom, getMaax, getMin, getMedian, but not before that. These are literal values in a json string and should be exempt from parsing as it is a fixed value. This is a very valid use of a literal as it is in a config.
variables.methodMaps = variables.methodMaps.merge([
{ "name":"getOne", "target":"get", "config":{ "limit":1, "item":"first" } },
{ "name":"getFirst", "target":"get", "config":{ "limit":1, "item":"first" } },
{ "name":"getLast", "target":"get", "config":{ "limit":1, "item":"last" } },
{ "name":"getRandom", "target":"get", "config":{ "limit":1, "item":"random" } },
{ "name":"getMax", "target":"get", "config":{ "limit":1, "item":"max" } },
{ "name":"getMin", "target":"get", "config":{ "limit":1, "item":"min" } },
{ "name":"getMedian", "target":"get", "config":{ "limit":1, "item":"median" } }
]);