Showing 8 of 18 total issues
Function entity_util
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
Open
function entity_util(options: any) {
const seneca = this
const Joi = seneca.util.Joi
const rtag = seneca.util.Nid({ length: options.rtag.len })
- 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"
Further reading
File entity-util.js
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* Copyright (c) 2019-2022 voxgig and other contributors, MIT License */
/* $lab:coverage:off$ */
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
Function resolve_rtag
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function resolve_rtag(msg) {
return __awaiter(this, void 0, void 0, function* () {
const seneca = this;
const space = msg.space;
const key = msg.key;
Function resolve_rtag
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function resolve_rtag(msg: any) {
const seneca = this
const space = msg.space
const key = msg.key
File entity-util.ts
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* Copyright (c) 2019-2022 voxgig and other contributors, MIT License */
/* $lab:coverage:off$ */
'use strict'
/* $lab:coverage:on$ */
Function cmd_save_util
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function cmd_save_util(msg, meta) {
return __awaiter(this, void 0, void 0, function* () {
const start = Date.now();
const ent = msg.ent;
if (options.rtag.active) {
Function cmd_save_util
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function cmd_save_util(msg: any, meta: any) {
const start = Date.now()
const ent = msg.ent
if (options.rtag.active) {
Function cmd_remove_util
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function cmd_remove_util(msg, meta) {
return __awaiter(this, void 0, void 0, function* () {
var start = Date.now();
// TODO: only supports id-based remove
if (options.archive.active) {