yasshi2525/RushHour

View on GitHub

Showing 80 of 224 total issues

Function processMsg has a Cognitive Complexity of 81 (exceeds 20 allowed). Consider refactoring.
Open

func processMsg(msg *Operation) time.Time {
    MuModel.Lock()
    defer MuModel.Unlock()
    lock := time.Now()

Severity: Minor
Found in services/model.go - About 1 day 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 217 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function(props: Attributes) {
  const [opened, setOpened] = React.useState(false);
  const theme = useTheme();
  const classes = useStyles(theme);
  const isFullScreen = useMediaQuery(theme.breakpoints.down("sm"));
Severity: Major
Found in client/src/components/Register.tsx - About 1 day to fix

    Function default has 183 lines of code (exceeds 25 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: Major
    Found in client/src/components/Administrator.tsx - About 7 hrs to fix

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

      export default function() {
        const [opened, setOpened] = React.useState(false);
        const theme = useTheme();
        const classes = useStyles(theme);
        const isFullScreen = useMediaQuery(theme.breakpoints.down("sm"));
      Severity: Major
      Found in client/src/components/UserSettings.tsx - About 6 hrs to fix

        Function useCursor has 152 lines of code (exceeds 25 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: Major
        Found in client/src/common/cursor.ts - About 6 hrs to fix

          Function processMsg has 143 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func processMsg(msg *Operation) time.Time {
              MuModel.Lock()
              defer MuModel.Unlock()
              lock := time.Now()
          
          
          Severity: Major
          Found in services/model.go - About 4 hrs to fix

            Function CacheMap has 116 lines of code (exceeds 25 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: Major
            Found in client/src/components/CacheMap.tsx - About 4 hrs to fix

              Function useRail has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useRail = () => {
                const model = useContext(ModelContext);
                const [, reloadPlayers] = useContext(PlayerContext);
              
                const resolve = useCallback((err: ResolveError) => {
              Severity: Major
              Found in client/src/common/rail.ts - About 4 hrs to fix

                Function useFlash has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                Open

                const useFlash = <T>(
                  boundary: string[],
                  graceHandler: GraceHandler,
                  onPut: (k: string, v: T) => void = () => {},
                  onRemove: (k: string) => void = () => {},
                Severity: Minor
                Found in client/src/common/utils/flash.ts - About 3 hrs 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

                File rail.ts has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Monitorable, MonitorContainer } from "interfaces/monitor";
                import {
                  AnimatedSpriteProperty,
                  cursorOpts,
                  AnimatedSpriteContainerProperty
                Severity: Minor
                Found in client/src/models/rail.ts - About 3 hrs to fix

                  Human has 30 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type Human struct {
                      Base
                      Persistence
                      Point
                  
                  
                  Severity: Minor
                  Found in entities/human.go - About 3 hrs to fix

                    File border.ts has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { GraphicsModel, GraphicsContainer } from "./graphics";
                    import { Monitorable, MonitorContainer } from "interfaces/monitor";
                    import { BorderProperty, PIXIProperty } from "interfaces/pixi";
                    import {
                      config,
                    Severity: Minor
                    Found in client/src/models/border.ts - About 3 hrs to fix

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

                      export default function() {
                        const theme = useTheme();
                        const classes = useStyles(theme);
                        const [id, setUserID] = React.useState("");
                        const [password, setPassword] = React.useState("");
                      Severity: Major
                      Found in client/src/components/Password.tsx - About 3 hrs to fix

                        File Register.tsx has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import * as React from "react";
                        import { useDispatch, useSelector } from "react-redux";
                        import {
                          Button,
                          Theme,
                        Severity: Minor
                        Found in client/src/components/Register.tsx - About 3 hrs to fix

                          Function useMultiTask has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Function setCenter has a Cognitive Complexity of 22 (exceeds 5 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 3 hrs 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

                            `` has 26 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export default class implements Monitorable {
                              protected model: GameModel;
                              /**
                               * 監視対象プロパティ
                               */
                            Severity: Minor
                            Found in client/src/models/base.ts - About 3 hrs to fix

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

                              export default function() {
                                const classes = useStyles();
                                const [opened, setOpened] = React.useState(false);
                                const theme = useTheme();
                                const isFullScreen = useMediaQuery(theme.breakpoints.down("sm"));
                              Severity: Major
                              Found in client/src/components/SignIn.tsx - About 2 hrs to fix

                                Function default has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export default function() {
                                  const [opened, setOpened] = React.useState(false);
                                  const theme = useTheme();
                                  const classes = useStyles(theme);
                                  const isFullScreen = useMediaQuery(theme.breakpoints.down("sm"));
                                Severity: Minor
                                Found in client/src/components/UserSettings.tsx - About 2 hrs 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 useDrag has 68 lines of code (exceeds 25 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: Major
                                Found in client/src/common/scroll.ts - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language