Showing 82 of 278 total issues
Function fetch
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fetch: (
_prefix: string,
path: string,
rawMethod: HttpMethod,
params?: AspidaParams<C> | undefined,
Function Navigation
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Navigation = (): JSX.Element => {
const [shown, setShown] = useState(false);
const handleToggle = (): void => {
setShown(!shown);
Function queryMany
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async queryMany(params: StreamQueryManyParams): Promise<StreamDto[]> {
const where: Prisma.StreamWhereInput & { AND: unknown[] } = { AND: [] };
if (params.organizationId != null) {
where.AND.push({
Function useFuzzySearch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useFuzzySearch = (
events: readonly Event[] = [],
): [Event[], (term: string) => void, string | null] => {
const [result, setResult] = useState<Event[]>(
[...events].sort(sortByDelta).slice(0, MAX_RESULT),
Function UpcomingEvents
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const UpcomingEvents = (props: UpcomingEventsProps): JSX.Element => {
const { id, pinnedEventId } = props;
const upcomingEvents = useMemo(() => {
if (props.upcomingEvents == null) return;
Function Marker
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Marker = (props: MakerProps): JSX.Element => {
const { backgroundColor, appearance, width, children } = props;
const fgLight = meetsContrastGuidelines(backgroundColor, '#ffffff').AALarge
? '#ffffff'
Function appErrorHandler
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const appErrorHandler: ErrorRequestHandler = (
error,
_req,
res,
next,
Function UpcomingStreams
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const UpcomingStreams = (props: UpcomingStreamsProps): JSX.Element => {
const { id } = props;
const upcomingStreams = useMemo(() => {
if (props.upcomingStreams == null) return;
Function createFromVideo
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public async createFromVideo(video: Video): Promise<Stream> {
const youtubeChannelId = new YoutubeChannelId(video.channelId);
const channel = await this._fetchChannelFromYoutubeChannel(
youtubeChannelId,
);
- 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 invoke
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async invoke(
command: VerifyYoutubeChannelSubscriptionCommand,
): Promise<void> {
const topic = new URL(command.topic);
const youtubeChannelIdStr = topic.searchParams.get('channel_id');
Function TableDataList
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TableDataList = (props: TableDataListProps): JSX.Element | null => {
const { segment } = props;
const beginning = segment[0]?.schedule.startAt;
const { getWidth, getItemX, getItemY } = useTimetable();
Function Page5
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Page5 = (): JSX.Element => {
return (
<div role="group" aria-describedby="tutorial-5__description">
<div className="aspect-video relative bg-primary-500 w-full">
<Image
Function ServiceUnavailable
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ServiceUnavailable = (): JSX.Element => {
return (
<Section
component={
<Typography.ThreeXl>HTTP 503 ― Service Unavailable</Typography.ThreeXl>
Function setFocusedAt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
(ctx: TimetableContext) =>
(date: Readonly<Dayjs>, params: SetFocusedAtParam = {}): void => {
const { ref, startAt, scale, setFocusedAtRaw } = ctx;
setFocusedAtRaw(date);
- 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 Button
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Button = forwardRef<HTMLElement, Partial<ButtonProps>>((props, ref): JSX.Element => {
const { children, size, shape, variant, className, as, ...rest } = props as ButtonProps;
return createElement(
as,
Function GtagScript
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const GtagScript = (): JSX.Element => {
if (process.env.GA_MEASUREMENT_ID == null) {
return (
<script
dangerouslySetInnerHTML={{
Function TableDataPure
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TableDataPure = (props: ItemProps): JSX.Element => {
const { schedule } = props;
const { getWidth, itemHeight, ref: timetable, interval } = useTimetable();
const { ref, inView } = useInView({
Function update
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async update(channel: Channel): Promise<void> {
if (channel instanceof ChannelYoutube) {
await this._prisma.channel.update({
where: {
id: channel.id.value,
Function updatePerformer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async updatePerformer(
performer: Performer,
command: UpsertPerformerCommand,
) {
const newPerformer = performer
Function BadgePure
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const BadgePure = (props: BadgePureProps): JSX.Element => {
const { children, className } = props;
return (
<div