rl404/go-malscraper

View on GitHub

Showing 389 of 389 total issues

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

func (d *detail) setTags() {
    tags := []string{}
    d.area.Find(".news-container .tags").Find("a.tag").Each(func(i int, tag *goquery.Selection) {
        link, _ := tag.Attr("href")
        tags = append(tags, utils.GetValueFromSplit(link, "/", 5))
Severity: Major
Found in internal/parser/article/article_details.go and 1 other location - About 1 hr to fix
internal/parser/news/news_details.go on lines 72..79

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

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.SearchAnime has 10 return statements (exceeds 4 allowed).
Open

func (v *Validator) SearchAnime(query model.Query) ([]model.AnimeSearch, int, error) {
    if len(query.Title) < 3 {
        return nil, http.StatusBadRequest, errors.Err3LettersSearch
    }
    if query.Page < 0 {
Severity: Major
Found in internal/validator/search.go - About 1 hr to fix

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

    func (p *Parser) GetReview(id int) (*model.Review, int, error) {
        q := map[string]interface{}{"id": id}
        doc, code, err := p.getDoc(utils.BuildURLWithQuery(q, malURL, "reviews.php"), "#content")
        if err != nil {
            return nil, code, err
    Severity: Major
    Found in internal/parser/review.go and 2 other locations - About 1 hr to fix
    internal/parser/club.go on lines 21..28
    internal/parser/club.go on lines 51..58

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

    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) GetClub(id int) (*model.Club, int, error) {
        q := map[string]interface{}{"cid": id}
        doc, code, err := p.getDoc(utils.BuildURLWithQuery(q, malURL, "clubs.php"), "#contentWrapper")
        if err != nil {
            return nil, code, err
    Severity: Major
    Found in internal/parser/club.go and 2 other locations - About 1 hr to fix
    internal/parser/club.go on lines 51..58
    internal/parser/review.go on lines 11..18

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

    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) GetClubRelated(id int) (*model.ClubRelated, int, error) {
        q := map[string]interface{}{"cid": id}
        doc, code, err := p.getDoc(utils.BuildURLWithQuery(q, malURL, "clubs.php"), "#contentWrapper")
        if err != nil {
            return nil, code, err
    Severity: Major
    Found in internal/parser/club.go and 2 other locations - About 1 hr to fix
    internal/parser/club.go on lines 21..28
    internal/parser/review.go on lines 11..18

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

    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 (r *reviews) getSource(topArea *goquery.Selection, bottomArea *goquery.Selection) model.Source {
        sourceArea := topArea.Find(".mb8:nth-of-type(2)")
        return model.Source{
            ID:    r.getSourceID(sourceArea),
            Type:  r.getSourceType(sourceArea),
    Severity: Minor
    Found in internal/parser/review/reviews.go and 1 other location - About 1 hr to fix
    internal/parser/user/user_review.go on lines 72..80

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

    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 (r *review) getSource(topArea *goquery.Selection, bottomArea *goquery.Selection) model.Source {
        sourceArea := topArea.Find("div:nth-of-type(2)")
        return model.Source{
            ID:    r.getSourceID(sourceArea),
            Type:  r.getSourceType(sourceArea),
    Severity: Minor
    Found in internal/parser/user/user_review.go and 1 other location - About 1 hr to fix
    internal/parser/review/reviews.go on lines 57..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 128.

    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.SearchManga has 9 return statements (exceeds 4 allowed).
    Open

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

      Method Validator.isNewsTagValid has 9 return statements (exceeds 4 allowed).
      Open

      func (v *Validator) isNewsTagValid(tag string) bool {
          if tag == "" {
              return true
          }
      
      
      Severity: Major
      Found in internal/validator/validator.go - About 55 mins to fix

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

        func (r *reviews) getDate(topArea *goquery.Selection) time.Time {
            area := topArea.Find("div").First().Find("div").First()
            date := area.Text()
            time, _ := area.Attr("title")
            t, _ := utils.StrToTime(date + " " + time)
        Severity: Minor
        Found in internal/parser/review/reviews.go and 1 other location - About 55 mins to fix
        internal/parser/user/user_review.go on lines 107..113

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

        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 (r *review) getDate(topArea *goquery.Selection) time.Time {
            area := topArea.Find("div").First().Find("div").First()
            date := area.Text()
            time, _ := area.Attr("title")
            t, _ := utils.StrToTime(date + " " + time)
        Severity: Minor
        Found in internal/parser/user/user_review.go and 1 other location - About 55 mins to fix
        internal/parser/review/reviews.go on lines 101..107

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

        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 (d *detail) setImage() {
            image, _ := d.area.Find("#content table tr td div a").Html()
            if image == "" {
                d.data.Image = ""
            } else {
        Severity: Minor
        Found in internal/parser/character/character_detail.go and 1 other location - About 55 mins to fix
        internal/parser/people/people_details.go on lines 42..50

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

        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 (d *detail) setImage() {
            image, _ := d.area.Find("#content table tr td div a").Html()
            if image == "" {
                d.data.Image = ""
            } else {
        Severity: Minor
        Found in internal/parser/people/people_details.go and 1 other location - About 55 mins to fix
        internal/parser/character/character_detail.go on lines 46..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 123.

        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 (v *Validator) GetTopAnime(t int, p int) ([]model.TopAnime, int, error) {
            if !utils.InArrayInt(topAnimeTypes, t) {
                return nil, http.StatusBadRequest, errors.ErrInvalidType
            }
            if p <= 0 {
        Severity: Minor
        Found in internal/validator/top.go and 1 other location - About 50 mins to fix
        internal/validator/top.go on lines 23..31

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

        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 (v *Validator) GetTopManga(t int, p int) ([]model.TopManga, int, error) {
            if !utils.InArrayInt(topMangaTypes, t) {
                return nil, http.StatusBadRequest, errors.ErrInvalidType
            }
            if p <= 0 {
        Severity: Minor
        Found in internal/validator/top.go and 1 other location - About 50 mins to fix
        internal/validator/top.go on lines 12..20

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 122.

        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) SearchAnime(query model.Query) ([]model.AnimeSearch, int, error) {
            doc, code, err := p.getDoc(utils.BuildURLWithQuery(p.queryToMap(query), malURL, "anime.php"), "div.js-categories-seasonal")
            if err != nil {
                return nil, code, err
            }
        Severity: Minor
        Found in internal/parser/search.go and 1 other location - About 50 mins to fix
        internal/parser/search.go on lines 20..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 122.

        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) SearchManga(query model.Query) ([]model.MangaSearch, int, error) {
            doc, code, err := p.getDoc(utils.BuildURLWithQuery(p.queryToMap(query), malURL, "manga.php"), "div.js-categories-seasonal")
            if err != nil {
                return nil, code, err
            }
        Severity: Minor
        Found in internal/parser/search.go and 1 other location - About 50 mins to fix
        internal/parser/search.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 122.

        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) GetArticles(page int, tag string) ([]model.ArticleItem, int, error) {
            if page <= 0 {
                return nil, http.StatusBadRequest, errors.ErrInvalidPage
            }
            if !v.isArticleTagValid(tag) {
        Severity: Major
        Found in internal/validator/article.go and 3 other locations - About 50 mins to fix
        internal/validator/genre.go on lines 19..27
        internal/validator/genre.go on lines 30..38
        internal/validator/news.go on lines 33..41

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

        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) GetAnimeWithGenre(id int, page int) ([]model.AnimeItem, int, error) {
            if page <= 0 {
                return nil, http.StatusBadRequest, errors.ErrInvalidPage
            }
            if !v.isAnimeGenreValid(id) {
        Severity: Major
        Found in internal/validator/genre.go and 3 other locations - About 50 mins to fix
        internal/validator/article.go on lines 33..41
        internal/validator/genre.go on lines 30..38
        internal/validator/news.go on lines 33..41

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

        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) GetNewsList(page int, tag string) ([]model.NewsItem, int, error) {
            if page <= 0 {
                return nil, http.StatusBadRequest, errors.ErrInvalidPage
            }
            if !v.isNewsTagValid(tag) {
        Severity: Major
        Found in internal/validator/news.go and 3 other locations - About 50 mins to fix
        internal/validator/article.go on lines 33..41
        internal/validator/genre.go on lines 19..27
        internal/validator/genre.go on lines 30..38

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

        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