Bnei-Baruch/mdb

View on GitHub

Showing 431 of 1,135 total issues

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

func handleUpdatePersonI18n(exec boil.Executor, id int64, i18ns []*models.PersonI18n) (*Person, *HttpError) {
    person, err := handleGetPerson(exec, id)
    if err != nil {
        return nil, err
    }
Severity: Major
Found in api/rest.go and 2 other locations - About 3 hrs to fix
api/rest.go on lines 3827..3858
api/rest.go on lines 4355..4386

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

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 handleConventions(db *sql.DB) error {
    records, err := utils.ReadCSV(CONVENTIONS_FILE)
    if err != nil {
        return errors.Wrap(err, "Read conventions")
    }
Severity: Major
Found in importer/conventions/conventions.go and 2 other locations - About 3 hrs to fix
importer/sources/sources.go on lines 67..102
importer/tvshows/tvshows.go on lines 62..97

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

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 handleTVShows(db *sql.DB) error {
    records, err := utils.ReadCSV(TV_SHOWS_FILE)
    if err != nil {
        return errors.Wrap(err, "Read tv shows")
    }
Severity: Major
Found in importer/tvshows/tvshows.go and 2 other locations - About 3 hrs to fix
importer/conventions/conventions.go on lines 58..93
importer/sources/sources.go on lines 67..102

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

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 handleAuthors(db *sql.DB) error {
    records, err := utils.ReadCSV(AUTHORS_FILE)
    if err != nil {
        return errors.Wrap(err, "Read authors")
    }
Severity: Major
Found in importer/sources/sources.go and 2 other locations - About 3 hrs to fix
importer/conventions/conventions.go on lines 58..93
importer/tvshows/tvshows.go on lines 62..97

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

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

func (o *Language) SetLangFileAssets(exec boil.Executor, insert bool, related ...*FileAsset) error {
    query := "update \"file_assets\" set \"lang_id\" = null where \"lang_id\" = $1"
    values := []interface{}{o.Code3}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/languages.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *VirtualLesson) SetContainers(exec boil.Executor, insert bool, related ...*Container) error {
    query := "update \"containers\" set \"virtual_lesson_id\" = null where \"virtual_lesson_id\" = $1"
    values := []interface{}{o.ID}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/virtual_lessons.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880

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

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

func (o *Server) SetServernameFileAssets(exec boil.Executor, insert bool, related ...*FileAsset) error {
    query := "update \"file_assets\" set \"servername_id\" = null where \"servername_id\" = $1"
    values := []interface{}{o.Servername}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/servers.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *Catalog) SetParentCatalogs(exec boil.Executor, insert bool, related ...*Catalog) error {
    query := "update \"catalogs\" set \"parent_id\" = null where \"parent_id\" = $1"
    values := []interface{}{o.ID}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/catalogs.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *User) SetCatalogs(exec boil.Executor, insert bool, related ...*Catalog) error {
    query := "update \"catalogs\" set \"user_id\" = null where \"user_id\" = $1"
    values := []interface{}{o.ID}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/users.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *User) SetFileAssets(exec boil.Executor, insert bool, related ...*FileAsset) error {
    query := "update \"file_assets\" set \"user_id\" = null where \"user_id\" = $1"
    values := []interface{}{o.ID}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/users.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *ContentType) SetContainers(exec boil.Executor, insert bool, related ...*Container) error {
    query := "update \"containers\" set \"content_type_id\" = null where \"content_type_id\" = $1"
    values := []interface{}{o.ID}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/content_types.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *Language) SetLangContainers(exec boil.Executor, insert bool, related ...*Container) error {
    query := "update \"containers\" set \"lang_id\" = null where \"lang_id\" = $1"
    values := []interface{}{o.Code3}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/languages.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *Language) SetLangCatalogDescriptions(exec boil.Executor, insert bool, related ...*CatalogDescription) error {
    query := "update \"catalog_descriptions\" set \"lang_id\" = null where \"lang_id\" = $1"
    values := []interface{}{o.Code3}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/languages.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 907..933
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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

func (o *Language) SetLangContainerDescriptions(exec boil.Executor, insert bool, related ...*ContainerDescription) error {
    query := "update \"container_descriptions\" set \"lang_id\" = null where \"lang_id\" = $1"
    values := []interface{}{o.Code3}
    if boil.DebugMode {
        fmt.Fprintln(boil.DebugWriter, query)
Severity: Major
Found in importer/kmedia/kmodels/languages.go and 9 other locations - About 3 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1285..1311
importer/kmedia/kmodels/content_types.go on lines 410..436
importer/kmedia/kmodels/languages.go on lines 686..712
importer/kmedia/kmodels/languages.go on lines 1128..1154
importer/kmedia/kmodels/languages.go on lines 1349..1375
importer/kmedia/kmodels/servers.go on lines 419..445
importer/kmedia/kmodels/users.go on lines 633..659
importer/kmedia/kmodels/users.go on lines 854..880
importer/kmedia/kmodels/virtual_lessons.go on lines 413..439

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

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 CreateContentUnit(exec boil.Executor, contentType string, properties map[string]interface{}) (*models.ContentUnit, error) {
    ct, ok := common.CONTENT_TYPE_REGISTRY.ByName[contentType]
    if !ok {
        return nil, errors.Errorf("Unknown content type %s", contentType)
    }
Severity: Major
Found in api/repo.go and 1 other location - About 3 hrs to fix
api/repo.go on lines 200..230

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

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 CreateCollection(exec boil.Executor, contentType string, properties map[string]interface{}) (*models.Collection, error) {
    ct, ok := common.CONTENT_TYPE_REGISTRY.ByName[contentType]
    if !ok {
        return nil, errors.Errorf("Unknown content type %s", contentType)
    }
Severity: Major
Found in api/repo.go and 1 other location - About 3 hrs to fix
api/repo.go on lines 282..312

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

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 ContentUnitI18nHandler(c *gin.Context) {
    id, e := strconv.ParseInt(c.Param("id"), 10, 0)
    if e != nil {
        NewBadRequestError(errors.Wrap(e, "id expects int64")).Abort(c)
        return
Severity: Major
Found in api/rest.go and 2 other locations - About 3 hrs to fix
api/rest.go on lines 126..153
api/rest.go on lines 1533..1560

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

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

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

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

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

Refactorings

Further Reading

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

    if len(metadata.Sources) > 0 {
        log.Infof("Associating %d sources", len(metadata.Sources))
        sources, err := models.Sources(
            qm.WhereIn("uid in ?", utils.ConvertArgsString(metadata.Sources)...)).
            All(exec)
Severity: Major
Found in api/metadata_processor.go and 1 other location - About 3 hrs to fix
api/metadata_processor.go on lines 255..285

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

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

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

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

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

Refactorings

Further Reading

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

    if len(metadata.Tags) > 0 {
        log.Infof("Associating %d tags", len(metadata.Tags))
        tags, err := models.Tags(
            qm.WhereIn("uid in ?", utils.ConvertArgsString(metadata.Tags)...)).
            All(exec)
Severity: Major
Found in api/metadata_processor.go and 1 other location - About 3 hrs to fix
api/metadata_processor.go on lines 222..253

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

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 CollectionI18nHandler(c *gin.Context) {
    id, e := strconv.ParseInt(c.Param("id"), 10, 0)
    if e != nil {
        NewBadRequestError(errors.Wrap(e, "id expects int64")).Abort(c)
        return
Severity: Major
Found in api/rest.go and 2 other locations - About 3 hrs to fix
api/rest.go on lines 351..378
api/rest.go on lines 1533..1560

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

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