rl404/go-malscraper

View on GitHub

Showing 389 of 389 total issues

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

Method Validator.SearchClub has 5 return statements (exceeds 4 allowed).
Open

func (v *Validator) SearchClub(query model.ClubQuery) ([]model.ClubSearch, int, error) {
    if len(query.Name) < 3 {
        return nil, http.StatusBadRequest, errors.Err3LettersSearch
    }
    if query.Page < 0 {
Severity: Major
Found in internal/validator/search.go - About 35 mins to fix

    Method Validator.GetRecommendation has 5 return statements (exceeds 4 allowed).
    Open

    func (v *Validator) GetRecommendation(t string, id1, id2 int) (*model.Recommendation, int, error) {
        if t != AnimeType && t != MangaType {
            return nil, http.StatusBadRequest, errors.ErrInvalidType
        }
        if id1 <= 0 || id2 <= 0 {
    Severity: Major
    Found in internal/validator/recommendation.go - About 35 mins to fix

      Method Validator.SearchUser has 5 return statements (exceeds 4 allowed).
      Open

      func (v *Validator) SearchUser(query model.UserQuery) ([]model.UserSearch, int, error) {
          if len(query.Username) < 3 {
              return nil, http.StatusBadRequest, errors.Err3LettersSearch
          }
          if query.Page < 0 {
      Severity: Major
      Found in internal/validator/search.go - About 35 mins to fix

        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 (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 (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) 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 (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) 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) 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 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 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) 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

        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) GetAnimeWithGenre(id int, page ...int) ([]model.AnimeItem, int, error) {
            p := 1
            if len(page) > 0 {
                p = page[0]
            }
        Severity: Major
        Found in api_genre.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 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) GetUserRecommendation(username string, page ...int) ([]model.Recommendation, 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 31..37
        api_user.go on lines 59..65

        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) GetClubMember(id int, page ...int) ([]model.ClubMember, int, error) {
            p := 1
            if len(page) > 0 {
                p = page[0]
            }
        Severity: Major
        Found in api_club.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_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

        Severity
        Category
        Status
        Source
        Language