Showing 4 of 4 total issues
Function renderMemory
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderMemory(node, data) {
const labels = data.map(d => humanizeDate(d['date']));
const memories = data.map(d => d['memory']);
const used_memory = memories.map(x => parseInt(x['used_memory'], 10));
const used_memory_rss = memories.map(x => parseInt(x['used_memory_rss'], 10));
Function renderCpu
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderCpu(node, data) {
const labels = data.map(d => humanizeDate(d['date']));
const cpus = data.map(d => d['cpu']);
const used_cpu_sys = cpus.map(x => parseInt(x['used_cpu_sys'], 10));
const used_cpu_user = cpus.map(x => parseInt(x['used_cpu_user']));
Function renderClient
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderClient(node, data) {
const labels = data.map(d => humanizeDate(d['date']));
const clients = data.map(d => d['client']);
const connected_clients = clients.map(x => parseInt(x['connected_clients'], 10));
const blocked_clients = clients.map(x => parseInt(x['blocked_clients'], 10));
Method check_attrs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def check_attrs
unless redises.is_a?(::Hash)
raise(ArgumentError, 'Invalid redises hash, use like that { test: Redis.new }')
end
redises.each do |k, v|
- Read upRead up
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"