yasshi2525/RushHour

View on GitHub

Showing 224 of 224 total issues

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

  protected calcDestination() {
    return this.selected !== undefined
      ? this.toView(this.selected.get("pos"))
      : this.toView(this.toServer(this.props.client));
  }
Severity: Major
Found in client/src/models/destroy.ts and 1 other location - About 1 hr to fix
client/src/models/cursor.ts on lines 73..77

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

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

Function setCenter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected setCenter(x: number, y: number) {
    let short = Math.min(this.renderer.width, this.renderer.height);
    let long = Math.max(this.renderer.width, this.renderer.height);
    let shortRadius = Math.pow(
      2,
Severity: Minor
Found in client/src/models/index.ts - About 1 hr to fix

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

    const defaultValues: {
      menu: MenuStatus;
      client: Point;
      activation: boolean;
    } = {
    Severity: Major
    Found in client/src/models/cursor.ts and 1 other location - About 1 hr to fix
    client/src/models/destroy.ts on lines 11..19

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

    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

    const defaultOpts: {
      menu: MenuStatus;
      client: Point;
      enabled: boolean;
    } = {
    Severity: Major
    Found in client/src/models/destroy.ts and 1 other location - About 1 hr to fix
    client/src/models/cursor.ts on lines 17..25

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

    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

              ? {
                  x: this.props.client.x / this.model.renderer.resolution,
                  y: this.props.client.y / this.model.renderer.resolution
                }
    Severity: Major
    Found in client/src/models/cursor.ts and 1 other location - About 1 hr to fix
    client/src/models/rail.ts on lines 258..261

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

    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

          let d = {
            x: this.to.current.x - this.from.current.x,
            y: this.to.current.y - this.from.current.y
          };
    Severity: Major
    Found in client/src/models/rail.ts and 1 other location - About 1 hr to fix
    client/src/models/cursor.ts on lines 159..162

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

    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

    Function useDrag has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useDrag = () => {
      const model = useContext(ModelContext);
      const reload = useReload();
      const [pressed, setPressed] = useState(false);
      const [start, setStart] = useState(ZERO);
    Severity: Minor
    Found in client/src/common/scroll.ts - About 1 hr 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

    Function useSwipe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useSwipe = () => {
      const model = useContext(ModelContext);
      const reload = useReload();
      const [pressed, setPressed] = useState(false);
      const [start, setStart] = useState(ZERO);
    Severity: Minor
    Found in client/src/common/scroll.ts - About 1 hr 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

    Function useCursor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useCursor = () => {
      const model = useContext(ModelContext);
      const [count, setCount] = useState(0);
      const [client, setClient] = useState<Point>();
      const [pressed, setPressed] = useState(false);
    Severity: Minor
    Found in client/src/common/cursor.ts - About 1 hr 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

    Function CustomName has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const CustomName = () => {
        if (settings === undefined) {
          return null;
        }
        return (
    Severity: Minor
    Found in client/src/components/UserSettings.tsx - About 1 hr to fix

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

          this.addUpdateCallback("coord", () => {
            this.merge("pos", this.toServer(this.props.client));
            this.selectObject();
            this.updateDestination();
          });
      Severity: Major
      Found in client/src/models/cursor.ts and 1 other location - About 1 hr to fix
      client/src/models/destroy.ts on lines 49..53

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

      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 class ResidenceContainer
        extends AnimatedSpriteContainer<Residence, AnimatedSpriteProperty>
        implements MonitorContainer {
        constructor(options: AnimatedSpriteContainerProperty) {
          super(options, Residence);
      Severity: Major
      Found in client/src/models/background.ts and 2 other locations - About 1 hr to fix
      client/src/models/background.ts on lines 44..54
      client/src/models/station.ts on lines 19..28

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

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

          this.addUpdateCallback("coord", () => {
            this.merge("pos", this.toServer(this.props.client));
            this.selectObject();
            this.updateDestination();
          });
      Severity: Major
      Found in client/src/models/destroy.ts and 1 other location - About 1 hr to fix
      client/src/models/cursor.ts on lines 66..70

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

      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 class CompanyContainer
        extends AnimatedSpriteContainer<Company, AnimatedSpriteProperty>
        implements MonitorContainer {
        constructor(options: AnimatedSpriteContainerProperty) {
          super(options, Company);
      Severity: Major
      Found in client/src/models/background.ts and 2 other locations - About 1 hr to fix
      client/src/models/background.ts on lines 22..32
      client/src/models/station.ts on lines 19..28

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

      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 class StationContainer extends SpriteContainer<Station, SpriteProperty>
        implements MonitorContainer {
        constructor(options: SpriteContainerProperty) {
          super(options, Station);
        }
      Severity: Major
      Found in client/src/models/station.ts and 2 other locations - About 1 hr to fix
      client/src/models/background.ts on lines 22..32
      client/src/models/background.ts on lines 44..54

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

      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

      Function useCounter has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useCounter = (
        pixi: PIXI.Application,
        fn: Counter,
        interval: number,
        repeat: boolean = false
      Severity: Minor
      Found in client/src/common/utils/tick.ts - About 1 hr to fix

        Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          init() {
            let textures = this.model.app.loader.resources;
            let base = {
              model: this.model,
              app: this.model.app
        Severity: Minor
        Found in client/src/models/map.ts - About 1 hr to fix

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

            forEachChild(func: (c: T) => any) {
              Object.keys(this.children).forEach(id => func(this.children[id]));
            }
          Severity: Major
          Found in client/src/models/container.ts and 2 other locations - About 1 hr to fix
          client/src/models/group.ts on lines 85..87
          client/src/models/group.ts on lines 89..91

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

          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

            const isCanceled = <I>(obj: ResultType<I, O>): obj is CancelResult<I> =>
              "error" in obj && isCancelError(obj.error);
          Severity: Major
          Found in client/src/common/utils/task_multi.ts and 1 other location - About 1 hr to fix
          client/src/common/utils/task_multi.ts on lines 74..75

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

          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

            protected forEachObject(fn: (v: Monitorable) => any) {
              Object.keys(this.objects).forEach(key => fn(this.objects[key]));
            }
          Severity: Major
          Found in client/src/models/group.ts and 2 other locations - About 1 hr to fix
          client/src/models/container.ts on lines 139..141
          client/src/models/group.ts on lines 85..87

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

          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