mavend/octoboard

View on GitHub

Showing 9 of 44 total issues

Function Board has a Cognitive Complexity of 28 (exceeds 10 allowed). Consider refactoring.
Open

const Board = () => {
  const { G, ctx, moves, players, player, playerID } = useBoardGame();
  const [selectedCard, setSelectedCard] = useState(null);
  const [availableBonuses, setAvailableBonuses] = useState(null);
  const [loading, setLoading] = useState(null);
Severity: Minor
Found in src/games/splendid/Board/index.js - 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

Function Board has a Cognitive Complexity of 26 (exceeds 10 allowed). Consider refactoring.
Open

const Board = () => {
  const {
    G,
    ctx: { phase, gameover },
    players,
Severity: Minor
Found in src/games/kalambury/Board/index.js - 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 Board has 195 lines of code (exceeds 150 allowed). Consider refactoring.
Open

const Board = () => {
  const { G, ctx, moves, players, player, playerID } = useBoardGame();
  const [selectedCard, setSelectedCard] = useState(null);
  const [availableBonuses, setAvailableBonuses] = useState(null);
  const [loading, setLoading] = useState(null);
Severity: Major
Found in src/games/splendid/Board/index.js - About 2 hrs to fix

    Function TokensShop has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
    Open

    const TokensShop = ({ tokens, active, loading, onTakeTokens, playerTokensCount }) => {
      const [selected, setSelected] = useState({ ...emptyTokens });
    
      const tooMuchTokens = sum(Object.values(selected)) + playerTokensCount >= 10;
    
    
    Severity: Minor
    Found in src/games/splendid/Board/TokensShop.js - 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

    Consider simplifying this complex logical expression.
    Open

            if (user && user.displayName) {
              return <Redirect to={from || routes.lobby()} />;
            } else {
              return (
                <>
    Severity: Major
    Found in src/utils/router/NotLoggedInRoute.js - About 1 hr to fix

      Function StartGame has 7 arguments (exceeds 5 allowed). Consider refactoring.
      Open

      function StartGame(G, ctx, gameMode, maxPoints, language, category, timePerTurn) {
      Severity: Major
      Found in src/games/kalambury/Game.js - About 45 mins to fix

        Function leaveGame has 6 arguments (exceeds 5 allowed). Consider refactoring.
        Open

        function leaveGame(gameName, matchID, playerID, playerUID, credentials, history) {
        Severity: Minor
        Found in src/utils/game/leave.js - About 35 mins to fix

          Function DrawArea has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
          Open

          const DrawArea = ({ lines, onLinesUpdate }) => {
            const [isDrawing, setIsDrawing] = useState(false);
            const [penColor, setPenColor] = useState("#1b1c1d");
            const [penSize, setPenSize] = useState(3);
            const {
          Severity: Minor
          Found in src/games/kalambury/DrawArea.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 FilterBox has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
          Open

          const FilterBox = ({ games, filters, onChange }) => {
            const { t } = useTranslation("lobby");
            const [open, setOpen] = useState(false);
            const searchRef = useRef();
          
          
          Severity: Minor
          Found in src/components/lobby/FilterBox.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

          Severity
          Category
          Status
          Source
          Language