CMSgov/dpc-app

View on GitHub

Showing 102 of 390 total issues

Method encodeSecretPart has 5 arguments (exceeds 4 allowed). Consider refactoring.
Confirmed

    static byte[] encodeSecretPart(byte[] thirdPartyKey, byte[] privateKey, byte[] nonce, String rootKey, String caveat) {
Severity: Minor
Found in dpc-macaroons/src/main/java/gov/cms/dpc/macaroons/MacaroonBakery.java - About 35 mins to fix

    Method registerOrganization has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static String registerOrganization(IGenericClient client, IParser parser, String organizationID, String organizationNPI, String adminURL) throws IOException {
    Severity: Minor
    Found in dpc-common/src/main/java/gov/cms/dpc/fhir/helpers/FHIRHelpers.java - About 35 mins to fix

      Method fetchBundle has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private <T extends IBaseResource> Bundle fetchBundle(Class<T> resourceClass,
                                                               List<ICriterion<? extends IParam>> criteria,
                                                               String patientID,
                                                               DateRangeParam lastUpdated,
                                                               Map<String, String> headers) {

        Method exportDataAndHandleResults has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private void exportDataAndHandleResults(IGenericClient exportClient, Bundle providerBundle, String clientToken, Pair<UUID,PrivateKey> keyTuple, SampleResult parentSampler){

          Method everything has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public abstract Resource everything(OrganizationPrincipal organization,
                                                  @Valid @Profiled Provenance attestation,
                                                  UUID patientId,
                                                  @QueryParam("_since") @NoHtml String since,
                                                  HttpServletRequest request);

            Method createAndUploadRosters has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                static void createAndUploadRosters(String seedsFile, Bundle providerBundle, IGenericClient client, UUID organizationID, Map<String, Reference> patientReferences) throws IOException {

              Method fetchBundle has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private <T extends IBaseResource> Bundle fetchBundle(Class<T> resourceClass,
                                                                       List<ICriterion<? extends IParam>> criteria,
                                                                       String patientID,
                                                                       DateRangeParam lastUpdated,
                                                                       Map<String, String> headers) {

                Method everything has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public Bundle everything(@ApiParam(hidden = true) @Auth OrganizationPrincipal organization,
                                             @Valid @Profiled @ProvenanceHeader Provenance provenance,
                                             @ApiParam(value = "Patient resource ID", required = true) @PathParam("patientID") UUID patientId,
                                             @QueryParam("_since") @NoHtml String sinceParam,
                                             @Context HttpServletRequest request) {
                Severity: Minor
                Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/PatientResource.java - About 35 mins to fix

                  Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def initialize(heading, description, yes_action, no_message, modal_id)
                  Severity: Minor
                  Found in dpc-portal/app/components/core/modal/modal_component.rb - About 35 mins to fix

                    Function insertConsentRecords has 5 return statements (exceeds 4 allowed).
                    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: Major
                    Found in lambda/opt-out-import/db.go - About 35 mins to fix

                      Method downloadExportFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          @Override
                          @Path("/{fileID}.ndjson")
                          @GET
                          @Timed
                          @ExceptionMetered
                      Severity: Minor
                      Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/DataResource.java - 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

                      Method check_sanctions_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def check_sanctions_response(response)
                          return false if waiver?(response.dig('provider', 'waiverInfo'))
                      
                          med_sanctions_records = response.dig('provider', 'medSanctions')
                          unless med_sanctions_records.nil? || med_sanctions_records.empty?
                      Severity: Minor
                      Found in dpc-portal/app/services/ao_verification_service.rb - 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

                      Method destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def destroy
                            if resource.destroy_with_password(user_params[:password_to_delete])
                              Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
                              flash[:notice] = 'Bye! Your account has been successfully cancelled. We hope to see you again soon.'
                              yield resource if block_given?
                      Severity: Minor
                      Found in dpc-web/app/controllers/users/registrations_controller.rb - 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 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

                        Function 17 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        },{"object-assign":4,"receptor/behavior":5}],17:[function(require,module,exports){
                        "use strict";
                        
                        // https://stackoverflow.com/a/7557433
                        function isElementInViewport(el) {
                        Severity: Minor
                        Found in dpc-admin/app/assets/javascripts/components/_accordions.js - 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 SaveDPCKeyPair has 5 return statements (exceeds 4 allowed).
                        Open

                        func SaveDPCKeyPair(prefix string, private *rsa.PrivateKey, public *rsa.PublicKey) error {
                            if private == nil || public == nil {
                                return errors.New("private and/or public key arguments cannot be nil")
                            }
                            if err := ValidateDPCKey(private); err != nil {
                        Severity: Major
                        Found in dpcclient/lib/pki.go - About 35 mins to fix

                          Function importResponseFile has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func importResponseFile(bucket string, file string) (int, int, string, error) {
                              log.Infof("Importing opt out file: %s (bucket: %s)", file, bucket)
                              metadata, err := ParseMetadata(bucket, file)
                              if err != nil {
                                  log.Warningf("Failed to parse opt out file metadata: %s", err)
                          Severity: Minor
                          Found in lambda/opt-out-import/main.go - 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

                          Method fromFhir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              @SuppressWarnings("JdkObsolete") // Date class is used by FHIR stu3 Consent model
                              public static ConsentEntity fromFhir(Consent consent) {
                                  if (consent == null) {
                                      throw new WebApplicationException("No consent resource provided", Response.Status.BAD_REQUEST);
                                  }

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

                              private Response buildRangedRequest(String fileID, File file, RangeHeader range) {
                                  if (!range.getUnit().equals(ACCEPTED_RANGE_VALUE)) {
                                      throw new WebApplicationException("Only `bytes` are acceptable as ranges", Response.Status.REQUESTED_RANGE_NOT_SATISFIABLE);
                                  }
                                  final long rangeStart = range.getStart() < 0 ? 0 : range.getStart();
                          Severity: Minor
                          Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/DataResource.java - 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 19 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          },{}],19:[function(require,module,exports){
                          'use strict';
                          
                          var EXPANDED = 'aria-expanded';
                          var CONTROLS = 'aria-controls';
                          Severity: Minor
                          Found in dpc-admin/app/assets/javascripts/components/_accordions.js - 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

                          Severity
                          Category
                          Status
                          Source
                          Language