Showing 42 of 266 total issues
Function server
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default async function server(): Promise<void> {
const nc = await connection()
subscription = await nc.subscribe(host, { callback: async (err, msg) => {
const { decode, encode } = JSONCodec()
- 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 ProjectCardSkeleton
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ProjectCardSkeleton(): ReactElement {
const classes = useStyles()
return (
<Card className={classes.root}>
Function ProjectCard
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ProjectCard(): ReactElement {
const classes = useStyles()
return (
<Card className={classes.root}>
Function write
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function write(...args: readonly WriteInput[]): IoLine {
const error = locale.one<LangError>('error')
// var
let result = ''
let err
Function server
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export default async function server(): Promise<void> {
const nc = await connect(process.env.BROKER ?
{ servers: process.env.BROKER } : {})
nc.subscribe(host, { callback: async (err, msg) => {
- 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 chocolabTokens
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function chocolabTokens(/* lang: string */): ChocolabTokens {
const algorithmWord = locale.one<string>('algorithmWord')
const begin = locale.one<string>('begin')
const end = locale.one<string>('end')
const forWord = locale.one<string>('forWord')
Function server
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function server(): Promise<void> {
const nc = await connect(process.env.BROKER ?
{ servers: process.env.BROKER } : {})
nc.subscribe(host, { callback: async (error, msg) => {
Function ProjectsContainer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ProjectsContainer(): ReactElement {
const classes = useStyles()
const { data = [], error, loading } = useFetchProjects()
console.info(loading, data, error)
Function server
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function server(): Promise<void> {
const nc = await connection()
subscription = await nc.subscribe(host, { callback: async (err, msg) => {
const { decode, encode } = JSONCodec()
Function Tags
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Tags(): ReactElement {
return (
<>
<Field
id="username"
Function Data
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Data(): ReactElement {
return (
<div>
<div>
<Field
Function reducer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function reducer(state = getDefaults(), action: LazyActions): readonly Tab[] {
switch (action.type) {
case 'ADD_TAB':
return add(state)
Function callback
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
nc.subscribe(host, { callback: async (error, msg) => {
const { decode, encode } = JSONCodec()
const { reply, data } = msg
if (reply) {
Function callback
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
subscription = await nc.subscribe(host, { callback: async (err, msg) => {
const { decode, encode } = JSONCodec()
const { reply, data } = msg
if (reply) {
Function authenticatorMock
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default async function authenticatorMock(): Promise<void> {
const host = process.env.AUTHENTICATOR || 'authenticator'
const nc = await connection()
subscription = await nc.subscribe(host, { callback: async (err, msg) => {
- 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 checkVariables
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function checkVariables(type: JavascriptType, newLastLine: IoLine, input: string): ReadResponse |
undefined {
const typeError = locale.one<LangTypeError>('typeError')
switch (type) {
- 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 `${keyword} `
Avoid too many return
statements within this function. Open
return <Text>{s}</Text>
Avoid too many return
statements within this function. Open
if (types[0] && types.some((exp) => exp[0].test(s))) return <Type dark>{s}</Type>
Function NewProjectContainer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function NewProjectContainer(): ReactElement {
const classes = useStyles()
const [activeStep, setActiveStep] = React.useState(0)
const handleNext = (): void => {
- 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"