pankod/refine

View on GitHub

Showing 756 of 987 total issues

Function relationHooksCode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    .map((field) => {
      if (field?.relation && !field.fieldable && field.resource) {
        imports.push(["GetManyResponse", "@refinedev/core"]);
        imports.push(["useMany", "@refinedev/core"]);

Severity: Minor
Found in packages/inferencer/src/inferencers/mantine/list.tsx - About 1 hr to fix

    Function mapped has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const mapped: Array<InferField> = fields.map((field) => {
        if (
          !field.relation &&
          (field.type === "text" ||
            field.type === "richtext" ||
    Severity: Minor
    Found in packages/inferencer/src/field-transformers/basic-to-relation.ts - About 1 hr to fix

      Function ThemedHeader has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const ThemedHeader: React.FC<RefineThemedLayoutHeaderProps> = () => {
        const theme = useMantineTheme();
      
        const authProvider = useActiveAuthProvider();
        const { data: user } = useGetIdentity({
      Severity: Minor
      Found in packages/mantine/src/components/themedLayout/header/index.tsx - About 1 hr to fix

        Function richtextFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const richtextFields = (field: InferField) => {
            if (field.type === "richtext") {
              imports.push(["Textarea", "@mantine/core"]);
        
              initialValues = {
        Severity: Minor
        Found in packages/inferencer/src/inferencers/mantine/edit.tsx - About 1 hr to fix

          Function relationHooksCode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              .map((field) => {
                if (field?.relation && !field.fieldable && field.resource) {
                  imports.push(["GetManyResponse", "@refinedev/core"]);
                  imports.push(["useMany", "@refinedev/core"]);
          
          
          Severity: Minor
          Found in packages/inferencer/src/inferencers/headless/list.tsx - About 1 hr to fix

            Function relationHooksCode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                .map((field) => {
                  if (field?.relation && !field.fieldable && field.resource) {
                    imports.push(["GetManyResponse", "@refinedev/core"]);
                    imports.push(["useMany", "@refinedev/core"]);
            
            
            Severity: Minor
            Found in packages/inferencer/src/inferencers/chakra-ui/list.tsx - About 1 hr to fix

              Function booleanFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const booleanFields = (field: InferField) => {
                  if (field.type === "boolean") {
                    if (field.multiple) {
                      const val = accessor("item", undefined, field.accessor);
                      return jsx`
              Severity: Minor
              Found in packages/inferencer/src/inferencers/headless/show.tsx - About 1 hr to fix

                Function booleanFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const booleanFields = (field: InferField) => {
                    if (field.type === "boolean") {
                      imports.push(["Checkbox", "@mantine/core"]);
                
                      initialValues = {
                Severity: Minor
                Found in packages/inferencer/src/inferencers/mantine/edit.tsx - About 1 hr to fix

                  Function textFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const textFields = (field: InferField) => {
                      if (field.type === "text") {
                        if (field.multiple) {
                          const val = accessor("item", undefined, field.accessor);
                          return jsx`
                  Severity: Minor
                  Found in packages/inferencer/src/inferencers/headless/show.tsx - About 1 hr to fix

                    Function placement has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const placement = React.useMemo(() => {
                        const tooltipBaseSize = { width: 22, height: 22 };
                        const nameWidth = name.length * 7.5;
                        const tooltipSize = {
                          width: tooltipBaseSize.width + nameWidth,
                    Severity: Minor
                    Found in packages/devtools/src/components/selectable-elements.tsx - About 1 hr to fix

                      Function CommandBar has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const CommandBar: React.FC = () => {
                        const searchStyle = {
                          padding: "12px 16px",
                          fontSize: "16px",
                          width: "100%",
                      Severity: Minor
                      Found in packages/kbar/src/components/commandBar/index.tsx - About 1 hr to fix

                        Function parse has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          parse: () => {
                            let params = useParams();
                            const { pathname, search } = useLocation();
                            const { resources } = useContext(ResourceContext);
                        
                        
                        Severity: Minor
                        Found in packages/react-router-v6/src/bindings.tsx - About 1 hr to fix

                          Function getOperationFields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const getOperationFields = (documentNode: DocumentNode) => {
                            const fieldLines: string[] = [];
                            let isInitialEnter = true;
                            let depth = 0;
                            let isNestedField = false;
                          Severity: Minor
                          Found in packages/nestjs-query/src/utils/graphql.ts - About 1 hr to fix

                            Function transformCrudFiltersToFilterModel has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const transformCrudFiltersToFilterModel = (
                              crudFilters: CrudFilters,
                              columnsType?: Record<string, string>,
                            ): GridFilterModel | undefined => {
                              const gridFilterItems: GridFilterItem[] = [];
                            Severity: Minor
                            Found in packages/mui/src/definitions/dataGrid/index.ts - About 1 hr to fix

                              Function useRefineContext has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useRefineContext = () => {
                                const {
                                  Footer,
                                  Header,
                                  Layout,
                              Severity: Minor
                              Found in packages/core/src/hooks/refine/useRefineContext.ts - About 1 hr to fix

                                Function serveProxy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const serveProxy = async (app: Express) => {
                                  let { token, jwt } = await loadAuth();
                                
                                  const authProxy = createProxyMiddleware({
                                    target: REFINE_API_URL,
                                Severity: Minor
                                Found in packages/devtools-server/src/serve-proxy.ts - About 1 hr 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 List has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const List: React.FC<ListProps> = ({
                                  canCreate,
                                  title,
                                  children,
                                  createButtonProps: createButtonPropsFromProps,
                                Severity: Minor
                                Found in packages/antd/src/components/crud/list/index.tsx - About 1 hr 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 go has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  go: () => {
                                    const { search: existingSearch, hash: existingHash } = useLocation();
                                    const navigate = useNavigate();
                                
                                    const fn = useCallback(
                                Severity: Minor
                                Found in packages/remix-router/src/bindings.tsx - About 1 hr 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 List has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const List: React.FC<ListProps> = (props) => {
                                  const {
                                    canCreate,
                                    children,
                                    createButtonProps: createButtonPropsFromProps,
                                Severity: Minor
                                Found in packages/mantine/src/components/crud/list/index.tsx - About 1 hr 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 SelectableElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const SelectableElement = ({
                                  element,
                                  name,
                                  onSelect,
                                }: {
                                Severity: Minor
                                Found in packages/devtools/src/components/selectable-elements.tsx - About 1 hr 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