Fazendaaa/AnilistBot

View on GitHub

Showing 117 of 179 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const mangaExtra = async ({ user, filter, translation }: IMediaExtraContext): Promise<ExtraEditMessage> => {
    if ('ALL' === filter) {
        return readlistExtra(translation);
    } if ('NOT_YET_RELEASED' === filter) {
        return soonMangaExtra(translation);
Severity: Major
Found in src/lib/telegram/extra/media.ts and 1 other location - About 5 hrs to fix
src/lib/telegram/extra/media.ts on lines 52..66

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 151.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const animeExtra = async ({ user, filter, translation }: IMediaExtraContext): Promise<ExtraEditMessage> => {
    if ('ALL' === filter) {
        return watchlistExtra(translation);
    } if ('NOT_YET_RELEASED' === filter) {
        return soonAnimeExtra(translation);
Severity: Major
Found in src/lib/telegram/extra/media.ts and 1 other location - About 5 hrs to fix
src/lib/telegram/extra/media.ts on lines 68..82

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 151.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

export const staffTitle = ({ name, translation }: IStaffNameContext): string => {
    if (null !== name.first && '' !== name.first) {
        return name.first;
    } if (null !== name.last && '' !== name.last) {
        return name.last;
Severity: Major
Found in src/lib/anilist/parse/title.ts and 2 other locations - About 5 hrs to fix
src/lib/anilist/parse/title.ts on lines 3..13
src/lib/anilist/parse/title.ts on lines 15..25

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

export const charactersTitle = ({ name, translation }: ICharactersNameContext): string => {
    if (null !== name.first && '' !== name.first) {
        return name.first;
    } if (null !== name.last && '' !== name.last) {
        return name.last;
Severity: Major
Found in src/lib/anilist/parse/title.ts and 2 other locations - About 5 hrs to fix
src/lib/anilist/parse/title.ts on lines 3..13
src/lib/anilist/parse/title.ts on lines 27..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const staffInfo = ({ staff, translation }: IStaffContext): IMinimumInline => {
    const { id, image, name } = staff;

    return {
        thumb_url: staffThumbUrl(image),
Severity: Major
Found in src/lib/anilist/searches/info.ts and 1 other location - About 5 hrs to fix
src/lib/anilist/searches/info.ts on lines 33..43

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const charactersInfo = ({ characters, translation }: ICharactersContext): IMinimumInline => {
    const { id, name, image } = characters;

    return {
        thumb_url: charactersThumbUrl(image),
Severity: Major
Found in src/lib/anilist/searches/info.ts and 1 other location - About 5 hrs to fix
src/lib/anilist/searches/info.ts on lines 10..20

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

export const mediaTitle = ({ title, translation }: ITitleContext): string => {
    if (null !== title.english && '' !== title.english) {
        return title.english;
    } if (null !== title.romaji && '' !== title.romaji) {
        return title.romaji;
Severity: Major
Found in src/lib/anilist/parse/title.ts and 2 other locations - About 5 hrs to fix
src/lib/anilist/parse/title.ts on lines 15..25
src/lib/anilist/parse/title.ts on lines 27..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const userLanguage = async ({ id, language }: IUserLanguageContext): Promise<string> => {
    return User.findByIdAndUpdate(id, {}, options).then(async (user: IDBUser) => {
        user.language = language;

        return user.save().then(async (userSaved: IDBUser) => userSaved.language).catch(() => '');
Severity: Major
Found in src/lib/database/user/user.ts and 1 other location - About 5 hrs to fix
src/lib/database/user/user.ts on lines 105..111

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 142.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const userSetTimezone = async ({ id, timezone }: IUserTimezoneContext): Promise<string> => {
    return User.findByIdAndUpdate(id, {}, options).then(async (user: IDBUser) => {
        user.timezone = timezone;

        return user.save().then(async (userSaved: IDBUser) => userSaved.timezone).catch(() => '');
Severity: Major
Found in src/lib/database/user/user.ts and 1 other location - About 5 hrs to fix
src/lib/database/user/user.ts on lines 81..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 142.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const charactersSearch = async ({ search, page, translation }: ISearchContext): Promise<IMinimumInline[]> => {
    const searched = <ICharactersQueryPage> await searchAnilist({ search, page, query: characters });
    const curriedCharactersInfo = ((input: ICharacters) => charactersInfo({ characters: input, translation }));

    return searched.data.Page.characters.map(curriedCharactersInfo);
Severity: Major
Found in src/lib/anilist/searches/searches.ts and 3 other locations - About 5 hrs to fix
src/lib/anilist/searches/searches.ts on lines 17..22
src/lib/anilist/searches/searches.ts on lines 24..29
src/lib/anilist/searches/searches.ts on lines 38..43

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 139.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const staffSearch = async ({ search, page, translation }: ISearchContext): Promise<IMinimumInline[]> => {
    const searched = <IStaffQueryPage> await searchAnilist({ search, page, query: staff });
    const curriedStaffInfo = ((input: IStaff) => staffInfo({ staff: input, translation }));

    return searched.data.Page.staff.map(curriedStaffInfo);
Severity: Major
Found in src/lib/anilist/searches/searches.ts and 3 other locations - About 5 hrs to fix
src/lib/anilist/searches/searches.ts on lines 24..29
src/lib/anilist/searches/searches.ts on lines 31..36
src/lib/anilist/searches/searches.ts on lines 38..43

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 139.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const studiosSearch = async ({ search, page, translation }: ISearchContext): Promise<IMinimumInline[]> => {
    const searched = <IStudiosQueryPage> await searchAnilist({ search, page, query: studio });
    const curriedStudiosInfo = ((studios: IStudios) => studiosInfo({ studios, translation }));

    return searched.data.Page.studios.map(curriedStudiosInfo);
Severity: Major
Found in src/lib/anilist/searches/searches.ts and 3 other locations - About 5 hrs to fix
src/lib/anilist/searches/searches.ts on lines 17..22
src/lib/anilist/searches/searches.ts on lines 31..36
src/lib/anilist/searches/searches.ts on lines 38..43

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 139.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const mediaSearch = async ({ search, page, translation }: ISearchContext): Promise<IMinimumInline[]> => {
    const searched = <IMediaQueryPage> await searchAnilist({ search, page, query: media });
    const curriedMediaInfo = ((input: IMedia) => mediaInfo({ media: input, translation }));

    return searched.data.Page.media.map(curriedMediaInfo);
Severity: Major
Found in src/lib/anilist/searches/searches.ts and 3 other locations - About 5 hrs to fix
src/lib/anilist/searches/searches.ts on lines 17..22
src/lib/anilist/searches/searches.ts on lines 24..29
src/lib/anilist/searches/searches.ts on lines 31..36

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 139.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const animeNotify = async ({ user, id, translation }: ISubscriptionContext): Promise<string> => {
    return toogleSubscription({ kind: true, content_id: id, user }).then((value: boolean) => {
        return (true === value) ? translation.t('animeNotifyEnabled') : translation.t('animeNotifyDisabled');
    }).catch(() => translation.t('animeNotifyError'));
};
Severity: Major
Found in src/lib/telegram/callback/list.ts and 2 other locations - About 4 hrs to fix
src/lib/telegram/callback/list.ts on lines 14..18
src/lib/telegram/callback/list.ts on lines 38..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const mangaNotify = async ({ user, id, translation }: ISubscriptionContext): Promise<string> => {
    return toogleSubscription({ kind: false, content_id: id, user }).then((value: boolean) => {
        return (true === value) ? translation.t('mangaNotifyEnabled') : translation.t('mangaNotifyDisabled');
    }).catch(() => translation.t('mangaNotifyError'));
};
Severity: Major
Found in src/lib/telegram/callback/list.ts and 2 other locations - About 4 hrs to fix
src/lib/telegram/callback/list.ts on lines 14..18
src/lib/telegram/callback/list.ts on lines 32..36

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

const addReadlist = async ({ user, id, translation }: ISubscriptionContext): Promise<string> => {
    return addSubscription({ kind: false, content_id: id, user }).then((added: boolean) => {
        return (true === added) ? translation.t('addedReadlist') : translation.t('alreadyReadlist');
    }).catch(() => translation.t('errorReadlist'));
};
Severity: Major
Found in src/lib/telegram/callback/list.ts and 2 other locations - About 4 hrs to fix
src/lib/telegram/callback/list.ts on lines 32..36
src/lib/telegram/callback/list.ts on lines 38..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    const fourthLine = [
        Markup.callbackButton('10h', `USER/HOUR/${calculatePeriod({ hour: 10, period })}`),
        Markup.callbackButton('11h', `USER/HOUR/${calculatePeriod({ hour: 11, period })}`),
        Markup.callbackButton('12h', `USER/HOUR/${calculatePeriod({ hour: 12, period })}`)
    ];
Severity: Major
Found in src/lib/telegram/keyboard/menu.ts and 3 other locations - About 3 hrs to fix
src/lib/telegram/keyboard/menu.ts on lines 131..135
src/lib/telegram/keyboard/menu.ts on lines 136..140
src/lib/telegram/keyboard/menu.ts on lines 141..145

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 110.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    const firstLine = [
        Markup.callbackButton('1h', `USER/HOUR/${calculatePeriod({ hour: 1, period })}`),
        Markup.callbackButton('2h', `USER/HOUR/${calculatePeriod({ hour: 2, period })}`),
        Markup.callbackButton('3h', `USER/HOUR/${calculatePeriod({ hour: 3, period })}`)
    ];
Severity: Major
Found in src/lib/telegram/keyboard/menu.ts and 3 other locations - About 3 hrs to fix
src/lib/telegram/keyboard/menu.ts on lines 136..140
src/lib/telegram/keyboard/menu.ts on lines 141..145
src/lib/telegram/keyboard/menu.ts on lines 146..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 110.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    const secondLine = [
        Markup.callbackButton('4h', `USER/HOUR/${calculatePeriod({ hour: 4, period })}`),
        Markup.callbackButton('5h', `USER/HOUR/${calculatePeriod({ hour: 5, period })}`),
        Markup.callbackButton('6h', `USER/HOUR/${calculatePeriod({ hour: 6, period })}`)
    ];
Severity: Major
Found in src/lib/telegram/keyboard/menu.ts and 3 other locations - About 3 hrs to fix
src/lib/telegram/keyboard/menu.ts on lines 131..135
src/lib/telegram/keyboard/menu.ts on lines 141..145
src/lib/telegram/keyboard/menu.ts on lines 146..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 110.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    const thirdLine = [
        Markup.callbackButton('7h', `USER/HOUR/${calculatePeriod({ hour: 7, period })}`),
        Markup.callbackButton('8h', `USER/HOUR/${calculatePeriod({ hour: 8, period })}`),
        Markup.callbackButton('9h', `USER/HOUR/${calculatePeriod({ hour: 9, period })}`)
    ];
Severity: Major
Found in src/lib/telegram/keyboard/menu.ts and 3 other locations - About 3 hrs to fix
src/lib/telegram/keyboard/menu.ts on lines 131..135
src/lib/telegram/keyboard/menu.ts on lines 136..140
src/lib/telegram/keyboard/menu.ts on lines 146..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 110.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language