dashpresshq/dashpress

View on GitHub

Showing 459 of 459 total issues

Similar blocks of code found in 11 locations. Consider refactoring.
Open

const CardHeader = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
Severity: Major
Found in src/frontend/components/ui/card.tsx and 10 other locations - About 2 hrs to fix
src/frontend/components/ui/card.tsx on lines 5..14
src/frontend/components/ui/card.tsx on lines 46..55
src/frontend/components/ui/card.tsx on lines 58..67
src/frontend/components/ui/table.tsx on lines 19..31
src/frontend/components/ui/table.tsx on lines 34..39
src/frontend/components/ui/table.tsx on lines 42..51
src/frontend/components/ui/table.tsx on lines 54..66
src/frontend/components/ui/table.tsx on lines 69..81
src/frontend/components/ui/table.tsx on lines 84..96
src/frontend/components/ui/table.tsx on lines 99..108

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 76.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 11 locations. Consider refactoring.
Open

const TableCaption = React.forwardRef<
  HTMLTableCaptionElement,
  React.HTMLAttributes<HTMLTableCaptionElement>
>(({ className, ...props }, ref) => (
  <caption
Severity: Major
Found in src/frontend/components/ui/table.tsx and 10 other locations - About 2 hrs to fix
src/frontend/components/ui/card.tsx on lines 5..14
src/frontend/components/ui/card.tsx on lines 17..29
src/frontend/components/ui/card.tsx on lines 46..55
src/frontend/components/ui/card.tsx on lines 58..67
src/frontend/components/ui/table.tsx on lines 19..31
src/frontend/components/ui/table.tsx on lines 34..39
src/frontend/components/ui/table.tsx on lines 42..51
src/frontend/components/ui/table.tsx on lines 54..66
src/frontend/components/ui/table.tsx on lines 69..81
src/frontend/components/ui/table.tsx on lines 84..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 76.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const BreadcrumbItem = React.forwardRef<
  HTMLLIElement,
  React.ComponentPropsWithoutRef<"li">
>(({ className, ...props }, ref) => (
  <li
Severity: Major
Found in src/frontend/components/ui/breadcrumb.tsx and 1 other location - About 2 hrs to fix
src/frontend/components/ui/breadcrumb.tsx on lines 15..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 76.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export default requestHandler({
            GET: async (getValidatedRequest) => {
              const validatedRequest = await getValidatedRequest([
                "entity",
                "entityId",
          Severity: Major
          Found in src/pages/api/data/[entity]/[id]/reference.ts and 1 other location - About 1 hr to fix
          src/pages/api/data/[entity]/count.ts on lines 5..20

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 73.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export default requestHandler({
            GET: async (getValidatedRequest) => {
              const validatedRequest = await getValidatedRequest([
                "entity",
                "queryFilters",
          Severity: Major
          Found in src/pages/api/data/[entity]/count.ts and 1 other location - About 1 hr to fix
          src/pages/api/data/[entity]/[id]/reference.ts on lines 5..21

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 73.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  POST: async (getValidatedRequest) => {
                    const validatedRequest = await getValidatedRequest([
                      { _type: "requestQuery", options: REQUEST_QUERY_FIELD },
                      { _type: "requestBody", options: {} },
                    ]);
              Severity: Major
              Found in src/pages/api/dashboards/[dashboardId]/index.ts and 4 other locations - About 1 hr to fix
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 31..40
              src/pages/api/form-actions/[key].ts on lines 21..37
              src/pages/api/integrations/actions/[key]/index.ts on lines 9..25
              src/pages/api/roles/[roleId]/permissions.ts on lines 35..50

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 72.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  POST: async (getValidatedRequest) => {
                    const validatedRequest = await getValidatedRequest([
                      {
                        _type: "requestQuery",
                        options: REQUEST_KEY_FIELD,
              Severity: Major
              Found in src/pages/api/integrations/actions/[key]/index.ts and 4 other locations - About 1 hr to fix
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 21..30
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 31..40
              src/pages/api/form-actions/[key].ts on lines 21..37
              src/pages/api/roles/[roleId]/permissions.ts on lines 35..50

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 72.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  POST: async (getValidatedRequest) => {
                    const validatedRequest = await getValidatedRequest([
                      {
                        _type: "requestQuery",
                        options: REQUEST_QUERY_FIELD,
              Severity: Major
              Found in src/pages/api/roles/[roleId]/permissions.ts and 4 other locations - About 1 hr to fix
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 21..30
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 31..40
              src/pages/api/form-actions/[key].ts on lines 21..37
              src/pages/api/integrations/actions/[key]/index.ts on lines 9..25

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 72.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  PATCH: async (getValidatedRequest) => {
                    const validatedRequest = await getValidatedRequest([
                      {
                        _type: "requestQuery",
                        options: REQUEST_KEY_FIELD,
              Severity: Major
              Found in src/pages/api/form-actions/[key].ts and 4 other locations - About 1 hr to fix
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 21..30
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 31..40
              src/pages/api/integrations/actions/[key]/index.ts on lines 9..25
              src/pages/api/roles/[roleId]/permissions.ts on lines 35..50

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 72.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  PATCH: async (getValidatedRequest) => {
                    const validatedRequest = await getValidatedRequest([
                      { _type: "requestQuery", options: REQUEST_QUERY_FIELD },
                      { _type: "requestBody", options: {} },
                    ]);
              Severity: Major
              Found in src/pages/api/dashboards/[dashboardId]/index.ts and 4 other locations - About 1 hr to fix
              src/pages/api/dashboards/[dashboardId]/index.ts on lines 21..30
              src/pages/api/form-actions/[key].ts on lines 21..37
              src/pages/api/integrations/actions/[key]/index.ts on lines 9..25
              src/pages/api/roles/[roleId]/permissions.ts on lines 35..50

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 72.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

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

                  export function FormSelectButton(formInput: IFormSelect) {
                    const { input, selectData, disabled, size } = formInput;
                  
                    const { _ } = useLingui();
                    return (
                  Severity: Minor
                  Found in src/frontend/components/app/form/input/select-button.tsx - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language