pankod/refine

View on GitHub

Showing 580 of 800 total issues

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/mantine/show.tsx - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if (scopedImportName) {
                if (namedImports) {
                  namedImports = `{ ${scopedImportName} as ${defaultImport}, ${namedImports.slice(
                    1,
                    -1,
    Severity: Major
    Found in packages/live-previews/src/utils/replace-imports.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  for (const response of item.response) {
                    ids.push(response.id);
                  }
      Severity: Major
      Found in packages/strapi/src/helpers/normalize.ts - 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/mui/show.tsx - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (namedImports.includes("default as")) {
                      const scopedImportName = packageName.match(regexMatch[1])?.[1];
                      namedImports = namedImports.replace(
                        "default as",
                        `${scopedImportName} as`,
          Severity: Major
          Found in packages/live-previews/src/utils/replace-imports.ts - About 45 mins to fix

            Function Packages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export const Packages = () => {
              const ref = React.useRef<FireworksHandlers>(null);
              const [packages, setPackages] = React.useState<PackageType[]>([]);
              const [visible, setVisible] = React.useState(false);
              const [outdatedPackages, setOutdatedPackages] = React.useState<string[]>([]);
            Severity: Minor
            Found in packages/devtools-ui/src/components/packages.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 authProvider has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export const authProvider = (API_URL: string): AuthProvider => {
              const axiosInstance = axios.create();
            
              axiosInstance.interceptors.response.use(
                (response) => {
            Severity: Minor
            Found in packages/medusa/src/authProvider/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

                        for (const response of item.response) {
                          ids.push(response.id);
                        }
            Severity: Major
            Found in packages/strapi-v4/src/helpers/normalize.ts - About 45 mins to fix

              Function Status has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const Status = ({ activity }: { activity: Activity }) => {
                const status = activity.status;
              
                const dataUpdateCount =
                  activity.type === "query" ? activity.state.dataUpdateCount : 0;
              Severity: Minor
              Found in packages/devtools-ui/src/components/status.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 ResultItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                ({ action, active, currentRootActionId }, ref) => {
                  const ancestors = React.useMemo(() => {
                    if (!currentRootActionId) return action.ancestors;
                    const index = action.ancestors.findIndex(
                      (ancestor) => ancestor.id === currentRootActionId,
              Severity: Minor
              Found in packages/kbar/src/components/resultItem/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 FeedItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const FeedItem = ({ item }: Props) => {
                const isNew = dayjs().diff(dayjs(item.date), "day") <= 3;
                const isFeatured = item.featured;
              
                return (
              Severity: Minor
              Found in packages/devtools-ui/src/components/feed-item.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 liveProvider has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const liveProvider = (client: Client): LiveProvider => {
                const subscribeToResource = (
                  client: Client,
                  callback: Function,
                  params: any,
              Severity: Minor
              Found in packages/nestjs-query/src/liveProvider/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 pickMatchedRoute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const pickMatchedRoute = (
                routes: ResourceActionRoute[],
              ): ResourceActionRoute | undefined => {
                // these routes are all matched, we should pick the least parametrized one
              
              
              Severity: Minor
              Found in packages/core/src/definitions/helpers/router/pick-matched-route.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 useCanWithoutCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const useCanWithoutCache = (): IAccessControlContext => {
                const { can: canFromContext } = React.useContext(AccessControlContext);
              
                const can = React.useMemo(() => {
                  if (!canFromContext) {
              Severity: Minor
              Found in packages/core/src/hooks/accessControl/useCanWithoutCache.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 LoginPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const LoginPage: React.FC<LoginProps> = ({
                providers,
                registerLink,
                forgotPasswordLink,
                rememberMe,
              Severity: Minor
              Found in packages/core/src/components/pages/auth/components/login/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 useButtonCanAccess has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const useButtonCanAccess = (
                props: ButtonCanAccessProps,
              ): ButtonCanAccessValues => {
                const translate = useTranslate();
                const accessControlContext = React.useContext(AccessControlContext);
              Severity: Minor
              Found in packages/core/src/hooks/button/button-can-access/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 RegisterPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const RegisterPage: React.FC<RegisterProps> = ({
                providers,
                loginLink,
                wrapperProps,
                contentProps,
              Severity: Minor
              Found in packages/core/src/components/pages/auth/components/register/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

              Consider simplifying this complex logical expression.
              Open

                  if (
                    !field.relation &&
                    (field.type === "text" ||
                      field.type === "richtext" ||
                      field.type === "number") &&
              Severity: Major
              Found in packages/inferencer/src/field-transformers/basic-to-relation.ts - About 40 mins to fix

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

                  translate: ReturnType<typeof useTranslate>,
                  resource?: IResourceItem,
                  action?: string,
                  id?: string,
                  resourceName?: string,
                Severity: Minor
                Found in packages/core/src/definitions/helpers/generateDocumentTitle/index.ts - About 35 mins to fix

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

                  export const liveProvider = (client: Client): LiveProvider => {
                    return {
                      subscribe: ({ callback, params }) => {
                        const {
                          resource,
                  Severity: Minor
                  Found in packages/graphql/src/liveProvider/index.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

                  Severity
                  Category
                  Status
                  Source
                  Language