best-doctor/ke

View on GitHub

Showing 95 of 332 total issues

Function useFieldValidation has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  useLeaf: (key: ErrorsKey) => [ErrorsData, (updater: Updater<ErrorsData>) => void],
  useCheck: (validator: Validator) => UseValidationResult<ValidationError[], ValidationResult>,
  key: ErrorsKey,
  value: unknown,
  validator?: Validator
Severity: Minor
Found in src/django-spa/cdk/Forms/Validation/Field.hook.ts - About 35 mins to fix

    Function useForm has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      useRecord: (val: Record<K, unknown>, onChange: (val: RecordData<K>) => void) => RootProviderDesc,
      useValidation: (
        v: Record<K, unknown>,
        validator?: RecordValidator
      ) => { errorsRoot: RootProviderDesc; recursiveValidate: RecordValidator },
    Severity: Minor
    Found in src/django-spa/cdk/Forms/Form.hook.ts - About 35 mins to fix

      Function toPages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function toPages<T>(base: AsyncIterable<T>, itemsPerPage: number): AsyncIterable<T[]> {
        return {
          async *[Symbol.asyncIterator]() {
            let page: T[] = []
            // eslint-disable-next-line no-restricted-syntax
      Severity: Minor
      Found in src/django-spa/utils/Iterables/Page.ts - About 35 mins to fix

      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 AllDayDateTimeRangeAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const AllDayDateTimeRangeAction = (props: DateTimeRangeActionProps): JSX.Element => {
        const { startDate, endDate, itemIndex, setDateRanges, dateRanges, targetPayload, targetUrl, submitChange, name } =
          props
      
        const handleButtonClick = (): void => {
      Severity: Minor
      Found in src/DetailView/widgets/DateTimeRangeListWidget.tsx - About 35 mins to fix

      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 mountComponents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const mountComponents = ({
        setInitialValue,
        submitChange,
        resourceName,
        mainDetailObject,
      Severity: Minor
      Found in src/common/utils/mountComponents.tsx - About 35 mins to fix

      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 withSortingInHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function withSortingInHeader(OrderHandler: ComponentType<SortHandlerProps>): TablePlugin<SortingProps> {
        return {
          after: (normalizedProps) => {
            const { orderedColumnNames, ordering, onOrderChange, ...restTableProps } = normalizedProps.table
            const result = {
      Severity: Minor
      Found in src/django-spa/plugins/table/withSortingInHeader.tsx - About 35 mins to fix

      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 Button has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export const Button = (props: ButtonProps): JSX.Element => {
        const { onClick, isDisabled: initialDisabled } = props
        const [isDisabled, setIsDisabled] = usePropState<boolean>(initialDisabled || false)
        const isMountedRef = useIsMounted()
      
      
      Severity: Minor
      Found in src/django-spa/cdk/Controls/Button/Button.tsx - About 35 mins to fix

      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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        get(cacheKey: string, cacheTime: number = this.cacheTime): any {
          if (cacheTime > 0) {
            const cached = this.keySpace[cacheKey] || undefined
            if (cached !== undefined) {
              if (cached.cachedTime + cacheTime * 1000 > Date.now()) {
      Severity: Minor
      Found in src/admin/providers/caches.ts - About 35 mins to fix

      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 Pagination has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export const Pagination = makeWithLayout(({ value: page, onChange, totalCount }: PaginationProps) => {
        const isFirst = page === 1
        const isLast = page === totalCount
      
        return {
      Severity: Minor
      Found in src/FormControls/Pagination/Pagination.tsx - About 25 mins to fix

      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 getPathRule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const getPathRule = (rules: TPathRules, pathElement: string, leftPathElement: string | undefined): TPathRule => {
        let pathRule: TPathRule = { link: '#', text: 'error' }
      
        const pathRulesArray = Object.values(rules)
        for (let i = 0; i < pathRulesArray.length; i += 1) {
      Severity: Minor
      Found in src/ListView/components/Breadcrumbs/Breadcrumbs.tsx - About 25 mins to fix

      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 useForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function useForm<K extends FieldKey>(
        useRecord: (val: Record<K, unknown>, onChange: (val: RecordData<K>) => void) => RootProviderDesc,
        useValidation: (
          v: Record<K, unknown>,
          validator?: RecordValidator
      Severity: Minor
      Found in src/django-spa/cdk/Forms/Form.hook.ts - About 25 mins to fix

      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 UploadButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function UploadButton({
        onSelect,
        onUpload,
        label = 'Прикрепить ещё один файл',
        buttonProps,
      Severity: Minor
      Found in src/FormControls/FilesUpload/UploadButton.tsx - About 25 mins to fix

      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 modifyStyles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export const modifyStyles = <OptionType extends OptionTypeBase, IsMulti extends boolean>(
        externalStyles?: StylesConfig<OptionType, IsMulti>
      ): StylesConfig<OptionType, IsMulti> => ({
        ...externalStyles,
        valueContainer(prevStyles, state) {
      Severity: Minor
      Found in src/common/components/ReactSelectCustomization.tsx - About 25 mins to fix

      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 getBreadcrumbs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const getBreadcrumbs = (rules: TPathRules, pathname: string): TBreadcrumbElement[] => {
        let pathElements = pathname.split('/')
        if (pathElements[pathElements.length - 1] === '') {
          pathElements = pathElements.slice(0, pathElements.length - 1)
        }
      Severity: Minor
      Found in src/ListView/components/Breadcrumbs/Breadcrumbs.tsx - About 25 mins to fix

      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 ReadOnlyWidget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const ReadOnlyWidget = (props: ReadOnlyWidgetProps): JSX.Element => {
        const {
          containerStore,
          style,
          helpText,
      Severity: Minor
      Found in src/DetailView/widgets/ReadOnlyWidget.tsx - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language