Showing 11 of 19 total issues
Function filtersVM
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function filtersVM(attributes) {
const newVM = {} as Filter
const filter = () : Filter => {
const innerProp = prop('')
const filterProp = function (value? : any ) : string | Filter {
- 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
Function Postgrest
has 208 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Postgrest(mithrilInstance) {
const m = mithrilInstance || mithril;
const locker = new ExecutionLocker()
const postgrest = {} as InnerPostgrestData
Function init
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
postgrest.init = (apiPrefix, authenticationOptions, globalHeader = {}, isExpired = defaultIsTokenExpired) => {
postgrest.request = (options) => {
const errorHandler = (xhr) => {
try {
return JSON.parse(xhr.responseText)
Function model
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
postgrest.model = (name) => {
const paginationHeaders = (page, pageSize) => {
if (!pageSize) {
return
}
Function Postgrest
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function Postgrest(mithrilInstance) {
const m = mithrilInstance || mithril;
const locker = new ExecutionLocker()
const postgrest = {} as InnerPostgrestData
- 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
Function filtersVM
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function filtersVM(attributes) {
const newVM = {} as Filter
const filter = () : Filter => {
const innerProp = prop('')
const filterProp = function (value? : any ) : string | Filter {
Function paginationVM
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function paginationVM(mithilInstance) {
const m = mithilInstance;
return (model, order, extraHeaders = {}, authenticate = true) => {
const collection = prop([])
const defaultOrder = order || 'id.desc'
File postgrest.ts
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import prop from 'mithril/stream';
import _ from 'underscore';
import filtersVM, { Filter } from './vms/filtersVM';
import paginationVM from './vms/paginationVM';
import mithril from 'mithril';
Function parametersWithoutOrder
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const parametersWithoutOrder = () => {
return _.reduce(getters, (memo, getter : Filter, attr) => {
if (attr !== 'order') {
const operator = attributes[attr]
Function filter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const filter = () : Filter => {
const innerProp = prop('')
const filterProp = function (value? : any ) : string | Filter {
if (arguments.length > 0) {
innerProp(value)
Function getTotal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getTotal = (xhr) => {
if (!xhr || xhr.status === 0) {
return JSON.stringify({
hint: null,
details: null,