CMSgov/dpc-app

View on GitHub

Showing 109 of 393 total issues

Function handler has 5 return statements (exceeds 4 allowed).
Open

func handler(ctx context.Context, sqsEvent events.SQSEvent) (string, error) {
    log.SetFormatter(&log.JSONFormatter{
        DisableHTMLEscape: true,
        TimestampFormat:   time.RFC3339Nano,
    })
Severity: Major
Found in lambda/opt-out-import/main.go - About 35 mins to fix

    Avoid too many return statements within this method.
    Open

                return Group;
    Severity: Major
    Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return Schedule;
      Severity: Major
      Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return true;
        Severity: Major
        Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return Organization;
          Severity: Major
          Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return Practitioner;
            Severity: Major
            Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return false;
              Severity: Major
              Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return Patient;
                Severity: Major
                Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return OperationOutcome;
                  Severity: Major
                  Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - About 30 mins to fix

                    Method getKeyStoreStream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private InputStream getKeyStoreStream() {
                            final InputStream keyStoreStream;
                    
                            if (this.bbClientConfiguration.getKeystore().getLocation() == null) {
                                keyStoreStream = BlueButtonClientImpl.class.getResourceAsStream(KEYSTORE_RESOURCE_KEY);

                    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

                    Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def create
                        @organization = current_user.organizations.find(org_id)
                    
                        reg_org = @organization.registered_organization
                        manager = ClientTokenManager.new(registered_organization: reg_org)
                    Severity: Minor
                    Found in dpc-web/app/controllers/client_tokens_controller.rb - 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

                    Method equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @Override
                        public boolean equals(Object o) {
                            if (this == o) return true;
                            if (!(o instanceof RangeHeader)) return false;
                            RangeHeader that = (RangeHeader) o;
                    Severity: Minor
                    Found in dpc-api/src/main/java/gov/cms/dpc/api/models/RangeHeader.java - 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

                    Method equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @Override
                        public boolean equals(Object o) {
                            if (this == o) return true;
                            if (!(o instanceof MacaroonCaveat)) return false;
                            MacaroonCaveat that = (MacaroonCaveat) o;
                    Severity: Minor
                    Found in dpc-macaroons/src/main/java/gov/cms/dpc/macaroons/MacaroonCaveat.java - 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

                    Method errorHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static void errorHandler(Throwable e) {
                            logger.error("Caught exception during RxJava processing flow: ", e);
                    
                            // Undeliverable Exceptions may happen because of parallel execution. One thread will
                            // throw an exception which will cause the job to fail and (close its consumer).

                    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 insertConsentRecords has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func insertConsentRecords(db *sql.DB, optOutFileId string, records []*OptOutRecord) ([]*OptOutRecord, error) {
                        createdRecords := []*OptOutRecord{}
                    
                        // If there aren't any rows, skip this and update the import_status of the file
                        if len(records) > 0 {
                    Severity: Minor
                    Found in lambda/opt-out-import/db.go - 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

                    Method deserializeMacaroon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static List<Macaroon> deserializeMacaroon(String serializedString) {
                            if (serializedString.isEmpty()) {
                                throw new BakeryException("Cannot deserialize empty string");
                            }
                            // Determine if we're Base64 encoded or not
                    Severity: Minor
                    Found in dpc-macaroons/src/main/java/gov/cms/dpc/macaroons/MacaroonBakery.java - 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

                    Method fromPolicyUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public static PolicyType fromPolicyUrl(String url) {
                                if (url != null) {
                                    for (PolicyType policyType : PolicyType.values()) {
                                        if (policyType.policyUrl.equalsIgnoreCase(url)) {
                                            return policyType;

                    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

                    Method categoriesToLoincCode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static String categoriesToLoincCode(List<CodeableConcept> categories) {
                            if (categories == null || categories.size() != 1) {
                                throw new WebApplicationException("Must include one category", HttpStatus.UNPROCESSABLE_ENTITY_422);
                            }
                    
                    

                    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

                    Method search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
                        @GET
                        @FHIR
                        @Timed
                        @ExceptionMetered

                    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

                    Method searchPatients has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @GET
                        @FHIR
                        @UnitOfWork
                        @Override
                        public List<Patient> searchPatients(

                    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