hexlet-codebattle/codebattle

View on GitHub

Showing 188 of 670 total issues

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

const TournamentStatisticsModal = NiceModal.create(() => {
  const modal = useModal(ModalCodes.tournamentStatisticsModal);

  const gameId = useSelector(gameIdSelector);
  const tournament = useSelector(tournamentSelector);

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

const TournamentMainControlButtons = ({
  accessType,
  tournamentId,
  canStart,
  canStartRound,

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

function BuilderExampleForm() {
  const dispatch = useDispatch();
  const { taskService } = useContext(RoomContext);

  const argumentsTabRef = 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

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

function BuilderEditorsWidget() {
  const dispatch = useDispatch();
  const { taskService } = useContext(RoomContext);

  const [assertsPanelShowing, setAssertsPanelShowing] = useState(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 TournamentType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function TournamentType({ type }) {
  if (type === TournamentTypeCodes.versus) {
    return 'Versus';
  }

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

export default function EmojiTooltip({ colons, handleSelect, hide }) {
  const [activeIndex, setActiveIndex] = useState(0);
  const [emojis, setEmojis] = useState([]);

  const increaseIndex = () => {

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

const OutputTab = ({ sideOutput, large = false }) => {
  const { successCount, assertsCount, status } = sideOutput;
  const isShowMessage = status === 'failure';
  const statusColor = color[status];
  const message = getMessage(status);
Severity: Minor
Found in services/app/apps/codebattle/assets/js/widgets/pages/game/OutputTab.jsx - About 35 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 ChatWidget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function ChatWidget() {
  const { mainService } = useContext(RoomContext);

  const users = useSelector(selectors.chatUsersSelector);
  const messages = useSelector(selectors.chatMessagesSelector);
Severity: Minor
Found in services/app/apps/codebattle/assets/js/widgets/pages/game/ChatWidget.jsx - About 35 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 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 initTournamentChannel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const initTournamentChannel = waitingRoomMachine => dispatch => {
  const onJoinFailure = () => {
    window.location.reload();
  };

Severity: Minor
Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Tournament.js - About 35 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 addCursorListeners has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const addCursorListeners = (id, onChangePosition, onChangeSelection) => {
  if (!id) {
    return () => { };
  }

Severity: Minor
Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 35 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 editorDataSelector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const editorDataSelector = (playerId, roomMachineState) => state => {
  const meta = editorsMetaSelector(state)[playerId];
  const editorTexts = editorTextsSelector(state);
  const editorTextsHistory = editorTextsHistorySelector(state);

Severity: Minor
Found in services/app/apps/codebattle/assets/js/widgets/selectors/index.js - About 35 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 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 [true];

    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 { ...acc, 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 isArray(value) && !value.some(item => !isValidValueToSignature(item, signature.nested));

            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 'Round 1';
                Severity
                Category
                Status
                Source
                Language