dashpresshq/dashpress

View on GitHub

Showing 459 of 459 total issues

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

    <ViewStateMachine
      loading={isLoading}
      error={error}
      loader={<FormSkeleton schema={[FormSkeletonSchema.RichTextArea]} />}
    >
Severity: Minor
Found in src/frontend/views/entity/Form/ScriptForm.tsx and 1 other location - About 30 mins to fix
src/frontend/views/entity/Relations/index.tsx on lines 144..154

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 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 77..79

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 43..44
src/frontend/lib/crud-config/index.ts on lines 45..46

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

export function DropDownMenu({
  menuItems: menuItems$1,
  ellipsis,
  ariaLabel,
  contentClassName,
Severity: Minor
Found in src/frontend/components/app/drop-drop-menu/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 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/app/form/schema/_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 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 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 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 SectionBox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function SectionBox({
  children,
  title,
  isLoading,
  description,
Severity: Minor
Found in src/frontend/components/app/section-box/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 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/app/pagination-table/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 Presentation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function Presentation({
  isSubmitting,
  disabled,
  value,
  error,
Severity: Minor
Found in src/frontend/design-system/components/Form/File/Presentation.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 SummaryWidgetPresentation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function SummaryWidgetPresentation({
  color,
  fullCount,
  relativeCount,
  title,
Severity: Minor
Found in src/frontend/views/Dashboard/Widget/_render/Summary/Presentation.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 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

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

Severity
Category
Status
Source
Language