rl404/go-malscraper

View on GitHub

Showing 369 of 389 total issues

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

func (m *Malscraper) AdvSearchAnime(query model.Query) ([]model.AnimeSearch, int, error) {
    if query.Page == 0 {
        query.Page = 1
    }
    return m.api.SearchAnime(query)
Severity: Minor
Found in api_search.go and 1 other location - About 40 mins to fix
api_user.go on lines 153..158

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

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

        if relType == "Anime:" {
            d.data.Related.Anime = d.getRelatedDetail(relArea)
        } else if relType == "Manga:" {
            d.data.Related.Manga = d.getRelatedDetail(relArea)
        } else if relType == "People:" {
Severity: Minor
Found in internal/parser/news/news_details.go and 1 other location - About 35 mins to fix
internal/parser/article/article_details.go on lines 98..104

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

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

            } else if relType == "Manga:" {
                d.data.Related.Manga = d.getRelatedDetail(relArea)
            } else if relType == "People:" {
                d.data.Related.People = d.getRelatedDetail(relArea)
            } else if relType == "Characters:" {
Severity: Minor
Found in internal/parser/article/article_details.go and 1 other location - About 35 mins to fix
internal/parser/news/news_details.go on lines 84..90

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

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 *Parser) GetMangaMoreInfo(id int) (string, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "manga", id, "a", "moreinfo"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return "", code, err
    }
Severity: Minor
Found in internal/parser/manga.go and 1 other location - About 35 mins to fix
internal/parser/anime.go on lines 122..128

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

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 *Parser) GetAnimeMoreInfo(id int) (string, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "moreinfo"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return "", code, err
    }
Severity: Minor
Found in internal/parser/anime.go and 1 other location - About 35 mins to fix
internal/parser/manga.go on lines 93..99

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

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 (p *Parser) GetArticleTag() ([]model.ArticleTagItem, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "featured", "tag"), ".content-left")
    if err != nil {
        return nil, code, err
    }
Severity: Minor
Found in internal/parser/article.go and 2 other locations - About 35 mins to fix
internal/parser/producer_magazine.go on lines 11..17
internal/parser/producer_magazine.go on lines 30..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 104.

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 (p *Parser) GetMagazines() ([]model.ItemCount, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "manga", "magazine"), ".anime-manga-search")
    if err != nil {
        return nil, code, err
    }
