yasshi2525/RushHour

View on GitHub

Showing 224 of 224 total issues

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

export type SyncHandlers<S, C> = [
  Context<C>,
  S,
  (v: S) => void,
  Errors | undefined,
Severity: Minor
Found in client/src/common/utils/provider_sync.tsx and 1 other location - About 35 mins to fix
client/src/common/utils/provider_async.tsx on lines 16..22

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

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

type Handlers<I, S, C> = [
  Context<C>,
  S,
  (args: I) => void,
  Errors | undefined,
Severity: Minor
Found in client/src/common/utils/provider_async.tsx and 1 other location - About 35 mins to fix
client/src/common/utils/provider_sync.tsx on lines 14..20

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

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 (c *Company) Resolve(args ...Entity) {
    for _, raw := range args {
        switch obj := raw.(type) {
        case *Human:
            c.Targets[obj.ID] = obj
Severity: Minor
Found in entities/company.go and 1 other location - About 35 mins to fix
entities/residence.go on lines 86..96

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

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 scanRailLine(l *entities.RailLine) *Model {
    model := NewModel()

    // gen goalid
    for _, p := range l.Stops {
Severity: Minor
Found in route/rail_line.go and 1 other location - About 35 mins to fix
route/rail.go on lines 33..45

Duplicated Code

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

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

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

Tuning

This issue has a mass of 105.

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 scanRail(o *entities.Player) *Model {
    model := NewModel()
    for _, rn := range o.RailNodes {
        model.AddGoalID(rn.ID)
        model.FindOrCreateNode(rn)
Severity: Minor
Found in route/rail.go and 1 other location - About 35 mins to fix
route/rail_line.go on lines 34..48

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

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

Method Auther.GetTwitterOAuthInfo has 5 return statements (exceeds 4 allowed).
Open

func (a *Auther) GetTwitterOAuthInfo(tmpCred *oauth.Credentials, tmpSecret string) (*OAuthInfo, error) {
    cred, values, err := twitterClient.RequestToken(&http.Client{}, tmpCred, tmpSecret)
    if err != nil {
        return nil, err
    }
Severity: Major
Found in auth/twitter.go - About 35 mins to fix

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

    func (r *Residence) Resolve(args ...Entity) {
        for _, raw := range args {
            switch obj := raw.(type) {
            case *Human:
                r.Targets[obj.ID] = obj
    Severity: Minor
    Found in entities/residence.go and 1 other location - About 35 mins to fix
    entities/company.go on lines 83..93

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

    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

      protected getBasicChildOptions(): PIXIProperty {
        return {
          ...super.getBasicChildOptions(),
          app: this.app,
          zIndex: this.zIndex
    Severity: Minor
    Found in client/src/models/pixi.ts and 1 other location - About 35 mins to fix
    client/src/models/sprite.ts on lines 142..148

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

    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

      protected getBasicChildOptions(): AnimatedSpriteProperty {
        return {
          ...super.getBasicChildOptions(),
          animation: this.animation,
          offset: this.offset
    Severity: Minor
    Found in client/src/models/sprite.ts and 1 other location - About 35 mins to fix
    client/src/models/pixi.ts on lines 207..213

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

    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

          onTouchMove={e => {
            cursor.onTouchMove(e);
            swipe.onTouchMove(e);
            pinch.onTouchMove(e);
          }}
    Severity: Minor
    Found in client/src/components/Canvas.tsx and 2 other locations - About 35 mins to fix
    client/src/components/Canvas.tsx on lines 64..68
    client/src/components/Canvas.tsx on lines 74..78

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

    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

          onTouchEnd={e => {
            cursor.onTouchEnd(e);
            swipe.onTouchEnd(e);
            pinch.onTouchEnd(e);
          }}
    Severity: Minor
    Found in client/src/components/Canvas.tsx and 2 other locations - About 35 mins to fix
    client/src/components/Canvas.tsx on lines 64..68
    client/src/components/Canvas.tsx on lines 69..73

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

    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

          onTouchStart={e => {
            cursor.onTouchStart(e);
            swipe.onTouchStart(e);
            pinch.onTouchStart(e);
          }}
    Severity: Minor
    Found in client/src/components/Canvas.tsx and 2 other locations - About 35 mins to fix
    client/src/components/Canvas.tsx on lines 69..73
    client/src/components/Canvas.tsx on lines 74..78

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

    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

    Avoid too many return statements within this function.
    Open

          return Object.assign({}, state, inOperation);
    Severity: Major
    Found in client/src/reducers/index.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return Object.assign({}, state, { inPurge });
      Severity: Major
      Found in client/src/reducers/index.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return Object.assign({}, state, { inPurge });
        Severity: Major
        Found in client/src/reducers/index.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return Object.assign({}, state, { inOperation });
          Severity: Major
          Found in client/src/reducers/index.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return Object.assign({}, state, { inOperation });
            Severity: Major
            Found in client/src/reducers/index.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return Object.assign({}, state, { players });
              Severity: Major
              Found in client/src/reducers/index.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return Object.assign({}, state, { players });
                Severity: Major
                Found in client/src/reducers/index.ts - About 30 mins to fix

                  Function useMultiTask has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const useMultiTask = <I, O>(
                    task: Task<I, O>,
                    handlers?: MultiTaskHandler<I, O>
                  ): Handlers<I> => {
                    const [, maintain] = useContext(OperationContext);
                  Severity: Minor
                  Found in client/src/common/utils/task_multi.ts - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language