pankod/refine

View on GitHub

Showing 587 of 807 total issues

Function ShowButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const ShowButton: React.FC<ShowButtonProps> = ({
  resource: resourceNameFromProps,
  resourceNameOrRouteName,
  recordItemId,
  hideText = false,
Severity: Minor
Found in packages/mantine/src/components/buttons/show/index.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 checkAuthentication has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const checkAuthentication = async (
  authProvider: LegacyAuthProvider,
  request: Request,
  redirectTo: string = new URL(request.url).pathname,
): Promise<any> => {
Severity: Minor
Found in packages/remix-router/src/legacy/checkAuthentication.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 ListButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const ListButton: React.FC<ListButtonProps> = ({
  resource: resourceNameFromProps,
  resourceNameOrRouteName,
  hideText = false,
  accessControl,
Severity: Minor
Found in packages/mantine/src/components/buttons/list/index.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 CloneButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const CloneButton: React.FC<CloneButtonProps> = ({
  resource: resourceNameFromProps,
  resourceNameOrRouteName,
  recordItemId,
  hideText = false,
Severity: Minor
Found in packages/mantine/src/components/buttons/clone/index.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 getOptionLabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getOptionLabel = (field: InferField) => {
  if (!field.relationInfer) return "";

  if (field.relationInfer?.accessor) {
    if (Array.isArray(field.relationInfer.accessor)) {
Severity: Minor
Found in packages/inferencer/src/utilities/get-option-label/index.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 DeleteButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const DeleteButton: React.FC<DeleteButtonProps> = ({
  resource: resourceNameFromProps,
  resourceNameOrRouteName: propResourceNameOrRouteName,
  recordItemId,
  onSuccess,
Severity: Minor
Found in packages/antd/src/components/buttons/delete/index.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 ThemedHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const ThemedHeader: React.FC<RefineThemedLayoutHeaderProps> = ({
  isSiderOpen,
  onToggleSiderClick,
  toggleSiderIcon: toggleSiderIconFromProps,
}) => {
Severity: Minor
Found in packages/chakra-ui/src/components/themedLayout/header/index.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 resourceFromInferred has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const resourceFromInferred = (
  field: InferField | false | null,
  resources: IResourceItem[],
): IResourceItem | undefined => {
  if (!field) {
Severity: Minor
Found in packages/inferencer/src/utilities/resource-from-inferred/index.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 getFieldableKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getFieldableKeys = (
  key: string,
  data: Record<string, unknown>,
): string | string[] | undefined => {
  const fieldableProperties = [
Severity: Minor
Found in packages/inferencer/src/utilities/get-fieldable-keys/index.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 provideCliHelpers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const provideCliHelpers = (
  packagePath: string,
  isAbsolute?: boolean,
) => {
  Module.prototype.require = function (...args: Parameters<NodeRequire>) {
Severity: Minor
Found in packages/cli/src/utils/swizzle/provideCliHelpers.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setup: (build) => {
    if (build.initialOptions.format === "esm") {
      build.onEnd((args) => {
        const dayJsImportRegexp = /from\s?"dayjs\/plugin\/(\w*?)"/g;
        const dayJsEsmImport = 'from "dayjs/plugin/$1.js"';
Severity: Minor
Found in packages/shared/dayjs-esm-replace-plugin.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setup: (build) => {
    if (build.initialOptions.format === "esm") {
      build.onEnd(async (args) => {
        const nextJsImportRegexp = /from\s?"next\/(\w*?)"/g;
        const nextJsEsmImport = 'from "next/$1.js"';
Severity: Minor
Found in packages/shared/next-js-esm-replace-plugin.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 ReactKeycloakProvider has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ReactKeycloakProvider = ({ children }: { children: React.ReactNode }) => {
  const externalNavigator = React.useContext(ExternalNavigationContext);

  const [isAuthenticated, setIsAuthenticated] = React.useState(false);

Severity: Minor
Found in packages/live-previews/src/scope/keycloak.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setup: (build) => {
    if (build.initialOptions.format === "esm") {
      build.onEnd((args) => {
        const muiIconsMaterialImportRegexp =
          /from\s?"@mui\/icons-material\/(\w*?)"/g;
Severity: Minor
Found in packages/shared/mui-icons-material-esm-replace-plugin.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 getValueProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getValueProps = (data: any, imageUrl: string) => {
  if (!data) {
    return { fileList: [] };
  }

Severity: Minor
Found in packages/strapi/src/helpers/normalize.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 Header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const Header = () => {
  const [connectedApp, setConnectedApp] = React.useState<string | null>(null);
  const { ws } = React.useContext(DevToolsContext);

  const fetchConnectedApp = React.useCallback(async () => {
Severity: Minor
Found in packages/devtools-ui/src/components/header.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setup: (build) => {
    if (build.initialOptions.format === "esm") {
      build.onEnd(async (args) => {
        const prismReactRendererThemeImportRegexp =
          /from\s?"prism-react-renderer\/themes\/(\w*?)"/g;
Severity: Minor
Found in packages/shared/prism-react-renderer-theme-replace-plugin.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setup: (build) => {
    if (build.initialOptions.format === "cjs") {
      build.onEnd((args) => {
        const tablerRequire = 'require("@tabler/icons-react")';
        const cjsTablerRequire =
Severity: Minor
Found in packages/shared/tabler-cjs-replace-plugin.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 getValueProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getValueProps = (data: any, imageUrl: string) => {
  if (!data) {
    return { fileList: [] };
  }

Severity: Minor
Found in packages/strapi-v4/src/helpers/normalize.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 RefreshButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const RefreshButton: React.FC<RefreshButtonProps> = ({
  resource: resourceNameFromProps,
  resourceNameOrRouteName,
  recordItemId,
  hideText = false,
Severity: Minor
Found in packages/mui/src/components/buttons/refresh/index.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