pankod/refine

View on GitHub

Showing 750 of 983 total issues

Function transformer has 83 lines of code (exceeds 25 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: Major
Found in packages/cli/src/transformers/resource.ts - About 3 hrs to fix

    Function useResource has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function useResource(
      args?: UseResourceLegacyProps | UseResourceParam,
    ): UseResourceReturnType {
      const { resources } = useContext(ResourceContext);
    
    
    Severity: Major
    Found in packages/core/src/hooks/resource/useResource/index.ts - About 3 hrs to fix

      Function bootstrap has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const bootstrap = () => {
        const packageJson = JSON.parse(
          readFileSync(`${__dirname}/../package.json`, "utf8"),
        );
      
      
      Severity: Major
      Found in packages/create-refine-app/src/index.ts - About 3 hrs to fix

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

        export function useDataGrid<
          TQueryFnData extends BaseRecord = BaseRecord,
          TError extends HttpError = HttpError,
          TSearchVariables = unknown,
          TData extends BaseRecord = TQueryFnData,
        Severity: Minor
        Found in packages/mui/src/hooks/useDataGrid/index.ts - 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 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 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 DevToolsApp has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const DevToolsApp = () => {
                  return (
                    <DevToolsContextProvider __devtools>
                      <ReloadOnChanges />
                      <BrowserRouter>
                Severity: Major
                Found in packages/devtools-ui/src/devtools.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 Create has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const Create: React.FC<CreateProps> = ({
                      title,
                      children,
                      saveButtonProps: saveButtonPropsFromProps,
                      resource: resourceFromProps,
                    Severity: Minor
                    Found in packages/mui/src/components/crud/create/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 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 renderTreeView has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const renderTreeView = (tree: ITreeMenu[]) => {
                              return tree.map((item) => {
                                const { label, route, name, icon, children } = item;
                          
                                const isSelected = item.key === selectedKey;
                          Severity: Major
                          Found in packages/chakra-ui/src/components/layout/sider/index.tsx - 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 Create has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const Create: React.FC<CreateProps> = (props) => {
                                const {
                                  children,
                                  saveButtonProps: saveButtonPropsFromProps,
                                  isLoading,
                              Severity: Minor
                              Found in packages/mantine/src/components/crud/create/index.tsx - 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 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

                              Severity
                              Category
                              Status
                              Source
                              Language