hexlet-codebattle/codebattle

View on GitHub

Showing 200 of 693 total issues

Function StageCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function StageCard({
  type,
  playerId,
  opponentId,
  stage,

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

const TaskConfigurationModal = NiceModal.create(() => {
  const dispatch = useDispatch();

  const visibilityInputRef = useRef(null);

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 too many return statements within this function.
Open

      return !isArray(value)
        && isObject(value)
        && !Object.keys(value).some(item => item.length === 0)
        && !Object.values(value).some(item => !isValidValueToSignature(item, signature.nested));

    Avoid too many return statements within this function.
    Open

          return [false, 'Not valid expected'];

      Avoid too many return statements within this function.
      Open

          return gameStatuses[gameStateName];

        Avoid too many return statements within this function.
        Open

                return 'Round 3';

          Avoid too many return statements within this function.
          Open

                return isBoolean(value);

            Avoid too many return statements within this function.
            Open

                    return [false, 'Doesn\'t match with signature'];

              Avoid too many return statements within this function.
              Open

                  return { ...acc, chat: newChatState, records: [...records, newRecord] };
              Severity: Major
              Found in services/app/apps/codebattle/assets/js/widgets/lib/player.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return (
                      <>
                        <FontAwesomeIcon icon="users" />
                        vs
                        <FontAwesomeIcon icon="users" />

                  Avoid too many return statements within this function.
                  Open

                    return <GameRoomTimer timeoutSeconds={timeoutSeconds} time={time} />;

                    Avoid too many return statements within this function.
                    Open

                        return 'Task Testing';

                      Avoid too many return statements within this function.
                      Open

                        return { state: 'online' };
                      Severity: Major
                      Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Main.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return { ...acc, players: newPlayers, records: [...records, newRecord] };
                        Severity: Major
                        Found in services/app/apps/codebattle/assets/js/widgets/lib/player.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return 'Round 1';

                            Avoid too many return statements within this function.
                            Open

                                return (
                                  <FontAwesomeIcon icon="wine-bottle" />
                                );

                              Avoid too many return statements within this function.
                              Open

                                    return 'Task Is Invalid';

                                Avoid too many return statements within this function.
                                Open

                                    return 'Task Builder';

                                  Avoid too many return statements within this function.
                                  Open

                                        return isArray(value) && !value.some(item => !isValidValueToSignature(item, signature.nested));

                                    Avoid too many return statements within this function.
                                    Open

                                          return null;
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language