Showing 21 of 44 total issues
Function render
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
game,
passQuestion,
checkAnswer,
Function render
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
isSettingsOpen,
toggleSidebar,
jarvigSettings,
Function render
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
game,
passQuestion,
checkAnswer,
- 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 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { numberOfQuestions, gameResult, difficulty } = this.props;
const resultCounts = getArrayCounts(gameResult);
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { game, selectCharacter } = this.props;
let gridItems = "";
if (game.choices) {
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
game,
isGameLoading,
passQuestion,
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { location, time, game, isLoading, error } = this.props;
const isGamePaused =
isLoading || // if game is loading
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { location, toggleSidebar } = this.props;
return (
<Footer>
Function componentDidUpdate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate() {
const {
callRequest,
game,
jarvigSettings,
- 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 generateAnswers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const generateAnswers = (
characters,
charactersPerQuestion,
bannedChars
) => {
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { numberOfQuestions, gameResult, difficulty } = this.props;
const resultCounts = getArrayCounts(gameResult);
- 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
Avoid too many return
statements within this function. Open
return {
...state,
game: {
...state.game,
selected: action.payload
Avoid too many return
statements within this function. Open
return {
...state,
fetching: false,
error: null,
characters: action.payload,
Avoid too many return
statements within this function. Open
return { ...state, fetching: false, error: action.payload };
Avoid too many return
statements within this function. Open
return { ...state, fetching: true, error: null };
Avoid too many return
statements within this function. Open
return {
...state,
game: {
...state.game,
result: [...state.game.result, action.payload ? "1" : "0"], // set 1 if correct, 0 if not
Avoid too many return
statements within this function. Open
return {
...state,
game: {
...state.game,
time: action.payload
Avoid too many return
statements within this function. Open
return {
...state,
game: {
...state.game,
over: true
Avoid too many return
statements within this function. Open
return {
...state,
game: {
...state.game,
result: [...state.game.result, "0"], // set 0 as "wrong answer" because passed
Avoid too many return
statements within this function. Open
return {
...state,
game: {
...state.game,
choices: null,