rl404/go-malscraper

View on GitHub
internal/validator/people.go

Summary

Maintainability
C
1 day
Test Coverage

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

func (v *Validator) GetPeopleNews(id int) ([]model.NewsItem, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 18 other locations - About 1 hr to fix
internal/validator/anime.go on lines 33..51
internal/validator/anime.go on lines 54..72
internal/validator/anime.go on lines 168..186
internal/validator/anime.go on lines 189..207
internal/validator/anime.go on lines 210..228
internal/validator/anime.go on lines 231..249
internal/validator/character.go on lines 33..51
internal/validator/character.go on lines 99..117
internal/validator/character.go on lines 120..138
internal/validator/manga.go on lines 57..75
internal/validator/manga.go on lines 99..117
internal/validator/manga.go on lines 120..138
internal/validator/manga.go on lines 141..159
internal/validator/manga.go on lines 162..180
internal/validator/people.go on lines 33..51
internal/validator/people.go on lines 54..72
internal/validator/people.go on lines 75..93
internal/validator/people.go on lines 117..135

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

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

func (v *Validator) GetPeopleStaff(id int) ([]model.Role, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 18 other locations - About 1 hr to fix
internal/validator/anime.go on lines 33..51
internal/validator/anime.go on lines 54..72
internal/validator/anime.go on lines 168..186
internal/validator/anime.go on lines 189..207
internal/validator/anime.go on lines 210..228
internal/validator/anime.go on lines 231..249
internal/validator/character.go on lines 33..51
internal/validator/character.go on lines 99..117
internal/validator/character.go on lines 120..138
internal/validator/manga.go on lines 57..75
internal/validator/manga.go on lines 99..117
internal/validator/manga.go on lines 120..138
internal/validator/manga.go on lines 141..159
internal/validator/manga.go on lines 162..180
internal/validator/people.go on lines 33..51
internal/validator/people.go on lines 75..93
internal/validator/people.go on lines 96..114
internal/validator/people.go on lines 117..135

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

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

func (v *Validator) GetPeopleManga(id int) ([]model.Role, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 18 other locations - About 1 hr to fix
internal/validator/anime.go on lines 33..51
internal/validator/anime.go on lines 54..72
internal/validator/anime.go on lines 168..186
internal/validator/anime.go on lines 189..207
internal/validator/anime.go on lines 210..228
internal/validator/anime.go on lines 231..249
internal/validator/character.go on lines 33..51
internal/validator/character.go on lines 99..117
internal/validator/character.go on lines 120..138
internal/validator/manga.go on lines 57..75
internal/validator/manga.go on lines 99..117
internal/validator/manga.go on lines 120..138
internal/validator/manga.go on lines 141..159
internal/validator/manga.go on lines 162..180
internal/validator/people.go on lines 33..51
internal/validator/people.go on lines 54..72
internal/validator/people.go on lines 96..114
internal/validator/people.go on lines 117..135

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

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

func (v *Validator) GetPeopleCharacter(id int) ([]model.PeopleCharacter, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 18 other locations - About 1 hr to fix
internal/validator/anime.go on lines 33..51
internal/validator/anime.go on lines 54..72
internal/validator/anime.go on lines 168..186
internal/validator/anime.go on lines 189..207
internal/validator/anime.go on lines 210..228
internal/validator/anime.go on lines 231..249
internal/validator/character.go on lines 33..51
internal/validator/character.go on lines 99..117
internal/validator/character.go on lines 120..138
internal/validator/manga.go on lines 57..75
internal/validator/manga.go on lines 99..117
internal/validator/manga.go on lines 120..138
internal/validator/manga.go on lines 141..159
internal/validator/manga.go on lines 162..180
internal/validator/people.go on lines 54..72
internal/validator/people.go on lines 75..93
internal/validator/people.go on lines 96..114
internal/validator/people.go on lines 117..135

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

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

func (v *Validator) GetPeopleArticle(id int) ([]model.ArticleItem, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 18 other locations - About 1 hr to fix
internal/validator/anime.go on lines 33..51
internal/validator/anime.go on lines 54..72
internal/validator/anime.go on lines 168..186
internal/validator/anime.go on lines 189..207
internal/validator/anime.go on lines 210..228
internal/validator/anime.go on lines 231..249
internal/validator/character.go on lines 33..51
internal/validator/character.go on lines 99..117
internal/validator/character.go on lines 120..138
internal/validator/manga.go on lines 57..75
internal/validator/manga.go on lines 99..117
internal/validator/manga.go on lines 120..138
internal/validator/manga.go on lines 141..159
internal/validator/manga.go on lines 162..180
internal/validator/people.go on lines 33..51
internal/validator/people.go on lines 54..72
internal/validator/people.go on lines 75..93
internal/validator/people.go on lines 96..114

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

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

func (v *Validator) GetPeople(id int) (*model.People, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 10 other locations - About 1 hr to fix
internal/validator/anime.go on lines 12..30
internal/validator/anime.go on lines 123..141
internal/validator/article.go on lines 12..30
internal/validator/character.go on lines 12..30
internal/validator/club.go on lines 20..38
internal/validator/club.go on lines 86..104
internal/validator/manga.go on lines 12..30
internal/validator/manga.go on lines 78..96
internal/validator/news.go on lines 12..30
internal/validator/review.go on lines 12..30

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

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

func (v *Validator) GetPeoplePicture(id int) ([]string, int, error) {
    if id <= 0 {
        return nil, http.StatusBadRequest, errors.ErrInvalidID
    }

Severity: Major
Found in internal/validator/people.go and 4 other locations - About 1 hr to fix
internal/validator/anime.go on lines 252..270
internal/validator/character.go on lines 78..96
internal/validator/club.go on lines 65..83
internal/validator/manga.go on lines 183..201

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

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