Showing 33 of 116 total issues
Function createStore
has 177 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function createStore<
S,
A extends Action,
Ext extends {} = {},
StateExt extends {} = {},
Function createStore
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
Open
export function createStore<
S,
A extends Action,
Ext extends {} = {},
StateExt extends {} = {},
- 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 combineReducers
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function combineReducers(reducers: {
[key: string]: Reducer<any, any, any>
}) {
const reducerKeys = Object.keys(reducers)
const finalReducers: { [key: string]: Reducer<any, any, any> } = {}
- 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
File todos.spec.js
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import todos from './todos'
import * as types from '../constants/ActionTypes'
describe('todos reducer', () => {
it('should handle initial state', () => {
Function Home
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Home() {
const context = useDocusaurusContext()
const { siteConfig = {} } = context
return (
<Layout
Function combineReducers
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function combineReducers(reducers: {
[key: string]: Reducer<any, any, any>
}) {
const reducerKeys = Object.keys(reducers)
const finalReducers: { [key: string]: Reducer<any, any, any> } = {}
File createStore.ts
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import $$observable from './utils/symbol-observable'
import type {
Store,
StoreEnhancer,
Function App
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function App() {
return (
<div className="App">
<header className="App-header">
<img
Function App
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function App() {
return (
<div className="App">
<header className="App-header">
<img
Function Counter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Counter() {
const count = useSelector(selectCount)
const dispatch = useDispatch()
const [incrementAmount, setIncrementAmount] = useState('2')
Function Counter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Counter() {
const count = useAppSelector(selectCount)
const dispatch = useAppDispatch()
const [incrementAmount, setIncrementAmount] = useState('2')
Function Errors
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Errors() {
const location = useLocation()
const context = useDocusaurusContext()
const { siteConfig = {} } = context
const errorCode = new URLSearchParams(location.search).get('code')
Function combination
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function combination(
state: StateFromReducersMapObject<typeof reducers> = {},
action: Action
) {
if (shapeAssertionError) {
Function subscribe
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function subscribe(listener: () => void) {
if (typeof listener !== 'function') {
throw new Error(
`Expected the listener to be a function. Instead, received: '${kindOf(
listener
Function getUnexpectedStateShapeWarningMessage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getUnexpectedStateShapeWarningMessage(
inputState: object,
reducers: { [key: string]: Reducer<any, any, any> },
action: Action,
unexpectedKeyCache: { [key: string]: true }
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { todo, completeTodo, deleteTodo } = this.props
let element
if (this.state.editing) {
Function dispatch
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dispatch(action: A) {
if (!isPlainObject(action)) {
throw new Error(
`Actions must be plain objects. Instead, the actual type was: '${kindOf(
action
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { selectedSubreddit, posts, isFetching, lastUpdated } = this.props
const isEmpty = posts.length === 0
return (
<div>
Function todos
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function todos(state = initialState, action) {
switch (action.type) {
case ADD_TODO:
return [
...state,
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
isFetching,
nextPageUrl,
pageCount,