pankod/refine

View on GitHub

Showing 580 of 800 total issues

Consider simplifying this complex logical expression.
Open

    if (
      field.type === "text" ||
      field.type === "url" ||
      field.type === "email" ||
      field.type === "number" ||
Severity: Major
Found in packages/inferencer/src/inferencers/mui/edit.tsx - About 1 hr to fix

    Function RefreshButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const RefreshButton: React.FC<RefreshButtonProps> = ({
      resource: resourceNameFromProps,
      resourceNameOrRouteName: propResourceNameOrRouteName,
      recordItemId,
      hideText = false,
    Severity: Minor
    Found in packages/mantine/src/components/buttons/refresh/index.tsx - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export async function run(): Promise<void> {
      const cli = meow({
        description: "Codemods for updating refine apps.",
        help: `
        Usage
    Severity: Minor
    Found in packages/codemod/src/index.ts - About 55 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 arrayInfer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const arrayInfer: FieldInferencer = (
      key,
      value,
      record,
      infer,
    Severity: Minor
    Found in packages/inferencer/src/field-inferencers/array.ts - About 55 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 getMetaProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getMetaProps = (
      identifier?: string,
      meta?: InferencerComponentProps["meta"],
      actions?: Action[],
    ) => {
    Severity: Minor
    Found in packages/inferencer/src/utilities/get-meta-props/index.ts - About 55 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 getResourceValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getResourceValue = (activity: Activity): string => {
      const { resourcePath } = activity;
      let resource: string | null = null;
    
      if (activity?.resourceName) {
    Severity: Minor
    Found in packages/devtools-ui/src/utils/get-resource-value.ts - About 55 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 getProjectType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getProjectType = (platform?: ProjectTypes): ProjectTypes => {
      if (platform) {
        return platform;
      }
      // read dependencies from package.json
    Severity: Minor
    Found in packages/cli/src/utils/project/index.ts - About 55 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 dataProvider has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const dataProvider = (
      apiKey: string,
      baseId: string,
      airtableClient?: AirtableBase,
    ): Required<DataProvider> => {
    Severity: Minor
    Found in packages/airtable/src/dataProvider.ts - About 55 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 Onboarded has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const Onboarded = ({
      children,
      fallback,
    }: {
      children: React.ReactNode;
    Severity: Minor
    Found in packages/devtools-ui/src/components/onboarded.tsx - About 55 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 transformer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function transformer(file: FileInfo, api: API, options: any) {
      const j = api.jscodeshift;
      const source = j(file.source);
    
      const rootElement = source.find(j.JSXElement, {
    Severity: Minor
    Found in packages/cli/src/transformers/resource.ts - About 55 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 transformCrudOperatorToMuiOperator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const transformCrudOperatorToMuiOperator = (
      operator: CrudOperators,
      columnType?: string,
    ): string => {
      switch (columnType) {
    Severity: Minor
    Found in packages/mui/src/definitions/dataGrid/index.ts - About 55 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 checkGitStatus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function checkGitStatus(force) {
      let clean = false;
      let errorMessage = "Unable to determine if git directory is clean";
      try {
        clean = isGitClean.sync(process.cwd());
    Severity: Minor
    Found in packages/codemod/src/index.ts - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
    Open

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

    export const getAppwriteFilters: GetAppwriteFiltersType = (filters) => {
      const appwriteFilters: string[] = [];
    
      for (const filter of filters ?? []) {
        if (
    Severity: Minor
    Found in packages/appwrite/src/utils/getAppwriteFilters.ts - About 45 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 accessorSingle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function accessorSingle(variableName: string, key?: string, accessor?: string) {
      let base = `${variableName}`;
    
      if (key) {
        base += "?.";
    Severity: Minor
    Found in packages/inferencer/src/utilities/accessor/index.ts - About 45 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 handleExpression has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const handleExpression = (expression: unknown) => {
      if (!expression) {
        return "";
      }
    
    
    Severity: Minor
    Found in packages/inferencer/src/utilities/jsx/index.ts - About 45 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 rangePickerFilterMapper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const rangePickerFilterMapper = (
      selectedKeys: FilterDropdownProps["selectedKeys"],
      event: MapValueEvent,
    ) => {
      if (!selectedKeys) {
    Severity: Minor
    Found in packages/antd/src/definitions/filter-mappers/index.ts - About 45 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

    Avoid deeply nested control flow statements.
    Open

                                  if (Array.isArray(field.relationInfer.accessor)) {
                                    console.log(
                                      "@refinedev/inferencer: Inferencer failed to render this field",
                                      {
                                        key: field.key,
    Severity: Major
    Found in packages/inferencer/src/inferencers/headless/show.tsx - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                if (Array.isArray(field.relationInfer.accessor)) {
                                  return `<span title="Inferencer failed to render this field. (Unsupported nesting)">Cannot Render</span>`;
                                }
      Severity: Major
      Found in packages/inferencer/src/inferencers/antd/show.tsx - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                  if (Array.isArray(field.relationInfer.accessor)) {
                                    console.log(
                                      "@refinedev/inferencer: Inferencer failed to render this field",
                                      {
                                        key: field.key,
        Severity: Major
        Found in packages/inferencer/src/inferencers/chakra-ui/show.tsx - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language