dashpresshq/dashpress

View on GitHub

Showing 459 of 459 total issues

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

          <Field name="code" validateFields={[]} validate={required}>
            {(formProps) => (
              <FormCodeEditor
                language="javascript"
                label={fakeMessageDescriptor("Javascript")}
Severity: Major
Found in src/frontend/components/app/form/input/Stories.tsx and 2 other locations - About 1 hr to fix
src/frontend/components/app/form/input/Stories.tsx on lines 97..105
src/frontend/components/app/form/input/Stories.tsx on lines 202..210

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 65.

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 3 locations. Consider refactoring.
Open

          <Field name="asyncSelect" validateFields={[]} validate={required}>
            {(formProps) => (
              <AsyncFormSelect
                url="http://localhost:3000/roles"
                label={fakeMessageDescriptor("Async Select Input")}
Severity: Major
Found in src/frontend/components/app/form/input/Stories.tsx and 2 other locations - About 1 hr to fix
src/frontend/components/app/form/input/Stories.tsx on lines 97..105
src/frontend/components/app/form/input/Stories.tsx on lines 299..307

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 65.

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 const useEntityReferenceFields = (entity: string) =>
  useApi<IEntityRelation[]>(ENTITY_RELATIONS_ENDPOINT(entity), {
    errorMessage: CRUD_CONFIG_NOT_FOUND(`Entity Reference Fields`),
    defaultData: [],
    enabled: !!entity,
Severity: Major
Found in src/frontend/hooks/entity/entity.store.ts and 1 other location - About 1 hr to fix
src/frontend/hooks/entity/entity.store.ts on lines 43..48

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 65.

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 const useEntityFields = (entity: string) =>
  useApi<IEntityField[]>(ENTITY_FIELDS_ENDPOINT(entity), {
    errorMessage: CRUD_CONFIG_NOT_FOUND(`Entity Fields`),
    defaultData: [],
    enabled: !!entity,
Severity: Major
Found in src/frontend/hooks/entity/entity.store.ts and 1 other location - About 1 hr to fix
src/frontend/hooks/entity/entity.store.ts on lines 65..70

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 65.

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 3 locations. Consider refactoring.
Open

          <Field name="descriptionText" validateFields={[]} validate={required}>
            {(formProps) => (
              <FormInput
                description="Some Description here"
                label={fakeMessageDescriptor("With description")}
Severity: Major
Found in src/frontend/components/app/form/input/Stories.tsx and 2 other locations - About 1 hr to fix
src/frontend/components/app/form/input/Stories.tsx on lines 202..210
src/frontend/components/app/form/input/Stories.tsx on lines 299..307

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 65.

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 getEntitySelectionConfig has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const getEntitySelectionConfig = (
  entityType: EntityTypesForSelection,
  preSelectedType: IColorableSelection[],
  enumList$1: string[]
): IColorableSelection[] => {
Severity: Minor
Found in src/shared/logic/entities/getEntitySelectionConfig.ts - About 1 hr to fix

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

              <DateSelection
                setFilter={setFilter}
                filterValue={filterValue}
                field="value"
                defaultValue={DATE_FILTER_VALUE.BEGINNING_OF_TIME_VALUE}
    Severity: Major
    Found in src/frontend/components/app/table/filters/Date/index.tsx and 1 other location - About 1 hr to fix
    src/frontend/components/app/table/filters/Date/index.tsx on lines 73..81

    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 64.

    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

              <DateSelection
                setFilter={setFilter}
                filterValue={filterValue}
                field="value2"
                defaultValue={DATE_FILTER_VALUE.NOW}
    Severity: Major
    Found in src/frontend/components/app/table/filters/Date/index.tsx and 1 other location - About 1 hr to fix
    src/frontend/components/app/table/filters/Date/index.tsx on lines 64..72

    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 64.

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

    export const useTableColumns = (
      entity: string
    ): Partial<DataStateKeys<ITableColumn[]>> => {
      const portalTableColumns = usePortalTableColumns(entity);
      const getEntityFieldLabels = useEntityFieldLabels(entity);
    Severity: Minor
    Found in src/frontend/views/data/Table/useTableColumns.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 useWaitForResponseMutationOptions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export function useWaitForResponseMutationOptions<V, R = void>(
      options: IWaitForResponseMutationOptions<V, R>
    ) {
      const queryClient = useQueryClient();
      const { toast } = useToast();

    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 runFormAction has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const runFormAction = async (
      entity: string,
      dataEventAction: DataEventActions,
      getData: () => Promise<Record<string, unknown>>,
      authProfile: IAccountProfile
    Severity: Minor
    Found in src/backend/form-actions/run-form-action.ts - About 1 hr to fix

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

                <Field name="disabled" validateFields={[]} validate={required}>
                  {(formProps) => (
                    <FormInput
                      label={fakeMessageDescriptor("Disabled Text Input")}
                      {...formProps}
      Severity: Major
      Found in src/frontend/components/app/form/input/Stories.tsx and 4 other locations - About 1 hr to fix
      src/frontend/components/app/form/input/Stories.tsx on lines 232..240
      src/frontend/components/app/form/input/Stories.tsx on lines 251..259
      src/frontend/components/app/form/input/Stories.tsx on lines 270..278
      src/frontend/components/app/form/input/Stories.tsx on lines 289..297

      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 63.

      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

                <Field name="dateInput" validateFields={[]} validate={required}>
                  {(formProps) => (
                    <FormDateInput
                      label={fakeMessageDescriptor("Disabled Date Input")}
                      {...formProps}
      Severity: Major
      Found in src/frontend/components/app/form/input/Stories.tsx and 4 other locations - About 1 hr to fix
      src/frontend/components/app/form/input/Stories.tsx on lines 77..85
      src/frontend/components/app/form/input/Stories.tsx on lines 251..259
      src/frontend/components/app/form/input/Stories.tsx on lines 270..278
      src/frontend/components/app/form/input/Stories.tsx on lines 289..297

      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 63.

      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

                <Field name="numberInput" validateFields={[]} validate={required}>
                  {(formProps) => (
                    <FormNumberInput
                      label={fakeMessageDescriptor("Disabled Number Input")}
                      {...formProps}
      Severity: Major
      Found in src/frontend/components/app/form/input/Stories.tsx and 4 other locations - About 1 hr to fix
      src/frontend/components/app/form/input/Stories.tsx on lines 77..85
      src/frontend/components/app/form/input/Stories.tsx on lines 232..240
      src/frontend/components/app/form/input/Stories.tsx on lines 270..278
      src/frontend/components/app/form/input/Stories.tsx on lines 289..297

      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 63.

      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 useApi has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function useApi<T>(endPoint: string, options: IUseApiOptions<T>) {
        const isRestoring = useIsRestoring();
      
        const builtOptions = buildApiOptions(options);
        const router = useRouter();
      Severity: Minor
      Found in src/frontend/lib/data/useApi/index.ts - About 1 hr to fix

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

                  <Field name="textArea" validateFields={[]} validate={required}>
                    {(formProps) => (
                      <FormTextArea
                        label={fakeMessageDescriptor("Disabled Text Area Input")}
                        {...formProps}
        Severity: Major
        Found in src/frontend/components/app/form/input/Stories.tsx and 4 other locations - About 1 hr to fix
        src/frontend/components/app/form/input/Stories.tsx on lines 77..85
        src/frontend/components/app/form/input/Stories.tsx on lines 232..240
        src/frontend/components/app/form/input/Stories.tsx on lines 251..259
        src/frontend/components/app/form/input/Stories.tsx on lines 289..297

        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 63.

        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

                  <Field name="richText" validateFields={[]} validate={required}>
                    {(formProps) => (
                      <FormRichTextArea
                        label={fakeMessageDescriptor("Disabled Rich Text")}
                        {...formProps}
        Severity: Major
        Found in src/frontend/components/app/form/input/Stories.tsx and 4 other locations - About 1 hr to fix
        src/frontend/components/app/form/input/Stories.tsx on lines 77..85
        src/frontend/components/app/form/input/Stories.tsx on lines 232..240
        src/frontend/components/app/form/input/Stories.tsx on lines 251..259
        src/frontend/components/app/form/input/Stories.tsx on lines 270..278

        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 63.

        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 getDbInstance has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async getDbInstance(): Promise<Knex> {
            if (DatabaseConfigDataPersistenceAdaptor._dbInstance) {
              return DatabaseConfigDataPersistenceAdaptor._dbInstance;
            }
        
        

          Function validations has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                typescriptSafeObjectDotEntries(fields).map(([field, config]) => {
                  const validationsToRun = config.validations || [];
          
                  const firstFailedValidation = validationsToRun.find((validation) =>
                    ENTITY_VALIDATION_CONFIG[validation.validationType]?.implementation(
          Severity: Minor
          Found in src/shared/validations/run.ts - About 1 hr to fix

            Function CredentialsSetup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const CredentialsSetup: CustomNextPage = () => {
              const setupCredentialsMutation = useSetupCredentialsMutation();
            
              const isChecking = useSetupCheck([
                {
            Severity: Minor
            Found in src/frontend/views/setup/Credentials/index.tsx - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language