Showing 9 of 10 total issues
File index.ts
has 527 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* @author Vlad Stirbu
* @license MIT
*
* Copyright © 2014-2020
Function buildEvent
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
buildEvent: function buildEvent(name) {
var callbacks = this.callbacks;
var pseudoEvents = this.pseudoEvents;
var pseudoStates = this.pseudoStates;
var events = this.events;
- 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 buildEvent
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildEvent: function buildEvent(name) {
var callbacks = this.callbacks;
var pseudoEvents = this.pseudoEvents;
var pseudoStates = this.pseudoStates;
var events = this.events;
Function triggerEvent
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function triggerEvent() {
var args = _.toArray(arguments);
var current = this.current;
var target = this.target;
var options: {
Function addConditionalEvent
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
addConditionalEvent: function addConditionalEvent(event) {
var pseudoState: string;
var factory = this.factory;
var callbackPrefix = factory.callbackPrefix;
var noChoiceFound = factory.noChoiceFound;
StateMachineStamp
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
methods: {
emit: _.noop,
error: function (msg, options) {
if (this.target) {
options.instanceId = this.target.instanceId();
Function initTarget
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
initTarget: function initTarget(target) {
var mixin;
const id = v4();
if (!_.isObject(target)) {
Function instanceErrorHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
instanceErrorHandler: function instanceErrorHandler(
err,
instanceId,
action
) {
- 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 canTransition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
canTransition: function canTransition(options) {
var factory = this.factory;
var Type = factory.Type;
switch (factory.type(options)) {
- 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"