hadmean/hadmean

View on GitHub

Showing 150 of 428 total issues

Function isAuthenticatedValidationImpl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const isAuthenticatedValidationImpl: ValidationImplType<void> = async (
  req,
  protectedRoute: boolean
) => {
  try {
Severity: Minor
Found in src/backend/lib/request/validations/implementations/is-authenticated.ts - About 45 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 handleValidation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (
    validate: (
      value: unknown,
      parameter?: unknown,
      allValues?: Record<string, unknown>
Severity: Minor
Found in src/shared/validations/handle-validation.ts - About 35 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 useEntityCrudView has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function useEntityCrudView(entity: string) {
  const entityCrudSettings = useEntityCrudSettings(entity);
  const entityFields = useEntityFields(entity);

  const upsertCrudSettingsMutation = useUpsertConfigurationMutation(
Severity: Minor
Found in src/frontend/views/entity/Crud/index.tsx - About 35 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 parseForm has a Cognitive Complexity of 7 (exceeds 5 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 35 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 FormFileInput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function FormFileInput({
  input,
  meta,
  disabled,
  uploadUrl,
Severity: Minor
Found in src/frontend/design-system/components/Form/File/index.tsx - About 35 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 DetailsLayout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function DetailsLayout({
  children,
  entity,
  menuKey,
  menuItems = [],
Severity: Minor
Found in src/frontend/views/data/Details/_Layout.tsx - About 35 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 handleRequestError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const handleRequestError = async (response: Response, errorMessage: string) => {
  if (response.ok) {
    return;
  }
  const error = await response.json();
Severity: Minor
Found in src/frontend/lib/data/makeRequest.ts - About 35 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

Avoid too many return statements within this function.
Open

  return permissions.includes(requiredPermission);
Severity: Major
Found in src/shared/logic/permissions/index.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return await ApiRequest.GET(referenceUrl(input.value));
    Severity: Major
    Found in src/frontend/design-system/components/Form/Select/Async/index.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return input.value;
      Severity: Major
      Found in src/frontend/design-system/components/Form/Select/Async/index.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return new Date();
        Severity: Major
        Found in src/backend/data/data-access/time.constants.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return filterType;
          Severity: Major
          Found in src/frontend/views/data/Table/useTableColumns.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return (
                  <ReferenceComponent
                    entity={entityToOneReferenceFields?.[fieldName]}
                    id={value as string}
                    displayFrom={options.displayFrom}
            Severity: Major
            Found in src/frontend/views/data/viewSpecialDataTypes.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return i18n._(availableOption.label);
              Severity: Major
              Found in src/frontend/views/data/viewSpecialDataTypes.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return null;
                Severity: Major
                Found in src/frontend/views/data/viewSpecialDataTypes.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return (
                            <OptionTag
                              color={availableOption.color}
                              label={availableOption.label}
                              value={availableOption.value}
                  Severity: Major
                  Found in src/frontend/views/data/viewSpecialDataTypes.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return operatorConfig[QueryOperators.BETWEEN](
                              query,
                              column,
                              timeBetween
                            );
                    Severity: Major
                    Found in src/backend/data/data-access/_Base.ts - About 30 mins to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language