Showing 17 of 17 total issues
File games.test.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
import expect from '../test-setup';
import sinon from 'sinon';
import axios from 'axios';
import { MODAL_SHOW } from '../../src/ducks/modal';
import { DispatchStub } from '../support/dispatch-helper';
Function generateCompleteGame
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
static generateCompleteGame(game) {
const turns = [],
transmitters = game.players.filter((p) => p.role === 'transmitter').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
decoders = game.players.filter((p) => p.role === 'decoder').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
types = tileTypes(),
- 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 openWebSocket
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function openWebSocket(token) {
return (dispatch) => {
const webSocketUrl = `ws://${process.env.REACT_APP_API_URL}/api/v1/?access_token=${token}`;
let initializeWebSocket,
webSocket = new WebSocket(webSocketUrl);
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
canDrop,
connectDropTarget,
editable,
Function SignUp
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const SignUp = (props) => {
const { handleSubmit, invalid, submitting } = props;
return (
<Form onSubmit={handleSubmit}>
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { id, loading } = this.props;
if (loading) return (<Segment><Loader active /><Menu><Menu.Item><Icon name="bars" />Menu</Menu.Item><Menu.Item header>Loading Game…</Menu.Item></Menu></Segment>);
if (!id) return (<Redirect to="/" />);
Function renderCompletedModal
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCompletedModal() {
const {
id: gameId,
completed,
turns,
Function generateCompleteGame
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
static generateCompleteGame(game) {
const turns = [],
transmitters = game.players.filter((p) => p.role === 'transmitter').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
decoders = game.players.filter((p) => p.role === 'decoder').reduce((obj, p) => ({ ...obj, [p.team]: p }), {}),
types = tileTypes(),
Function render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
canDrop,
connectDropTarget,
editable,
- 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 render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { connectDragSource, editable, id, isActive, isUser, role, team, user: { username } } = this.props,
className = [
'player',
'fluid',
Function renderContainerWith
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderContainerWith = (render) => (providerProps = {}, routerProps = {}, appendToBody = false) => {
const { initialState, ...pProps } = providerProps,
state = Object.assign({
session: {}
}, initialState || {});
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let links;
if (this.props.session.apiToken) {
links = [(
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { connectDragSource, editable, id, isActive, isUser, role, team, user: { username } } = this.props,
className = [
'player',
'fluid',
- 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 mapStateToProps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function mapStateToProps({ games, session: { apiToken, apiUser } }) {
const sortedGames = games ? Object.keys(games).map((k) => games[k]).sort((a, b) => {
if (a.updatedAt < b.updatedAt) return 1;
if (a.updatedAt > b.updatedAt) return -1;
return 0;
- 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 mapStateToProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const mapStateToProps = ({ session, games }, { match: { params: { id } } }) => {
if (!games) return { session, loading: true };
const game = games[id],
rematch = game &&
game.completed &&
- 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 renderCompletedModal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
renderCompletedModal() {
const {
id: gameId,
completed,
turns,
- 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
TODO found Open
// TODO: spec Game component
- Exclude checks