Showing 107 of 123 total issues
Avoid deeply nested control flow statements. Open
if (portal.link === PortalLinkage.BOTH) {
// find existing portal
const existingPortal = existingRoom.portals.find((it) => isDestPortal(portal, it));
if (doesExist(existingPortal)) {
Avoid deeply nested control flow statements. Open
for (const item of actor.items) {
if (seen.has(item.meta.id) === false) {
seen.add(item.meta.id);
await this.script.invoke(item, SIGNAL_STEP, {
...scope,
Function makeTestRoom
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
id: string,
name: string,
template: string,
actors: Array<Actor> = [],
items: Array<Item> = [],
Function modifyActor
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring. Open
public async modifyActor(target: Actor, available: Array<Modifier<Actor>>): Promise<void> {
const selected = this.selectModifiers(available);
for (const mod of selected) {
// target.source cannot be modified
- 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 SignalActorStep
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring. Open
export async function SignalActorStep(this: ScriptTarget, context: ScriptContext): Promise<void> {
const actor = assertActor(this);
const health = getKey(actor.stats, STAT_HEALTH, 0);
if (health <= 0) {
- 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 getVerbScripts
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring. Open
export function getVerbScripts(target: VerbTarget): ImmutableScriptMap {
const scripts: ImmutableScriptMap = new Map();
if (isActor(target.actor)) {
mergeVerbScripts(scripts, target.actor.scripts);
- 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
Avoid deeply nested control flow statements. Open
if (seen.has(portal.meta.id) === false) {
seen.add(portal.meta.id);
await this.script.invoke(portal, SIGNAL_STEP, {
...scope,
portal,
Avoid deeply nested control flow statements. Open
if (doesExist(existingPortal)) {
existingPortal.dest = room.meta.id;
} else {
// or create reverse link
const destPortal = await this.reversePortal(portal, room);
Avoid deeply nested control flow statements. Open
if (seen.has(item.meta.id) === false) {
seen.add(item.meta.id);
await this.script.invoke(item, SIGNAL_STEP, {
...scope,
item,
Function makeTestPortal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function makeTestPortal(id: string, name: string, source: string, target: string, dest: string): Portal {
Function Shortcuts
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
export const Shortcuts = (props: ShortcutProps): JSX.Element => {
const { t } = useTranslation();
const [tab, setTab] = useState<ShortcutKeys>('actors');
const { isFocused: tabFocus } = useFocus();
const { isFocused: itemFocus } = useFocus();
- 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 groupOn
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
export function groupOn<TValue>(items: ReadonlyArray<TValue>, delimiters: Set<TValue>): Array<Array<TValue>> {
const groups = [];
const buffer = [];
for (const item of items) {
- 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
Avoid too many return
statements within this function. Open
return context.state.show(context.source, 'actor.verb.push.dest.room', { actor, command, portal, room: target });
Avoid too many return
statements within this function. Open
return context.state.show(context.source, 'actor.verb.push.dest.missing', { actor, command, portal });
Function SignalActorLook
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
export async function SignalActorLook(this: ScriptTarget, context: ScriptContext): Promise<void> {
const actor = assertActor(this);
const health = getKey(actor.stats, STAT_HEALTH, 0);
- 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 equipItems
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
export function equipItems(actor: Actor, items: StringMap): void {
for (const [slot, id] of items) {
if (actor.slots.has(slot)) {
const item = actor.items.find((it) => matchIdSegments(it.meta.id, id));
if (doesExist(item) && matchIdSegments(item.slot, slot)) {
- 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 SignalBehaviorDraculaVanHelsing
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
export async function SignalBehaviorDraculaVanHelsing(this: ScriptTarget, context: ScriptContext): Promise<void> {
const actor = assertActor(this);
const room = mustExist(context.room);
const actors = await context.state.find({
- 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 modifyItem
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
public async modifyItem(target: Item, available: Array<Modifier<Item>>): Promise<void> {
const selected = this.selectModifiers(available);
for (const mod of selected) {
if (doesExist(mod.meta)) {
- 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 selectModifiers
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
public selectModifiers<TBase>(mods: Array<Modifier<TBase>>): Array<Partial<BaseModifier<TBase>>> {
const excluded = new Set<string>();
const selected = [];
for (const mod of mods) {
- 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
TODO found Open
// TODO: make assertions
- Exclude checks