Showing 82 of 278 total issues
Function aspidaSupertestClient
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const aspidaSupertestClient = <C>(
supertest: supertest.SuperTest<supertest.Test>,
) =>
({
baseURL: '',
- 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 Slide
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Slide = (props: SlideProps): JSX.Element | null => {
const { title, pages, show, onHide } = props;
const [pageNum, setPageNum] = useState(0);
const titleNode = useRef<HTMLElement | null>(null);
Function createFromVideo
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async createFromVideo(video: Video): Promise<Stream> {
const youtubeChannelId = new YoutubeChannelId(video.channelId);
const channel = await this._fetchChannelFromYoutubeChannel(
youtubeChannelId,
);
Function Switch
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Switch = (props: SwitchProps): JSX.Element => {
const { value, className, onChange, ...rest } = props;
const [enabled, setEnabled] = useState(value);
Function configure
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public configure(): Application {
const app = express();
const winstonInstance = this._logger as winston.Logger;
// parser
Function Item
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Item = (props: ItemProps): JSX.Element => {
const { title, href, icon } = props;
const router = useRouter();
const active = router.pathname === href;
Function mapVariant
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mapVariant = (variant: Variant): string => {
switch (variant) {
case 'primary':
return classNames(
'bg-primary-500',
Function User
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const User = (): JSX.Element => {
const [swapDelta, setSwapDelta] = useSwapDelta();
const { autoplayEnabled, setAutoplay } = useAutoplay();
return (
Function ScheduleListPure
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ScheduleListPure = (props: ScheduleListProps): JSX.Element => {
const { schedules } = props;
const { interval } = useTimetable();
const segments = useMemo(() => {
Function StreamPure
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const StreamPure = (props: EventProps): JSX.Element => {
const { stream, variant, embedType = 'interaction', layout, ...rest } = props;
const now = useNow();
const { autoplayEnabled } = useAutoplay();
Function Tags
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Tags = (props: TagsProps): JSX.Element => {
const { data } = props;
const { genres } = useGenres({ fallbackData: data });
return (
Function isOverlapping
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const isOverlapping = (
[xStartAt, xEndAt]: DayjsPair,
[yStartAt, yEndAt]: DayjsPair,
): boolean => {
/**
- 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 Liver
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Liver = (props: LiverProps): JSX.Element => {
const { liver, twitter, youtube, size } = props;
return (
<User
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render(): JSX.Element {
return (
<Html lang="ja">
<Head>
<meta charSet="utf-8" />
Function upsert
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async upsert(stream: Stream): Promise<Stream> {
const data = await this._prisma.stream.upsert({
where: {
id: stream.id.value,
},
Function Title
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
(props, forwardedRef) => {
const { children, className, ...rest } = props;
const { onHide } = useModal();
Function EventPure
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EventPure = (props: EventProps): JSX.Element => {
const { event, variant, embedType = 'interaction', layout, ...rest } = props;
const now = useNow();
const { autoplayEnabled } = useAutoplay();
Function Livers
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Livers = (props: LiversProps): JSX.Element => {
const { data } = props;
const { livers } = useLivers({ fallbackData: data });
return (
Function SearchPure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const SearchPure = (props: SearchProps): JSX.Element => {
const { show, loading, events, onHide } = props;
const [ref, setRef] = useState<HTMLInputElement | null>(null);
const listbox = useRef<HTMLUListElement | null>(null);
- 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 constructor
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor() {
super({
youtube: {
dataApiKey: env('YOUTUBE_DATA_API_KEY'),
websubHmacSecret: env('YOUTUBE_WEBSUB_HMAC_SECRET'),