CMSgov/dpc-app

View on GitHub

Showing 109 of 393 total issues

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 generate_credentials has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def generate_credentials(credentials, org_bundle, public_key_label, path_to_org_pub_key, expiration)
    Severity: Minor
    Found in scripts/generate_credentials.rb - 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

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

                Function UploadFileToS3 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func UploadFileToS3(s *session.Session, fileName string, buff bytes.Buffer, s3Bucket string, s3Path string) error {
                Severity: Minor
                Found in lambda/opt-out-export/dpcaws/s3.go - About 35 mins to fix

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

                      public Resource retrieveData(UUID organizationId, String orgNPI, String providerNPI, List<String> patientIds, DPCResourceType... resourceTypes) {
                  Severity: Minor
                  Found in dpc-queue/src/main/java/gov/cms/dpc/queue/service/DataService.java - 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 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

                      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

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

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

                      func ParseSQSEvent(event events.SQSEvent) (*events.S3Event, error) {
                          var snsEntity events.SNSEntity
                          err := json.Unmarshal([]byte(event.Records[0].Body), &snsEntity)
                      
                          unmarshalTypeErr := new(json.UnmarshalTypeError)
                      Severity: Major
                      Found in lambda/opt-out-import/parsers.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

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

                        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
                          Severity
                          Category
                          Status
                          Source
                          Language