hadmean/hadmean

View on GitHub

Showing 419 of 427 total issues

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

            <EntityTableTabForm
              initialValues={tableViews.data}
              onSubmit={upsertTableViewsMutation.mutateAsync}
              tableColumns={tableColumns.data || []}
            />
Severity: Minor
Found in src/frontend/views/entity/Views/index.tsx and 1 other location - About 30 mins to fix
src/frontend/views/entity/PersistentQuery/index.tsx on lines 64..68

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

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"]);

    return await entitiesApiService.getEntityFields(validatedRequest.entity);
Severity: Minor
Found in src/pages/api/entities/[entity]/fields.ts and 1 other location - About 30 mins to fix
src/pages/api/entities/[entity]/relation-list.ts on lines 6..14

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

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

      UPSERT: (submitting: boolean) =>
        submitting ? msg`Saving ${singular}` : msg`Save ${singular}`,
Severity: Minor
Found in src/frontend/lib/crud-config/index.ts and 2 other locations - About 30 mins to fix
src/frontend/lib/crud-config/index.ts on lines 42..43
src/frontend/lib/crud-config/index.ts on lines 44..45

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

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

    return Object.fromEntries(
      items.map(({ key, value }) => [key, JSON.parse(value)])
    );
src/backend/lib/config-persistence/DatabaseConfigDataPersistenceAdaptor.ts on lines 75..77

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

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

const Template: Story<IProps> = (args) => (
  <ApplicationRoot>
    <Breadcrumbs {...args} />
  </ApplicationRoot>
);
Severity: Major
Found in src/frontend/design-system/components/Breadcrumbs/Stories.tsx and 14 other locations - About 30 mins to fix
src/frontend/design-system/components/Alert/Stories.tsx on lines 17..21
src/frontend/design-system/components/Button/Stories.tsx on lines 14..18
src/frontend/design-system/components/EmptyWrapper/Stories.tsx on lines 17..21
src/frontend/design-system/components/Form/FormFileInput/Stories.tsx on lines 19..23
src/frontend/design-system/components/Form/FormSwitch/Stories.tsx on lines 27..31
src/frontend/design-system/components/Section/MenuSection/Stories.tsx on lines 45..49
src/frontend/design-system/components/Section/SectionBox/Stories.tsx on lines 17..21
src/frontend/design-system/components/Skeleton/Base/Stories.tsx on lines 13..17
src/frontend/design-system/components/Skeleton/Form/Stories.tsx on lines 20..24
src/frontend/design-system/components/Skeleton/List/Stories.tsx on lines 15..19
src/frontend/design-system/components/Skeleton/Table/Stories.tsx on lines 13..17
src/frontend/design-system/components/Toasts/Stories.tsx on lines 28..32
src/frontend/design-system/components/Widgets/Summary/Stories.tsx on lines 28..32
src/frontend/design-system/components/Tabs/Stories.tsx on lines 38..42

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

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

  {
    GET: async (getValidatedRequest) => {
      const validatedRequest = await getValidatedRequest(["entity"]);

      return await entitiesApiController.listAllEntityRelations(
Severity: Minor
Found in src/pages/api/entities/[entity]/relation-list.ts and 1 other location - About 30 mins to fix
src/pages/api/entities/[entity]/fields.ts on lines 4..10

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

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

  useEffect(() => {
    if (storageCredentialsConfiguration.error) {
      ToastService.error(storageCredentialsConfiguration.error);
    }
  }, [storageCredentialsConfiguration.error]);
Severity: Minor
Found in src/frontend/views/integrations/storage/Credentials.tsx and 1 other location - About 30 mins to fix
src/frontend/views/integrations/actions/View/Configure.tsx on lines 30..34

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

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

> = async (req, ignoreFieldsValidation) => {
  const take = Number(req.query.take) || 10;
  const page = Number(req.query.page) || 1;

  const orderBy = req.query.orderBy === "desc" ? "desc" : "asc";
Severity: Minor
Found in src/backend/lib/request/validations/implementations/pagination-filter.ts - About 25 mins 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 useEntityViewStateMachine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useEntityViewStateMachine = ({
  crudAction,
  entity,
  error,
  isLoading,
Severity: Minor
Found in src/frontend/views/data/hooks/useEntityViewStateMachine.ts - About 25 mins 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 doesPermissionAllowPermission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const doesPermissionAllowPermission = (
  permissions: string[],
  requiredPermission: string,
  checkGranular: boolean
): boolean => {
Severity: Minor
Found in src/shared/logic/permissions/index.ts - About 25 mins 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 BaseEntityForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function BaseEntityForm({
  entity,
  initialValuesData,
  crudAction,
  allOptional,
Severity: Minor
Found in src/frontend/views/data/_BaseEntityForm.tsx - About 25 mins 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 BaseManageDashboardWidget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function BaseManageDashboardWidget({ onSave, action }: IProps) {
  const dashboardId = useRouteParam("dashboardId");
  const widgetId = useRouteParam("widgetId");
  const activeEntities = useActiveEntities();
  const widgets = useDashboardWidgets(dashboardId);
Severity: Minor
Found in src/frontend/views/Dashboard/Widget/_manage/index.tsx - About 25 mins 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 buildFilterConfigFromType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const buildFilterConfigFromType = (prop: {
  entityType: FormFieldTypes;
  entityFieldSelections: IColorableSelection[];
  isIdField: boolean;
  referenceField?: string;
Severity: Minor
Found in src/frontend/views/data/Table/useTableColumns.tsx - About 25 mins 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 useFEPagination has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function useFEPagination<T>(
  endPoint: string,
  dataState: IPaginatedDataState<T>
): UseQueryResult<PaginatedData<T>> {
  return useQuery<PaginatedData<T>>({
Severity: Minor
Found in src/frontend/components/FEPaginationTable/useFEPagination.ts - About 25 mins 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 RenderFormInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function RenderFormInput(props: IRenderFormInputProps) {
  const {
    formProps: formProps$1,
    label,
    type,
Severity: Minor
Found in src/frontend/components/SchemaForm/_RenderFormInput.tsx - About 25 mins 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 useDomainMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useDomainMessages = ({
  singular: singular$1,
  plural: plural$1,
}: IDomainDiction) => {
  const { _ } = useLingui();
Severity: Minor
Found in src/frontend/lib/crud-config/index.ts - About 25 mins 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 getColorModeImplementation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const getColorModeImplementation = (
  colorMode?: ColorSchemes | IColorMode
): IColorMode => {
  if (!colorMode) {
    return window.matchMedia("(prefers-color-scheme: dark)").matches
Severity: Minor
Found in src/frontend/design-system/theme/useTheme.ts - About 25 mins 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 getBestErrorMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getBestErrorMessage = (
  errorResponse:
    | string
    | { message?: string; response?: { data?: { message?: string } } },
  defaultErrorMessage?: string
Severity: Minor
Found in src/frontend/lib/toast/utils.ts - About 25 mins 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 filterOutUserMenuItems has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async filterOutUserMenuItems(
    userRole: string,
    menuItems: INavigationMenuItem[]
  ): Promise<INavigationMenuItem[]> {
    const allowedMenuItems: INavigationMenuItem[] = [];
Severity: Minor
Found in src/backend/menu/menu.service.ts - About 25 mins 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