pankod/refine

View on GitHub

Showing 580 of 800 total issues

Function action has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const action = async (_options: OptionValues) => {
  inquirer.registerPrompt("autocomplete", inquirerAutoCompletePrompt);

  const installedPackages = await getInstalledRefinePackagesFromNodeModules();

Severity: Minor
Found in packages/cli/src/commands/swizzle/index.tsx - About 3 hrs 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 objectInfer has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const objectInfer: FieldInferencer = (
  key,
  value,
  record,
  infer,
Severity: Major
Found in packages/inferencer/src/field-inferencers/object.ts - About 3 hrs to fix

    Function ErrorComponent has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ErrorComponent: React.FC<RefineErrorPageProps> = () => {
      const [errorMessage, setErrorMessage] = useState<string>();
      const translate = useTranslate();
      const { push } = useNavigation();
      const go = useGo();
    Severity: Major
    Found in packages/mantine/src/components/pages/error/index.tsx - About 3 hrs to fix

      Function DevToolsApp has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const DevToolsApp = () => {
        return (
          <DevToolsContextProvider __devtools url={location.origin}>
            <ReloadOnChanges />
            <BrowserRouter>
      Severity: Major
      Found in packages/devtools-ui/src/devtools.tsx - About 3 hrs to fix

        Function liveProvider has 80 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const liveProvider = (
          supabaseClient: SupabaseClient<any, any, any>,
        ): LiveProvider => {
          return {
            subscribe: ({
        Severity: Major
        Found in packages/supabase/src/liveProvider/index.ts - About 3 hrs to fix

          Function Sidebar has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Sidebar = () => {
            const itemContainerRef = React.useRef<HTMLDivElement>(null);
            const { pathname } = useLocation();
          
            const [itemsToRender, setItemsToRender] = React.useState<typeof items>([]);
          Severity: Major
          Found in packages/devtools-ui/src/components/sidebar.tsx - About 3 hrs to fix

            Function FeatureSlideMobile has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const FeatureSlideMobile = (props: { className?: string }) => {
              return (
                <div
                  className={clsx(
                    "re-max-w-[640px]",
            Severity: Major
            Found in packages/devtools-ui/src/components/feature-slide.tsx - About 3 hrs to fix

              Function transformCrudOperatorToMuiOperator has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const transformCrudOperatorToMuiOperator = (
                operator: CrudOperators,
                columnType?: string,
              ): string => {
                switch (columnType) {
              Severity: Major
              Found in packages/mui/src/definitions/dataGrid/index.ts - About 3 hrs to fix

                Function ExampleImplementation has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const ExampleImplementation = () => {
                  return (
                    <pre
                      style={{
                        display: "block",
                Severity: Major
                Found in packages/core/src/components/pages/config-error/index.tsx - About 3 hrs to fix

                  Function moveResources has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const moveResources = (j: JSCodeshift, root: Collection<any>) => {
                    const newResources: { [key: string]: any }[] = [];
                  
                    const resourceElements = root.find(j.JSXElement, {
                      openingElement: {
                  Severity: Major
                  Found in packages/codemod/src/transformations/refine1-to-refine2.ts - About 3 hrs to fix

                    Function updateRefineImports has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function updateRefineImports(j: JSCodeshift, root: Collection<any>) {
                      const refineCoreImports = root.find(j.ImportDeclaration, {
                        source: {
                          value: "@pankod/refine-core",
                        },
                    Severity: Major
                    Found in packages/codemod/src/transformations/refine2-to-refine3.ts - About 3 hrs to fix

                      Function renameUseFormQueryResultAndMutationResult has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const renameUseFormQueryResultAndMutationResult = (
                        j: JSCodeshift,
                        source: Collection,
                      ) => {
                        const renameProperties = (prop) => {

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

                      export const renameUseSelectQueryResult = (
                        j: JSCodeshift,
                        source: Collection,
                      ) => {
                        const renameProperties = (prop) => {

                      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 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const dataProvider = (
                        apiUrl: string,
                        httpClient: AxiosInstance = axiosInstance,
                      ): Omit<
                        Required<DataProvider>,
                      Severity: Minor
                      Found in packages/simple-rest/src/provider.ts - About 2 hrs 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 mediaUploadMapper has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const mediaUploadMapper = (params: any) => {
                        Object.keys(params).map((item) => {
                          if (params[item]) {
                            const param = params[item].fileList;
                            const isMediaField = Array.isArray(param);
                      Severity: Minor
                      Found in packages/strapi-v4/src/helpers/normalize.ts - About 2 hrs 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 reorderImports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const reorderImports = (content: string): string => {
                        let newContent = content;
                        // imports can have comments before them, we need to preserve those comments and import statements.
                        // so we need to filter out the imports with comments before.
                        const allImports = getImports(content);
                      Severity: Minor
                      Found in packages/cli/src/utils/swizzle/import.ts - About 2 hrs 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 useResource has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function useResource(
                        args?: UseResourceLegacyProps | UseResourceParam,
                      ): UseResourceReturnType {
                        const { resources } = useContext(ResourceContext);
                      
                      
                      Severity: Minor
                      Found in packages/core/src/hooks/resource/useResource/index.ts - About 2 hrs 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 useCode has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const useCode = (): UseCodeReturn => {
                        const { query, isReady } = useRouter();
                        const {
                          code: encoded,
                          hash,
                      Severity: Major
                      Found in packages/live-previews/src/utils/use-code.ts - About 2 hrs to fix

                        Function convertToLegacy has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function convertToLegacy(segments: KeySegment[]) {
                          // for `list`, `many` and `one`
                          if (segments[0] === "data") {
                            // [data, dpName, resource, action, ...];
                            const newSegments = segments.slice(1);
                        Severity: Major
                        Found in packages/core/src/definitions/helpers/keys/index.ts - About 2 hrs to fix

                          Function generateFilter has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const generateFilter = (filter: CrudFilter, query: any) => {
                            switch (filter.operator) {
                              case "eq":
                                return query.eq(filter.field, filter.value);
                              case "ne":
                          Severity: Major
                          Found in packages/supabase/src/utils/generateFilter.ts - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language