yasshi2525/RushHour

View on GitHub

Showing 80 of 224 total issues

Function useMap has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useMap = (): Handler => {
  const [{ min_scale, max_scale }] = useContext(ConfigContext);
  const [coordX, coordY, coordS] = useContext(CoordContext);
  const delegate = useContext(DelegateContext);

Severity: Minor
Found in client/src/common/map.tsx - About 1 hr to fix

    Function setupUpdateCallback has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setupUpdateCallback() {
        super.setupUpdateCallback();
        if (this.cursor === undefined) {
          return;
        }
    Severity: Minor
    Found in client/src/models/rail.ts - About 1 hr to fix

      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

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

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

                Function updateDisplayInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  updateDisplayInfo() {
                    if (
                      this.from !== undefined &&
                      this.to !== undefined &&
                      this.from.current !== undefined &&
                Severity: Minor
                Found in client/src/models/rail.ts - About 1 hr to fix

                  Function resolve has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    resolve(error: ResolveError) {
                      let resourceName = this.getResourceName();
                      if (resourceName !== undefined) {
                        let parent = this.model.gamemap.get(resourceName, this.props.pid) as
                          | PointModel
                  Severity: Minor
                  Found in client/src/models/zoom.ts - About 55 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

                  Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const validate = (
                    x: number,
                    y: number,
                    s: number,
                    xScale: number,
                  Severity: Minor
                  Found in client/src/common/coord.tsx - About 55 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

                  Avoid deeply nested control flow statements.
                  Open

                              if re, err := services.ConnectRailNode(o, from.(*entities.RailNode), to.(*entities.RailNode), sc.Scale); err != nil {
                                  c.Set(keyErr, err)
                              } else {
                                  c.Set(keyOk, &connectResponse{re, re.Reverse})
                              }
                  Severity: Major
                  Found in controllers/v1/rail.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if rn != to {
                                            var connected bool
                                            for _, e := range rn.OutEdges {
                                                if e.ToNode == to {
                                                    connected = true
                    Severity: Major
                    Found in services/model.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    if (!cursor) {
                                      extend(server.x, server.y, anchor.get("cid"));
                                    } else {
                                      if (model.controllers.getCursor().get("mul") === 1) {
                                        connect(anchor.get("cid"), cursor.get("cid"));
                      Severity: Major
                      Found in client/src/common/cursor.ts - About 45 mins to fix

                        Method Auther.GetGoogleOAuthInfo has 7 return statements (exceeds 4 allowed).
                        Open

                        func (a *Auther) GetGoogleOAuthInfo(resState string, code string) (*OAuthInfo, error) {
                            if resState != a.state {
                                return nil, fmt.Errorf("invalid state")
                            }
                            ctx := context.Background()
                        Severity: Major
                        Found in auth/google.go - About 45 mins to fix

                          Function hueToRgb has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function hueToRgb(H: number) {
                            let S = config.hsv.saturation;
                            let V = config.hsv.value;
                            let C = V * S;
                            let Hp = H / 60;
                          Severity: Minor
                          Found in client/src/interfaces/gamemap.ts - About 45 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