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);
- Read upRead up
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,
- Read upRead up
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);
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;
- Read upRead up
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 (
<>
Function StartGame
has 7 arguments (exceeds 5 allowed). Consider refactoring. Open
function StartGame(G, ctx, gameMode, maxPoints, language, category, timePerTurn) {
Function leaveGame
has 6 arguments (exceeds 5 allowed). Consider refactoring. Open
function leaveGame(gameName, matchID, playerID, playerUID, credentials, history) {
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 {
- Read upRead up
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();
- Read upRead up
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"