rl404/go-malscraper

View on GitHub
internal/parser/anime.go

Summary

Maintainability
C
7 hrs
Test Coverage

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

func (p *Parser) GetAnimeReview(id int, page int) ([]model.Review, int, error) {
    q := map[string]interface{}{"p": page}
    doc, code, err := p.getDoc(utils.BuildURLWithQuery(q, malURL, "anime", id, "a", "reviews"), "#content")
    if err != nil {
        return nil, code, err
Severity: Major
Found in internal/parser/anime.go and 1 other location - About 1 hr to fix
internal/parser/manga.go on lines 20..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 137.

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 (p *Parser) GetAnimeStaff(id int) ([]model.Role, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "characters"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 12 other locations - About 40 mins to fix
internal/parser/anime.go on lines 20..26
internal/parser/anime.go on lines 77..83
internal/parser/anime.go on lines 86..92
internal/parser/anime.go on lines 95..101
internal/parser/anime.go on lines 104..110
internal/parser/manga.go on lines 30..36
internal/parser/manga.go on lines 48..54
internal/parser/manga.go on lines 57..63
internal/parser/manga.go on lines 66..72
internal/parser/manga.go on lines 75..81
internal/parser/people.go on lines 47..53
internal/parser/people.go on lines 56..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 112.

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 (p *Parser) GetAnimeRecommendation(id int) ([]model.Recommendation, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "userrecs"), "#content")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 12 other locations - About 40 mins to fix
internal/parser/anime.go on lines 20..26
internal/parser/anime.go on lines 29..35
internal/parser/anime.go on lines 86..92
internal/parser/anime.go on lines 95..101
internal/parser/anime.go on lines 104..110
internal/parser/manga.go on lines 30..36
internal/parser/manga.go on lines 48..54
internal/parser/manga.go on lines 57..63
internal/parser/manga.go on lines 66..72
internal/parser/manga.go on lines 75..81
internal/parser/people.go on lines 47..53
internal/parser/people.go on lines 56..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 112.

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 (p *Parser) GetAnimeClub(id int) ([]model.ClubItem, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "clubs"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 12 other locations - About 40 mins to fix
internal/parser/anime.go on lines 20..26
internal/parser/anime.go on lines 29..35
internal/parser/anime.go on lines 77..83
internal/parser/anime.go on lines 86..92
internal/parser/anime.go on lines 95..101
internal/parser/manga.go on lines 30..36
internal/parser/manga.go on lines 48..54
internal/parser/manga.go on lines 57..63
internal/parser/manga.go on lines 66..72
internal/parser/manga.go on lines 75..81
internal/parser/people.go on lines 47..53
internal/parser/people.go on lines 56..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 112.

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 (p *Parser) GetAnimeCharacter(id int) ([]model.CharacterItem, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "characters"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 12 other locations - About 40 mins to fix
internal/parser/anime.go on lines 29..35
internal/parser/anime.go on lines 77..83
internal/parser/anime.go on lines 86..92
internal/parser/anime.go on lines 95..101
internal/parser/anime.go on lines 104..110
internal/parser/manga.go on lines 30..36
internal/parser/manga.go on lines 48..54
internal/parser/manga.go on lines 57..63
internal/parser/manga.go on lines 66..72
internal/parser/manga.go on lines 75..81
internal/parser/people.go on lines 47..53
internal/parser/people.go on lines 56..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 112.

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 (p *Parser) GetAnimeNews(id int) ([]model.NewsItem, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "news"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 12 other locations - About 40 mins to fix
internal/parser/anime.go on lines 20..26
internal/parser/anime.go on lines 29..35
internal/parser/anime.go on lines 77..83
internal/parser/anime.go on lines 95..101
internal/parser/anime.go on lines 104..110
internal/parser/manga.go on lines 30..36
internal/parser/manga.go on lines 48..54
internal/parser/manga.go on lines 57..63
internal/parser/manga.go on lines 66..72
internal/parser/manga.go on lines 75..81
internal/parser/people.go on lines 47..53
internal/parser/people.go on lines 56..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 112.

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 (p *Parser) GetAnimeArticle(id int) ([]model.ArticleItem, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "featured"), ".news-list")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 12 other locations - About 40 mins to fix
internal/parser/anime.go on lines 20..26
internal/parser/anime.go on lines 29..35
internal/parser/anime.go on lines 77..83
internal/parser/anime.go on lines 86..92
internal/parser/anime.go on lines 104..110
internal/parser/manga.go on lines 30..36
internal/parser/manga.go on lines 48..54
internal/parser/manga.go on lines 57..63
internal/parser/manga.go on lines 66..72
internal/parser/manga.go on lines 75..81
internal/parser/people.go on lines 47..53
internal/parser/people.go on lines 56..62

Duplicated Code

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

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

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

Tuning

This issue has a mass of 112.

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

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

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

func (p *Parser) GetAnime(id int) (*model.Anime, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id), "#content")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 7 other locations - About 40 mins to fix
internal/parser/article.go on lines 11..17
internal/parser/manga.go on lines 11..17
internal/parser/news.go on lines 11..17
internal/parser/people.go on lines 11..17
internal/parser/user.go on lines 15..21
internal/parser/user.go on lines 24..30
internal/parser/user.go on lines 33..39

Duplicated Code

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

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

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

Tuning

This issue has a mass of 110.

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

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

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

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

Refactorings

Further Reading

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

func (p *Parser) GetAnimePicture(id int) ([]string, int, error) {
    doc, code, err := p.getDoc(utils.BuildURL(malURL, "anime", id, "a", "pics"), ".js-scrollfix-bottom-rel")
    if err != nil {
        return nil, code, err
    }
Severity: Major
Found in internal/parser/anime.go and 3 other locations - About 40 mins to fix
internal/parser/character.go on lines 51..57
internal/parser/manga.go on lines 84..90
internal/parser/people.go on lines 65..71

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

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

There are no issues that match your filters.

Category
Status