hexlet-codebattle/codebattle

View on GitHub

Showing 187 of 662 total issues

Avoid too many return statements within this function.
Open

        return 'Round 2';

    Avoid too many return statements within this function.
    Open

            return 'Round 4';

      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 (
              <>
                <FontAwesomeIcon icon="user" />
                <FontAwesomeIcon icon="sort-amount-up" />
              </>

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

              Avoid too many return statements within this function.
              Open

                  return [true, ''];

                Avoid too many return statements within this function.
                Open

                      return [false, 'Name must be unig'];

                  Avoid too many return statements within this function.
                  Open

                        return [false, 'Only lowercase latin'];

                    Function SubMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function SubMenu({
                      children,
                      statusColor,
                      assert,
                      hasOutput,

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

                    const useChatContextMenu = ({
                      type,
                      users,
                      canInvite = false,
                    }) => {

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

                    function InfoPanel({
                      currentUserId, tournament, playersCount, hideResults,
                    }) {
                      if (
                        tournament.state === TournamentStates.waitingParticipants

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

                    const calcRoundResult = matches => matches.reduce(
                        (acc, match) => {
                          const [gameResultPlayer1, gameResultPlayer2] = match.playerIds.map(
                            id => match.playerResults[id]?.result || 0,
                          );

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

                    const JoinButton = ({
                     isShow, isParticipant, title, teamId, disabled = false, isShowLeave = true,
                    }) => {
                      const onClick = isParticipant ? leaveTournament : joinTournament;
                      const text = isParticipant ? i18next.t('Leave') : i18next.t('Join');

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

                    const createKeyPredicate = keyFilter => (typeof keyFilter === 'function'
                        ? keyFilter
                        : typeof keyFilter === 'string'
                            ? event => event.key === keyFilter
                            : keyFilter
                    Severity: Minor
                    Found in services/app/apps/codebattle/assets/js/widgets/utils/useKey.js - About 25 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 reloadGeneratorAndSolutionTemplates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const reloadGeneratorAndSolutionTemplates = taskMachine => (dispatch, getState) => {
                      const state = getState();
                    
                      const langs = selectors.editorLangsSelector(state);
                    
                    
                    Severity: Minor
                    Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 25 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 InfoPanel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function InfoPanel({
                      currentUserId,
                      tournament,
                      playersCount,
                      hideResults,

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

                    function TournamentStateDescription({
                      state,
                      startsAt,
                      breakState,
                      breakDurationSeconds,

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

                    const getUserStateByPath = () => {
                      const { pathname } = document.location;
                    
                      if (pathname.startsWith('/tournament')) {
                        return ({ state: 'tournament' });
                    Severity: Minor
                    Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Main.js - About 25 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 UserStats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const UserStats = ({ data, user: userInfo }) => {
                      const avatarUrl = userInfo.avatarUrl || data?.user?.avatarUrl || '/assets/images/logo.svg';
                      const name = userInfo.name || data?.user?.name || 'Jon Doe';
                      const lang = userInfo.lang || data?.user?.lang || 'js';
                      return (
                    Severity: Minor
                    Found in services/app/apps/codebattle/assets/js/widgets/components/UserStats.jsx - About 25 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