Severity: Minor
Found in internal/parser/producer_magazine.go and 2 other locations - About 35 mins to fix
internal/parser/article.go on lines 34..40
internal/parser/producer_magazine.go on lines 11..17

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

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 (d *detail) setID() {
    area := d.area.Find("#horiznav_nav").Find("li").First()
    link, _ := area.Find("a").Attr("href")
    d.data.ID = utils.StrToNum(utils.GetValueFromSplit(link, "/", 4))
}
Severity: Minor
Found in internal/parser/anime/anime_details.go and 2 other locations - About 35 mins to fix
internal/parser/manga/manga_details.go on lines 38..42
internal/parser/people/people_details.go 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 104.

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 (d *detail) setID() {
    area := d.area.Find("#horiznav_nav").Find("li").First()
    link, _ := area.Find("a").Attr("href")
    d.data.ID = utils.StrToNum(utils.GetValueFromSplit(link, "/", 4))
}
Severity: Minor
Found in internal/parser/people/people_details.go and 2 other locations - About 35 mins to fix
internal/parser/anime/anime_details.go on lines 41..45
internal/parser/manga/manga_details.go 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 104.

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 (d *detail) setID() {
    area := d.area.Find("#horiznav_nav").Find("li").First()
    link, _ := area.Find("a").Attr("href")
    d.data.ID = utils.StrToNum(utils.GetValueFromSplit(link, "/", 2))
}
Severity: Minor
Found in internal/parser/manga/manga_details.go and 2 other locations - About 35 mins to fix
internal/parser/anime/anime_details.go on lines 41..45
internal/parser/people/people_details.go 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 104.

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 (p *Parser) GetProducers() ([]model.ItemCount, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", "producer"), ".anime-manga-search")
    if err != nil {
        return nil, code, err
    }
Severity: Minor
Found in internal/parser/producer_magazine.go and 2 other locations - About 35 mins to fix
internal/parser/article.go on lines 34..40
internal/parser/producer_magazine.go on lines 30..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 104.

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 (p *parser) GetArticle(a *goquery.Selection) []model.ArticleItem {
    d := article{area: a, cleanImg: p.cleanImg}

    if !d.isValid() {
        return nil
Severity: Minor
Found in internal/parser/character/character_article.go and 2 other locations - About 35 mins to fix
internal/parser/character/character_club.go on lines 18..27
internal/parser/character/character_va.go on lines 16..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 103.

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 (p *parser) GetClubs(a *goquery.Selection) []model.ClubItem {
    d := club{area: a, cleanImg: p.cleanImg}

    if !d.isValid() {
        return nil
Severity: Minor
Found in internal/parser/character/character_club.go and 2 other locations - About 35 mins to fix
internal/parser/character/character_article.go on lines 18..27
internal/parser/character/character_va.go on lines 16..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 103.

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 (p *parser) GetVA(a *goquery.Selection) []model.Role {
    v := va{area: a, cleanImg: p.cleanImg}

    if !v.isValid() {
        return nil
Severity: Minor
Found in internal/parser/character/character_va.go and 2 other locations - About 35 mins to fix
internal/parser/character/character_article.go on lines 18..27
internal/parser/character/character_club.go on lines 18..27

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

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

func (m *Malscraper) SearchCharacter(name string, page ...int) ([]model.CharacterSearch, int, error) {
    p := 1
    if len(page) > 0 {
        p = page[0]
    }
Severity: Major
Found in api_search.go and 12 other locations - About 30 mins to fix
api_anime.go on lines 40..46
api_anime.go on lines 58..64
api_club.go on lines 28..34
api_genre.go on lines 29..35
api_genre.go on lines 47..53
api_manga.go on lines 17..23
api_producer_magazine.go on lines 17..23
api_producer_magazine.go on lines 35..41
api_search.go on lines 96..102
api_user.go on lines 31..37
api_user.go on lines 59..65
api_user.go on lines 70..76

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

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 (nl *newsList) getUsername(eachNews *goquery.Selection) string {
    user, _ := eachNews.Find(".information").Find("p").First().Find("a").First().Attr("href")
    return utils.GetValueFromSplit(user, "/", 4)
}
Severity: Minor
Found in internal/parser/news/news_list.go and 1 other location - About 30 mins to fix
internal/parser/article/article_list.go on lines 87..90

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

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

func (m *Malscraper) GetAnimeReview(id int, page ...int) ([]model.Review, int, error) {
    p := 1
    if len(page) > 0 {
        p = page[0]
    }
Severity: Major
Found in api_anime.go and 12 other locations - About 30 mins to fix
api_anime.go on lines 40..46
api_club.go on lines 28..34
api_genre.go on lines 29..35
api_genre.go on lines 47..53
api_manga.go on lines 17..23
api_producer_magazine.go on lines 17..23
api_producer_magazine.go on lines 35..41
api_search.go on lines 85..91
api_search.go on lines 96..102
api_user.go on lines 31..37
api_user.go on lines 59..65
api_user.go on lines 70..76

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

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

func (m *Malscraper) GetAnimeEpisode(id int, page ...int) ([]model.Episode, int, error) {
    p := 1
    if len(page) > 0 {
        p = page[0]
    }
Severity: Major
Found in api_anime.go and 12 other locations - About 30 mins to fix
api_anime.go on lines 58..64
api_club.go on lines 28..34
api_genre.go on lines 29..35
api_genre.go on lines 47..53
api_manga.go on lines 17..23
api_producer_magazine.go on lines 17..23
api_producer_magazine.go on lines 35..41
api_search.go on lines 85..91
api_search.go on lines 96..102
api_user.go on lines 31..37
api_user.go on lines 59..65
api_user.go on lines 70..76

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

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

func (m *Malscraper) GetUserFriend(username string, page ...int) ([]model.UserFriend, int, error) {
    p := 1
    if len(page) > 0 {
        p = page[0]
    }
Severity: Major
Found in api_user.go and 12 other locations - About 30 mins to fix
api_anime.go on lines 40..46
api_anime.go on lines 58..64
api_club.go on lines 28..34
api_genre.go on lines 29..35
api_genre.go on lines 47..53
api_manga.go on lines 17..23
api_producer_magazine.go on lines 17..23
api_producer_magazine.go on lines 35..41
api_search.go on lines 85..91
api_search.go on lines 96..102
api_user.go on lines 59..65
api_user.go on lines 70..76

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

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

func (m *Malscraper) GetProducer(id int, page ...int) ([]model.AnimeItem, int, error) {
    p := 1
    if len(page) > 0 {
        p = page[0]
    }
Severity: Major
Found in api_producer_magazine.go and 12 other locations - About 30 mins to fix
api_anime.go on lines 40..46
api_anime.go on lines 58..64
api_club.go on lines 28..34
api_genre.go on lines 29..35
api_genre.go on lines 47..53
api_manga.go on lines 17..23
api_producer_magazine.go on lines 35..41
api_search.go on lines 85..91
api_search.go on lines 96..102
api_user.go on lines 31..37
api_user.go on lines 59..65
api_user.go on lines 70..76

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

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