Enterprise-CMCS/macpro-mako

View on GitHub

Showing 140 of 140 total issues

Avoid too many return statements within this function.
Open

    return constants.STATUS_ERROR_PROCESSING_FILE;
Severity: Major
Found in lib/local-constructs/clamav-scanning/src/lib/file-ext.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return response({
          statusCode: 500,
          body: { message: "Internal server error" },
        });
    Severity: Major
    Found in lib/lambda/getPackageActions.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return response({
            statusCode: 502,
            body: {
              error: error.message ? error.message : "Internal server error",
            },
      Severity: Major
      Found in lib/lambda/getForm.ts - About 30 mins to fix

        Function UploadSubsequentDocuments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const UploadSubsequentDocuments = () => {
          const { id } = useParams<{ id: string }>();
          const { data: submission, isLoading: isSubmissionLoading } = useGetItem(id);
        
          if (isSubmissionLoading === true) {

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

          handler: async ({
            stage,
            wait,
            verify,
          }: {
        Severity: Minor
        Found in bin/cli/src/commands/destroy.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 getMainExportData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getMainExportData = async (
          filters?: opensearch.main.Filterable[],
        ) => {
          if (!filters) return [];
        
        
        Severity: Minor
        Found in react-app/src/api/useSearch.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 Webform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export function Webform() {
          const { id, version } = useParams<{ id: string; version: string }>();
        
          const { data, isLoading: isFormLoading, error } = useGetForm(id as string, version);
          const { readOnly, isLoading: isReadOnlyLoading } = useReadOnlyUser();
        Severity: Minor
        Found in react-app/src/features/webforms/Webform.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 fetchUserFromCognito has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function fetchUserFromCognito(
          userID: string,
          poolID: string,
        ): Promise<CognitoUserType | Error> {
          const cognitoClient = new CognitoIdentityProviderClient({
        Severity: Minor
        Found in lib/libs/api/auth/user.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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          constructor(scope: Construct, id: string, props: EmailServiceStackProps) {
            super(scope, id, props);
        
            const {
              project,
        Severity: Minor
        Found in lib/stacks/email.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 Field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const Field = <TFields extends FieldValues>({
          name,
          index,
          SLOT,
          control,
        Severity: Minor
        Found in react-app/src/components/RHF/Field.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 useFilterState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useFilterState = () => {
          const { data: user } = useGetUser();
          const url = useOsUrl();
        
          const isCms =
        Severity: Minor
        Found in react-app/src/components/Opensearch/main/Filtering/Drawer/hooks.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 check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          check: (checker, user) => {
            if (isStateUser(user) === false) {
              return false;
            }
        
        
        Severity: Minor
        Found in lib/packages/shared-utils/package-actions/rules.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 useOsAggregate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useOsAggregate = () => {
          const { data: user } = useGetUser();
          const { state } = useOsUrl();
          const aggs = useQuery({
            refetchOnWindowFocus: false,
        Severity: Minor
        Found in react-app/src/components/Opensearch/main/useOpensearch.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 FilterableBoolean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        }> = (props) => {
          const yes = props.value === null ? false : props.value;
          const no = props.value === null ? false : !props.value;
        
          const onYes = (mhm: boolean) => {

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

        async function getLambdasWithTags(tags: Tag[]): Promise<string[]> {
          const taggingClient = new ResourceGroupsTaggingAPIClient({
            region,
          });
        
        
        Severity: Minor
        Found in bin/cli/src/commands/logs.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 dependencyCheck has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const dependencyCheck = (dep: DependencyRule, data: any) => {
          const conditionMatched = dep.conditions.every((DC) => {
            if (DC.type === "valueNotExist") return !data[DC.name];
            if (DC.type === "expectedValue") {
              return data[DC.name] === DC.expectedValue;
        Severity: Minor
        Found in react-app/src/components/RHF/utils/validator.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 getFormOrigin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getFormOrigin: GetFormOrigin = ({ id, authority } = {}) => {
          const origin =
            new URLSearchParams(window.location.search).get(ORIGIN) ?? DASHBOARD_ORIGIN;
        
          if (origin === DETAILS_ORIGIN && id && authority) {
        Severity: Minor
        Found in react-app/src/utils/formOrigin.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 transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const transform = (id: string) => {
          return legacyEventSchema.transform((data) => {
            // Resolve the action type based on the GSI1pk
            const eventType = data?.GSI1pk?.split("OneMAC#submit")?.[1] || "";
        
        

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

        export const getAttachments = <Schema extends z.ZodTypeAny>(
          schema: Schema,
        ): [string, z.ZodObject<z.ZodRawShape, "strip">][] => {
          if (schema instanceof z.ZodEffects) {
            return getAttachments(schema.innerType());
        Severity: Minor
        Found in react-app/src/components/ActionForm/actionForm.utilities.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 DownloadAllButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const DownloadAllButton = ({ packageId, submissionChangelog }: DownloadAllButtonProps) => {
          const { onZip, loading } = useAttachmentService({ packageId });
        
          if (submissionChangelog?.length === 0) {
            return null;
        Severity: Minor
        Found in react-app/src/features/package/package-activity/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

        Severity
        Category
        Status
        Source
        Language