Showing 21 of 80 total issues
File index.test.js
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const { Types: { ObjectId } } = require('mongoose');
const {
hasEqualIds,
expectThrows,
expectEqualIds,
File index.test.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const { Errors } = require('../../modules');
const Hand = require('../hand');
const Solver = require('./index');
describe('Domain.Solver', () => {
File index.js
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const { Schema } = require('mongoose');
const { Errors } = require('../../modules');
const Utils = require('../../utils');
const Card = require('../card');
const Deck = require('../deck');
Function Sidebar
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Sidebar() {
const requireData = useRouteMatch('/room');
const [data, setData] = useUser();
const [isOpen, setIsOpen] = useState(false);
Function Lobby
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Lobby() {
const [isCopied, setIsCopied] = useState(false);
const copyRef = useRef(null);
const [{ id: userId }] = useUser();
Function Chat
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Chat() {
const { messages, sendMessage } = useRoom();
const [value, setValue] = useState('');
const [isShiftDown, setIsShiftDown] = useState(false);
const bottomRef = useRef(null);
Function chunkBy
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function chunkBy(array, fn) {
const { chunks, chunk } = (
array.reduce(
(acc, curr) => {
const key = fn(curr);
Function useUserSync
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function useUserSync() {
const [{
id,
name,
avatarId,
Function Rooms
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Rooms() {
const { push } = useHistory();
const { rooms } = useRooms();
if (!rooms) {
Function distributeWinnings
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function distributeWinnings(round) {
const hands = (
round.players
.filter((player) => !player.hasFolded)
.reduce(
Function Player
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Player() {
const [{ id: userId }] = useUser();
const { round } = useRound();
const p = (
Function allocate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function allocate(hands, wagers, awarded = {}) {
const [head, ...losers] = hands;
const winners = (
Array.isArray(head)
? head
Function create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function create() {
const emitter = new EventEmitter();
const listen = (fn) => emitter.addListener(globalName, fn);
const unlisten = (fn) => emitter.removeListener(globalName, fn);
Function Socket
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function Socket(server) {
const io = IO(server, {
origins: '*:*',
serveClient: false,
pingInterval: config.socket.pingInterval,
Function reducer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function reducer(state, action) {
switch (action.type) {
case PUSH:
return {
...state,
Function App
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function App() {
return (
<StateProvider>
<Router>
<Sidebar />
Function Chat
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function Chat() {
const { messages, sendMessage } = useRoom();
const [value, setValue] = useState('');
const [isShiftDown, setIsShiftDown] = useState(false);
const bottomRef = useRef(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 tieIndexes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function tieIndexes(shape) {
const { indexes } = shape.reduce(
(acc, val, i) => {
if (i < shape.length - 1) {
return {
Function take
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function take(model, id) {
const key = lockName(model, id);
const value = uuid();
const get = async (n = retryCount) => {
Function RoomProvider
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
function RoomProvider({ children }) {
const { rooms } = useRooms();
const [roomId, setRoomId] = useState(null);
const { socket } = useSocket();
const [{ token, id: userId }] = useUser();
- 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"