Showing 30 of 100 total issues
Function createProcess
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function createProcess(act: TAct): TProcessCreator {
return function(itemType: string, options?: any): TProcess {
let _act = act
let _itemType = itemType
let _options = options || {}
Function useStyles
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useStyles = makeStyles((theme: Theme) => {
const contentPadding = 0
const drawerWidth = 240
const drawerMinWidth = 56
const appBarHeight = 48
File testData.ts
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Acts } from '../types'
export const TestItem = 'testItem'
export const testItems = [
Function AppLayout
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function AppLayout(props: AppLayoutProps) {
const {
PageBarContainer = DefaultContainer,
ContentContainer = DefaultContainer,
CollapseIcon = MenuOpen,
Function ToggleField
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ToggleField(props: MuiFieldProps) {
const classes = useStyles()
const {
container,
directionColumn,
Function RadioField
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function RadioField(props: MuiFieldProps) {
const classes = useStyles()
const {
container,
directionColumn,
Function DemoForm
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const DemoForm = () => {
const [initialValues, setInitialValues] = useState({} as InitialValues)
useEffect(() => {
const timeout = setTimeout(() => {
Function Form
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Form(props: FormProps) {
const {
fields,
fieldsConfig,
renderActions,
Function MultiGenericField
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function MultiGenericField(
props: MuiFieldProps & GenericMultiFieldProps
) {
const classes = useStyles()
const { container, noselect } = classes
Function CheckControl
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function CheckControl(props: CheckControlProps) {
const classes = useStyles()
const {
noselect,
Function SelectField
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function SelectField(props: MuiFieldProps) {
const {
options = [],
controlProps = {},
name,
Function MultiControl
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function MultiControl(props: MultiControlProps) {
const classes = useStyles()
const { noselect, marginRight, marginZero, flexGrow, smallLabel } = classes
const {
Function FormWithDefaults
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function FormWithDefaults(props: FormProps) {
const {
renderActions,
initialValues,
fieldsDisabled = false,
Function Form
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Form = () => {
const [initialValues, setInitialValues] = useState({} as InitialValues)
useEffect(() => {
const timeout = setTimeout(() => {
Function useStyles
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useStyles = makeStyles((theme: Theme) => {
const drawerWidth = 240
const drawerMinWidth = 56
const transition = {
Function MultiToggle
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const MultiToggle = React.memo(function MultiToggle(
props: MultiToggleProps
) {
const {
name,
Function PasswordField
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function PasswordField(props: MuiFieldProps) {
const classes = useStyles()
const [showPassword, setShowPassword] = useState(false)
const handleClickShowPassword = () => setShowPassword(!showPassword)
Function FormField
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function FormField(props: FormFieldProps) {
const {
name,
required,
disabled,
Function updateOrAppendItemByKey
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function updateOrAppendItemByKey(state: TState, action: TAction): TState {
const { itemType, data, id, field, itemState } = getParams(state, action)
if (!id && !field) return state
const key: string = String(id || field)
- 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 registerValidSW
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {