Showing 65 of 108 total issues

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

func (s *Server) MarkDeleteCategory(c echo.Context, categoryId autogen.UUID) error {
    admin, err := MustGetAdmin(c)
    if err != nil {
        return nil
    }
Severity: Major
Found in backend/api/categories.go and 1 other location - About 3 hrs to fix
backend/api/items.go on lines 76..100

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

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

export const open_door = (card_id: string, password: string) => {
    const data = {
        card_id: card_id,
        card_pin: password
    };
Severity: Major
Found in frontend/src/lib/local/local.ts and 2 other locations - About 2 hrs to fix
frontend/src/lib/local/local.ts on lines 18..30
frontend/src/lib/local/local.ts on lines 32..44

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

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

export const open_caisse = (card_id: string, password: string) => {
    const data = {
        card_id: card_id,
        card_pin: password
    };
Severity: Major
Found in frontend/src/lib/local/local.ts and 2 other locations - About 2 hrs to fix
frontend/src/lib/local/local.ts on lines 4..16
frontend/src/lib/local/local.ts on lines 32..44

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

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

export const open_ventilo = (card_id: string, password: string) => {
    const data = {
        card_id: card_id,
        card_pin: password
    };
Severity: Major
Found in frontend/src/lib/local/local.ts and 2 other locations - About 2 hrs to fix
frontend/src/lib/local/local.ts on lines 4..16
frontend/src/lib/local/local.ts on lines 18..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 88.

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 (s *Server) RestoreDeletedItem(c echo.Context, itemId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) DeleteTransaction(c echo.Context, transactionId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 648..669

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

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 (s *Server) DeleteAccount(c echo.Context, accountId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) RestoreDeletedCarouselImage(c echo.Context, imageId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) DeleteRefill(c echo.Context, refillId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) RestoreDeletedAccount(c echo.Context, accountId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) RestoreDeletedRefill(c echo.Context, refillId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) DeleteCarouselText(c echo.Context, textId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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 (s *Server) RestoreDeletedTransaction(c echo.Context, transactionId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 369..390
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645

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

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 (s *Server) RestoreDeletedCategory(c echo.Context, categoryId autogen.UUID) error {
    // Get admin account from cookie
    account, err := MustGetAdmin(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/deleted.go and 9 other locations - About 2 hrs to fix
backend/api/deleted.go on lines 60..82
backend/api/deleted.go on lines 85..106
backend/api/deleted.go on lines 182..203
backend/api/deleted.go on lines 248..270
backend/api/deleted.go on lines 466..487
backend/api/deleted.go on lines 532..554
backend/api/deleted.go on lines 557..578
backend/api/deleted.go on lines 623..645
backend/api/deleted.go on lines 648..669

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

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

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

    if state != "" {
        filter["state"] = state
        if state == string(autogen.ItemBuyable) {
            t := time.Since(time.Now().Truncate(24 * time.Hour)).Seconds()
            filter["$and"] = []bson.M{
Severity: Major
Found in backend/internal/db/mongo/item_misc.go and 3 other locations - About 1 hr to fix
backend/internal/db/mongo/item_misc.go on lines 32..65
backend/internal/db/mongo/item_misc.go on lines 128..161
backend/internal/db/mongo/item_misc.go on lines 200..231

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

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

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

    if state != "" {
        filter["state"] = state
        if state == string(autogen.ItemBuyable) {
            // Get seconds since day start
            t := time.Since(time.Now().Truncate(24 * time.Hour)).Seconds()
Severity: Major
Found in backend/internal/db/mongo/item_misc.go and 3 other locations - About 1 hr to fix
backend/internal/db/mongo/item_misc.go on lines 128..161
backend/internal/db/mongo/item_misc.go on lines 200..231
backend/internal/db/mongo/item_misc.go on lines 289..320

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

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

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

    if state != "" {
        filter["state"] = state
        if state == string(autogen.ItemBuyable) {
            t := time.Since(time.Now().Truncate(24 * time.Hour)).Seconds()
            filter["$and"] = []bson.M{
Severity: Major
Found in backend/internal/db/mongo/item_misc.go and 3 other locations - About 1 hr to fix
backend/internal/db/mongo/item_misc.go on lines 32..65
backend/internal/db/mongo/item_misc.go on lines 128..161
backend/internal/db/mongo/item_misc.go on lines 289..320

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

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

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

    if state != "" {
        filter["state"] = state
        if state == string(autogen.ItemBuyable) {
            // Get seconds since day start
            t := time.Since(time.Now().Truncate(24 * time.Hour)).Seconds()
Severity: Major
Found in backend/internal/db/mongo/item_misc.go and 3 other locations - About 1 hr to fix
backend/internal/db/mongo/item_misc.go on lines 32..65
backend/internal/db/mongo/item_misc.go on lines 200..231
backend/internal/db/mongo/item_misc.go on lines 289..320

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

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

            } else if item.Prices.Coutant >= 130 && item.Prices.Coutant < 300 {
                item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant*14/10, 5)
                item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*11/10, 5)
                item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*108/100, 5)
                item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant*11/10, 5)
Severity: Major
Found in backend/api/restock.go and 2 other locations - About 1 hr to fix
backend/api/restock.go on lines 115..133
backend/api/restock.go on lines 127..133

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

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

            } else if item.Prices.Coutant >= 300 {
                item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant*125/100, 5)
                item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*11/10, 5)
                item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*105/100, 5)
                item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant*11/10, 5)
Severity: Major
Found in backend/api/restock.go and 2 other locations - About 1 hr to fix
backend/api/restock.go on lines 115..133
backend/api/restock.go on lines 121..133

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

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