dashpresshq/dashpress

View on GitHub

Showing 165 of 459 total issues

Function CRUDDocumentation has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function CRUDDocumentation() {
  return (
    <DocumentationRoot>
      <p>
        This setting generally allows you to disable CRUD functionalities and
Severity: Major
Found in src/frontend/docs/crud.tsx - About 2 hrs to fix

    File select.tsx has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import type { MessageDescriptor } from "@lingui/core";
    import { msg } from "@lingui/macro";
    import { useLingui } from "@lingui/react";
    import * as SelectPrimitive from "@radix-ui/react-select";
    import * as React from "react";
    Severity: Minor
    Found in src/frontend/components/ui/select.tsx - About 2 hrs to fix

      Function UsersLinkToDatabaseDocumentation has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function UsersLinkToDatabaseDocumentation() {
        return (
          <DocumentationRoot>
            <p>
              Linking your DashPress users to your database allows you to write
      Severity: Major
      Found in src/frontend/docs/users-link-to-database.tsx - About 2 hrs to fix

        Function DateSettings has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function DateSettings() {
          const domainMessages = useAppConfigurationDomainMessages(
            "default_date_format"
          );
        
        
        Severity: Major
        Found in src/frontend/views/settings/Data/index.tsx - About 2 hrs to fix

          Function EntityRelationTable has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function EntityRelationTable() {
            const parentEntity = useEntitySlug();
            const entityId = useEntityId();
            const { _ } = useLingui();
            const childEntity = useRouteParam("childEntity");
          Severity: Major
          Found in src/frontend/views/data/Details/RelationsTable.tsx - About 2 hrs to fix

            Function RolePermissions has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function RolePermissions() {
              const activeEntities = useActiveEntities();
              const portalPermission = usePortalExtendedPermissions();
              const rolePermissions = useRolePermissions();
              const portalUserPermissions = usePortalUserPermissions();
            Severity: Major
            Found in src/frontend/views/roles/Permissions/index.tsx - About 2 hrs to fix

              Function useEntityFieldValidations has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function useEntityFieldValidations(entity: string) {
                const entityValidationsMap = useEntityConfiguration(
                  "entity_validations",
                  entity
                );
              Severity: Major
              Found in src/frontend/hooks/entity/entity.config.ts - About 2 hrs to fix

                Function ViewsDocumentation has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function ViewsDocumentation() {
                  return (
                    <DocumentationRoot>
                      <p>
                        Views enable you to implement query tabs. Say you have an{" "}
                Severity: Major
                Found in src/frontend/docs/views.tsx - About 2 hrs to fix

                  Function select has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      select: (data: any) => {
                        let returnData: T[] = data as unknown as T[];
                        if (dataState.filters) {
                          returnData = returnData.filter((datum) => {
                            return dataState.filters.every(($filter) => {
                  Severity: Major
                  Found in src/frontend/components/app/pagination-table/useFEPagination.ts - About 2 hrs to fix

                    File Form.tsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import type { MessageDescriptor } from "@lingui/core";
                    import { msg } from "@lingui/macro";
                    import arrayMutators from "final-form-arrays";
                    import { Fragment } from "react";
                    import { Field, Form, useField } from "react-final-form";
                    Severity: Minor
                    Found in src/frontend/views/entity/PersistentQuery/Form.tsx - About 2 hrs to fix

                      Function useNavigationStack has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const useNavigationStack = () => {
                        const router = useRouter();
                        const { _ } = useLingui();
                      
                        const [history, setHistory] = useNavigationHistoryStore((store) => [
                      Severity: Major
                      Found in src/frontend/lib/routing/useNavigationStack.ts - About 2 hrs to fix

                        Function SystemSettings has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function SystemSettings() {
                          const systemSettings = useAppConfiguration("system_settings");
                          const domainMessages = useAppConfigurationDomainMessages("system_settings");
                        
                          const documentationActionButton = useDocumentationActionButton(
                        Severity: Major
                        Found in src/frontend/views/settings/System/index.tsx - About 2 hrs to fix

                          Function formatIntrospectData has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private formatIntrospectData(rawEntity: Entity[]): IDBSchema[] {
                              const dbSchema = rawEntity
                                .filter(({ name }) => !name.startsWith("dashpress"))
                                .map((entity) => {
                                  return {
                          Severity: Minor
                          Found in src/backend/schema/schema.service.ts - About 2 hrs to fix

                            Function parseForm has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export async function parseForm(
                              req: NextApiRequest
                            ): Promise<{ fields: formidable.Fields; files: formidable.Files }> {
                              const fileUploadSettings = await configurationApiService.show(
                                "file_upload_settings"
                            Severity: Minor
                            Found in src/backend/uploads/parse.ts - About 1 hr to fix

                              Function EntitiesSettings has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function EntitiesSettings() {
                                const domainMessages = useAppConfigurationDomainMessages("disabled_entities");
                                const entitiesList = useEntitiesList();
                              
                                useSetPageDetails({
                              Severity: Minor
                              Found in src/frontend/views/settings/Entities/index.tsx - About 1 hr to fix

                                Function viewSpecialDataTypes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const viewSpecialDataTypes = ({
                                  fieldName,
                                  value,
                                  entityToOneReferenceFields = {},
                                  entityFieldSelections = {},
                                Severity: Minor
                                Found in src/frontend/views/data/viewSpecialDataTypes.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 EntityDetails has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function EntityDetails() {
                                  const entityId = useEntityId();
                                  const entity = useEntitySlug();
                                  const entityCrudConfig = useEntityCrudConfig(entity);
                                  const dataDetails = useEntityDataDetails({ entity, entityId });
                                Severity: Minor
                                Found in src/frontend/views/data/Details/index.tsx - About 1 hr to fix

                                  Function useApiMutateOptimisticOptions has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function useApiMutateOptimisticOptions<T, V, R = void>(
                                    options: IApiMutateOptions<T, V, R>
                                  ) {
                                    const apiMutate = useApiMutate<T>(options.dataQueryPath);
                                    const queryClient = useQueryClient();
                                  Severity: Minor
                                  Found in src/frontend/lib/data/useMutate/useApiMutateOptimisticOptions.ts - About 1 hr to fix

                                    Function reducer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const reducer = (state: State, action: Action): State => {
                                      switch (action.type) {
                                        case "ADD_TOAST":
                                          return {
                                            ...state,
                                    Severity: Minor
                                    Found in src/frontend/components/app/toast/use-toast.ts - About 1 hr to fix

                                      Function TableViewsSettings has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export function TableViewsSettings() {
                                        const entity = useEntitySlug();
                                        const domainMessages = useAppConfigurationDomainMessages("table_views");
                                      
                                        const upsertTableViewsMutation = useUpsertConfigurationMutation(
                                      Severity: Minor
                                      Found in src/frontend/views/entity/Views/index.tsx - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language