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 PublisherHandler(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 5 hrs to fix
api/rest.go on lines 976..1017
api/rest.go on lines 1100..1141

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

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 TagHandler(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 5 hrs to fix
api/rest.go on lines 976..1017
api/rest.go on lines 1362..1403

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

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 (o *FileAsset) AddContainers(exec boil.Executor, insert bool, related ...*Container) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/file_assets.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/labels.go on lines 336..378

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

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 (o *Container) AddCatalogs(exec boil.Executor, insert bool, related ...*Catalog) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/containers.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/file_assets.go on lines 1142..1184
importer/kmedia/kmodels/labels.go on lines 336..378

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

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 (o *Container) AddFileAssets(exec boil.Executor, insert bool, related ...*FileAsset) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/containers.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/file_assets.go on lines 1142..1184
importer/kmedia/kmodels/labels.go on lines 336..378

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

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 (o *Catalog) AddContainerDescriptionPatterns(exec boil.Executor, insert bool, related ...*ContainerDescriptionPattern) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/catalogs.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/file_assets.go on lines 1142..1184
importer/kmedia/kmodels/labels.go on lines 336..378

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

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 (o *Container) AddLabels(exec boil.Executor, insert bool, related ...*Label) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/containers.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/file_assets.go on lines 1142..1184
importer/kmedia/kmodels/labels.go on lines 336..378

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

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 (o *ContainerDescriptionPattern) AddCatalogs(exec boil.Executor, insert bool, related ...*Catalog) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/container_description_patterns.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/file_assets.go on lines 1142..1184
importer/kmedia/kmodels/labels.go on lines 336..378

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

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 (o *Label) AddContainers(exec boil.Executor, insert bool, related ...*Container) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/labels.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/catalogs.go on lines 1648..1690
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/file_assets.go on lines 1142..1184

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

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 (o *Catalog) AddContainers(exec boil.Executor, insert bool, related ...*Container) error {
    var err error
    for _, rel := range related {
        if insert {
            if err = rel.Insert(exec); err != nil {
Severity: Major
Found in importer/kmedia/kmodels/catalogs.go and 7 other locations - About 5 hrs to fix
importer/kmedia/kmodels/catalogs.go on lines 1412..1454
importer/kmedia/kmodels/container_description_patterns.go on lines 342..384
importer/kmedia/kmodels/containers.go on lines 1372..1414
importer/kmedia/kmodels/containers.go on lines 1692..1734
importer/kmedia/kmodels/containers.go on lines 1928..1970
importer/kmedia/kmodels/file_assets.go on lines 1142..1184
importer/kmedia/kmodels/labels.go on lines 336..378

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

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

    for i := 0; i < 4; i++ {
        part := strconv.Itoa(i)
        op, evnts, err = handleTrim(suite.tx, TrimRequest{
            Operation: Operation{
                Station: "Trimmer station",
Severity: Major
Found in api/metadata_processor_test.go and 1 other location - About 4 hrs to fix
api/metadata_processor_test.go on lines 2506..2543

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

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

    for i := 0; i < 4; i++ {
        part := strconv.Itoa(i)
        op, evnts, err = handleTrim(suite.tx, TrimRequest{
            Operation: Operation{
                Station: "Trimmer station",
Severity: Major
Found in api/metadata_processor_test.go and 1 other location - About 4 hrs to fix
api/metadata_processor_test.go on lines 2546..2583

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

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

package dgima

import (
    "context"
    "database/sql"
Severity: Major
Found in importer/dgima/common.go and 3 other locations - About 4 hrs to fix
importer/cleanup/common.go on lines 1..51
importer/ffprobe/common.go on lines 1..51
importer/twitter/common.go on lines 1..51

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

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

package twitter

import (
    "context"
    "database/sql"
Severity: Major
Found in importer/twitter/common.go and 3 other locations - About 4 hrs to fix
importer/cleanup/common.go on lines 1..51
importer/dgima/common.go on lines 1..51
importer/ffprobe/common.go on lines 1..51

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

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

package ffprobe

import (
    "context"
    "database/sql"
Severity: Major
Found in importer/ffprobe/common.go and 3 other locations - About 4 hrs to fix
importer/cleanup/common.go on lines 1..51
importer/dgima/common.go on lines 1..51
importer/twitter/common.go on lines 1..51

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

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

package cleanup

import (
    "context"
    "database/sql"
Severity: Major
Found in importer/cleanup/common.go and 3 other locations - About 4 hrs to fix
importer/dgima/common.go on lines 1..51
importer/ffprobe/common.go on lines 1..51
importer/twitter/common.go on lines 1..51

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

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 handleContentUnitAddPublisher(cp utils.ContextProvider, exec boil.Executor, id int64, publisherID int64) (*models.ContentUnit, *HttpError) {
    cu, err := models.FindContentUnit(exec, id)
    if err != nil {
        if err == sql.ErrNoRows {
            return nil, NewNotFoundError()
Severity: Major
Found in api/rest.go and 2 other locations - About 4 hrs to fix
api/rest.go on lines 2849..2892
api/rest.go on lines 2959..3002

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

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 handleContentUnitAddSource(cp utils.ContextProvider, exec boil.Executor, id int64, sourceID int64) (*models.ContentUnit, *HttpError) {
    cu, err := models.FindContentUnit(exec, id)
    if err != nil {
        if err == sql.ErrNoRows {
            return nil, NewNotFoundError()
Severity: Major
Found in api/rest.go and 2 other locations - About 4 hrs to fix
api/rest.go on lines 2959..3002
api/rest.go on lines 3191..3234

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

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 handleContentUnitAddTag(cp utils.ContextProvider, exec boil.Executor, id int64, tagID int64) (*models.ContentUnit, *HttpError) {
    cu, err := models.FindContentUnit(exec, id)
    if err != nil {
        if err == sql.ErrNoRows {
            return nil, NewNotFoundError()
Severity: Major
Found in api/rest.go and 2 other locations - About 4 hrs to fix
api/rest.go on lines 2849..2892
api/rest.go on lines 3191..3234

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

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 handleGetContentUnitSources(cp utils.ContextProvider, exec boil.Executor, id int64) ([]*Source, *HttpError) {
    unit, err := models.ContentUnits(
        qm.Where("id = ?", id),
        qm.Load("Sources"),
        qm.Load("Sources.SourceI18ns")).
Severity: Major
Found in api/rest.go and 2 other locations - About 4 hrs to fix
api/rest.go on lines 2926..2957
api/rest.go on lines 3158..3189

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

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