yasshi2525/RushHour

View on GitHub

Showing 224 of 224 total issues

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

export function* generateEditSettings(
  action: ReturnType<typeof Action.editSettings.request>
) {
  return yield generateRequest(
    () => editSettings(action.payload),
Severity: Major
Found in client/src/sagas/player.ts and 3 other locations - About 1 hr to fix
client/src/sagas/player.ts on lines 78..86
client/src/sagas/player.ts on lines 88..96
client/src/sagas/player.ts on lines 98..106

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

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

export function* generateRegister(
  action: ReturnType<typeof Action.register.request>
) {
  return yield generateRequest(
    () => register(action.payload),
Severity: Major
Found in client/src/sagas/player.ts and 3 other locations - About 1 hr to fix
client/src/sagas/player.ts on lines 78..86
client/src/sagas/player.ts on lines 88..96
client/src/sagas/player.ts on lines 114..122

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

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

export default (props: ModelProperty) => (
  <ToggleButton {...props} on={MenuStatus.DESTROY}>
    <Avatar alt="destroy" src={destroyer} />
  </ToggleButton>
);
Severity: Major
Found in client/src/components/Destroyer.tsx and 1 other location - About 1 hr to fix
client/src/components/Rail.tsx on lines 12..16

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

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

    ["residence", "company", "rail_node", "rail_edge"]
      .map(key => ({ key, sheet: textures[key].spritesheet }))
      .forEach(
        entry =>
          (anim[entry.key] =
Severity: Major
Found in client/src/models/map.ts and 1 other location - About 1 hr to fix
client/src/models/controller.ts on lines 23..31

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

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

  coord: {
    cx: config.gamePos.default.x,
    cy: config.gamePos.default.y,
    scale: config.scale.default,
    zoom: 0
Severity: Major
Found in client/src/models/border.ts and 1 other location - About 1 hr to fix
client/src/models/pixi.ts on lines 9..14

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

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

export default (props: ModelProperty) => (
  <ToggleButton {...props} on={MenuStatus.SEEK_DEPARTURE}>
    <Avatar alt="rail" src={rail} />
  </ToggleButton>
);
Severity: Major
Found in client/src/components/Rail.tsx and 1 other location - About 1 hr to fix
client/src/components/Destroyer.tsx on lines 11..15

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

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 InitType has 53 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func InitType() {
    TypeList = []ModelType{
        PLAYER,
        RESIDENCE,
        COMPANY,
Severity: Minor
Found in entities/type.go - About 1 hr to fix

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

    async function register(opts: Action.RegisterRequest) {
      let json = await http(registerURL, Method.POST, opts);
      localStorage.setItem("jwt", json.jwt);
      return json;
    }
    Severity: Major
    Found in client/src/sagas/player.ts and 1 other location - About 1 hr to fix
    client/src/sagas/player.ts on lines 35..39

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

    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

          this.cursorOut = this.addChild({
            ...cursorOpts,
            oid: this.model.myid,
            id: -2,
            from: -1,
    Severity: Major
    Found in client/src/models/rail.ts and 1 other location - About 1 hr to fix
    client/src/models/rail.ts on lines 309..315

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

    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

          this.cursorIn = this.addChild({
            ...cursorOpts,
            oid: this.model.myid,
            id: -3,
            to: -1,
    Severity: Major
    Found in client/src/models/rail.ts and 1 other location - About 1 hr to fix
    client/src/models/rail.ts on lines 302..308

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

    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

    async function login(opts: Action.LoginRequest) {
      let json = await http(loginURL, Method.POST, opts);
      localStorage.setItem("jwt", json.jwt);
      return json;
    }
    Severity: Major
    Found in client/src/sagas/player.ts and 1 other location - About 1 hr to fix
    client/src/sagas/player.ts on lines 52..56

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

    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 activate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      protected activate(objOnChunk: Monitorable | undefined) {
        let activation = true;
        switch (this.props.menu) {
          case MenuStatus.EXTEND_RAIL:
            if (this.anchor.object === objOnChunk) {
    Severity: Minor
    Found in client/src/models/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 CacheMap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const CacheMap = () => {
      const theme = useTheme();
      const classes = useStyles(theme);
      const [{ min_scale, max_scale }] = useContext(ConfigContext);
      const [coordX, coordY, coordS, , , update] = useContext(CoordContext);
    Severity: Minor
    Found in client/src/components/CacheMap.tsx - 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 usePinch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const usePinch = () => {
      const model = useContext(ModelContext);
      const [pressed, setPressed] = useState(false);
      const [start, setStart] = useState(ZERO);
      const [now, setNow] = useState(ZERO);
    Severity: Minor
    Found in client/src/common/zoom.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 updateAnchor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      updateAnchor(force: boolean) {
        if (!force && this.object !== undefined) {
          return;
        }
    
    
    Severity: Minor
    Found in client/src/models/anchor.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 default has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function() {
      const theme = useTheme();
      const classes = useStyles(theme);
      const [opened, setOpened] = React.useState(false);
      const [confirmMessage, setConfirmMessage] = React.useState("");
    Severity: Minor
    Found in client/src/components/Administrator.tsx - 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 AsyncProvider has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const AsyncProvider = <E, I, O, S>(props: AsyncProperties<E, I, O, S>) => {
      const [context, initialFetch, endpoint, reloadTask, convert] = useAsyncStatus(
        props.ctx,
        props.initialFetch,
        props.endpoint,
    Severity: Minor
    Found in client/src/common/utils/provider_async.tsx - About 1 hr to fix

      Method LineTask.Resolve has 52 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (lt *LineTask) Resolve(args ...Entity) {
          for _, raw := range args {
              switch obj := raw.(type) {
              case *Player:
                  lt.O = obj
      Severity: Minor
      Found in entities/line_task.go - About 1 hr to fix

        Function useModel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const useModel = (my?: UserInfo | null) => {
          const [state, dispatch] = useReducer(reducer, {
            completed: false,
            error: null,
            model: new GameModel({
        Severity: Minor
        Found in client/src/common/model.tsx - About 1 hr to fix

          Function default has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function() {
            const theme = useTheme();
            const classes = useStyles(theme);
            const isTiny = useMediaQuery(theme.breakpoints.down("xs"));
            const [, update] = useContext(LoadingContext);
          Severity: Minor
          Found in client/src/components/AppBar.tsx - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language