rl404/go-malscraper

View on GitHub

Showing 369 of 389 total issues

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

package anime

import (
    "strings"

Severity: Major
Found in internal/parser/anime/anime_more_info.go and 1 other location - About 2 hrs to fix
internal/parser/manga/manga_more_info.go on lines 1..26

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 216.

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

package manga

import (
    "strings"

Severity: Major
Found in internal/parser/manga/manga_more_info.go and 1 other location - About 2 hrs to fix
internal/parser/anime/anime_more_info.go on lines 1..26

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 216.

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

func (v *Validator) GetUserReview(username string, page int) ([]model.Review, int, error) {
    if len(username) < 2 || len(username) > 16 {
        return nil, http.StatusBadRequest, errors.ErrInvalidUsername
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/user.go and 2 other locations - About 2 hrs to fix
internal/validator/user.go on lines 76..97
internal/validator/user.go on lines 148..169

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 197.

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

func (v *Validator) GetUserRecommendation(username string, page int) ([]model.Recommendation, int, error) {
    if len(username) < 2 || len(username) > 16 {
        return nil, http.StatusBadRequest, errors.ErrInvalidUsername
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/user.go and 2 other locations - About 2 hrs to fix
internal/validator/user.go on lines 76..97
internal/validator/user.go on lines 124..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 197.

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

func (v *Validator) GetUserFriend(username string, page int) ([]model.UserFriend, int, error) {
    if len(username) < 2 || len(username) > 16 {
        return nil, http.StatusBadRequest, errors.ErrInvalidUsername
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/user.go and 2 other locations - About 2 hrs to fix
internal/validator/user.go on lines 124..145
internal/validator/user.go on lines 148..169

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 197.

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

func (c *Cacher) GetUserAnime(query model.UserListQuery) (data []model.UserAnime, code int, err error) {
    // Get from cache.
    key := internal.GetKey(internal.KeyUserAnime, query.Username, query.Page, query.Status, query.Order, query.Tag)
    if c.cacher.Get(key, &data) == nil {
        return data, http.StatusOK, nil
Severity: Major
Found in internal/cacher/user.go and 1 other location - About 2 hrs to fix
internal/cacher/user.go on lines 182..198

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 195.

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

func (c *Cacher) GetUserManga(query model.UserListQuery) (data []model.UserManga, code int, err error) {
    // Get from cache.
    key := internal.GetKey(internal.KeyUserManga, query.Username, query.Page, query.Status, query.Order, query.Tag)
    if c.cacher.Get(key, &data) == nil {
        return data, http.StatusOK, nil
Severity: Major
Found in internal/cacher/user.go and 1 other location - About 2 hrs to fix
internal/cacher/user.go on lines 163..179

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 195.

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

package producermagazine

import (
    "github.com/PuerkitoBio/goquery"
    "github.com/rl404/go-malscraper/model"
Severity: Major
Found in internal/parser/producer_magazine/producer_magazine.go and 1 other location - About 2 hrs to fix
internal/parser/top/top.go on lines 1..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 193.

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

package top

import (
    "github.com/PuerkitoBio/goquery"
    "github.com/rl404/go-malscraper/model"
Severity: Major
Found in internal/parser/top/top.go and 1 other location - About 2 hrs to fix
internal/parser/producer_magazine/producer_magazine.go on lines 1..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 193.

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

func (v *Validator) GetAnimeEpisode(id int, page int) ([]model.Episode, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/anime.go and 3 other locations - About 1 hr to fix
internal/validator/anime.go on lines 144..165
internal/validator/club.go on lines 41..62
internal/validator/manga.go on lines 33..54

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 181.

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

func (v *Validator) GetClubMember(id int, page int) ([]model.ClubMember, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/club.go and 3 other locations - About 1 hr to fix
internal/validator/anime.go on lines 99..120
internal/validator/anime.go on lines 144..165
internal/validator/manga.go on lines 33..54

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 181.

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

func (v *Validator) GetMangaReview(id int, page int) ([]model.Review, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/manga.go and 3 other locations - About 1 hr to fix
internal/validator/anime.go on lines 99..120
internal/validator/anime.go on lines 144..165
internal/validator/club.go on lines 41..62

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 181.

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

func (v *Validator) GetAnimeReview(id int, page int) ([]model.Review, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }
    if page <= 0 {
Severity: Major
Found in internal/validator/anime.go and 3 other locations - About 1 hr to fix
internal/validator/anime.go on lines 99..120
internal/validator/club.go on lines 41..62
internal/validator/manga.go on lines 33..54

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 181.

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

func (m *magazine) getGenres(eachArea *goquery.Selection) []model.Item {
    genres := []model.Item{}
    genreArea := eachArea.Find("div[class=\"genres js-genre\"]")
    genreArea.Find("a").Each(func(i int, genre *goquery.Selection) {
        genreLink, _ := genre.Attr("href")
Severity: Major
Found in internal/parser/producer_magazine/magazine.go and 1 other location - About 1 hr to fix
internal/parser/producer_magazine/producer.go on lines 67..78

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 181.

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

func (p *producer) getGenres(eachArea *goquery.Selection) []model.Item {
    genres := []model.Item{}
    genreArea := eachArea.Find("div[class=\"genres js-genre\"]")
    genreArea.Find("a").Each(func(i int, genre *goquery.Selection) {
        genreLink, _ := genre.Attr("href")
Severity: Major
Found in internal/parser/producer_magazine/producer.go and 1 other location - About 1 hr to fix
internal/parser/producer_magazine/magazine.go on lines 63..74

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 181.

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

func (c *char) setDetail() {
    characters := []model.CharacterSearch{}
    c.area.Find("table").Find("tr").Each(func(i int, eachSearch *goquery.Selection) {
        nameArea := eachSearch.Find("td:nth-of-type(2)")
        characters = append(characters, model.CharacterSearch{
Severity: Major
Found in internal/parser/search/search_character.go and 1 other location - About 1 hr to fix
internal/parser/user/user_friend.go on lines 25..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 179.

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

func (f *friend) setDetails() {
    friendList := []model.UserFriend{}
    f.area.Find(".majorPad").Find(".friendHolder").Each(func(i int, friend *goquery.Selection) {
        friendArea := friend.Find(".friendBlock")
        friendList = append(friendList, model.UserFriend{
Severity: Major
Found in internal/parser/user/user_friend.go and 1 other location - About 1 hr to fix
internal/parser/search/search_character.go on lines 22..34

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 179.

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 22 locations. Consider refactoring.
Open

func (c *Cacher) GetUserFriend(user string, page int) (data []model.UserFriend, code int, err error) {
    // Get from cache.
    key := internal.GetKey(internal.KeyUserFriend, user, page)
    if c.cacher.Get(key, &data) == nil {
        return data, http.StatusOK, nil
Severity: Major
Found in internal/cacher/user.go and 21 other locations - About 1 hr to fix
internal/cacher/anime.go on lines 87..103
internal/cacher/anime.go on lines 125..141
internal/cacher/article.go on lines 30..46
internal/cacher/character.go on lines 49..65
internal/cacher/club.go on lines 49..65
internal/cacher/genre.go on lines 30..46
internal/cacher/genre.go on lines 49..65
internal/cacher/manga.go on lines 30..46
internal/cacher/news.go on lines 30..46
internal/cacher/producer_magazine.go on lines 30..46
internal/cacher/producer_magazine.go on lines 68..84
internal/cacher/recommendation.go on lines 30..46
internal/cacher/review.go on lines 30..46
internal/cacher/search.go on lines 21..37
internal/cacher/search.go on lines 40..56
internal/cacher/season.go on lines 11..27
internal/cacher/top.go on lines 11..27
internal/cacher/top.go on lines 30..46
internal/cacher/user.go on lines 87..103
internal/cacher/user.go on lines 106..122
internal/cacher/user.go on lines 125..141

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 174.

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 22 locations. Consider refactoring.
Open

func (c *Cacher) GetClubMember(id int, page int) (data []model.ClubMember, code int, err error) {
    // Get from cache.
    key := internal.GetKey(internal.KeyClubMember, id, page)
    if c.cacher.Get(key, &data) == nil {
        return data, http.StatusOK, nil
Severity: Major
Found in internal/cacher/club.go and 21 other locations - About 1 hr to fix
internal/cacher/anime.go on lines 87..103
internal/cacher/anime.go on lines 125..141
internal/cacher/article.go on lines 30..46
internal/cacher/character.go on lines 49..65
internal/cacher/genre.go on lines 30..46
internal/cacher/genre.go on lines 49..65
internal/cacher/manga.go on lines 30..46
internal/cacher/news.go on lines 30..46
internal/cacher/producer_magazine.go on lines 30..46
internal/cacher/producer_magazine.go on lines 68..84
internal/cacher/recommendation.go on lines 30..46
internal/cacher/review.go on lines 30..46
internal/cacher/search.go on lines 21..37
internal/cacher/search.go on lines 40..56
internal/cacher/season.go on lines 11..27
internal/cacher/top.go on lines 11..27
internal/cacher/top.go on lines 30..46
internal/cacher/user.go on lines 68..84
internal/cacher/user.go on lines 87..103
internal/cacher/user.go on lines 106..122
internal/cacher/user.go on lines 125..141

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 174.

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 22 locations. Consider refactoring.
Open

func (c *Cacher) GetMagazine(id int, page int) (data []model.MangaItem, code int, err error) {
    // Get from cache.
    key := internal.GetKey(internal.KeyMagazine, id, page)
    if c.cacher.Get(key, &data) == nil {
        return data, http.StatusOK, nil
Severity: Major
Found in internal/cacher/producer_magazine.go and 21 other locations - About 1 hr to fix
internal/cacher/anime.go on lines 87..103
internal/cacher/anime.go on lines 125..141
internal/cacher/article.go on lines 30..46
internal/cacher/character.go on lines 49..65
internal/cacher/club.go on lines 49..65
internal/cacher/genre.go on lines 30..46
internal/cacher/genre.go on lines 49..65
internal/cacher/manga.go on lines 30..46
internal/cacher/news.go on lines 30..46
internal/cacher/producer_magazine.go on lines 30..46
internal/cacher/recommendation.go on lines 30..46
internal/cacher/review.go on lines 30..46
internal/cacher/search.go on lines 21..37
internal/cacher/search.go on lines 40..56
internal/cacher/season.go on lines 11..27
internal/cacher/top.go on lines 11..27
internal/cacher/top.go on lines 30..46
internal/cacher/user.go on lines 68..84
internal/cacher/user.go on lines 87..103
internal/cacher/user.go on lines 106..122
internal/cacher/user.go on lines 125..141

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 174.

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