CMSgov/dpc-app

View on GitHub

Showing 109 of 391 total issues

Method fromFhir has 26 lines of code (exceeds 25 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);
        }

    Method getCaveats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static List<MacaroonCaveat> getCaveats(Macaroon macaroon) {
            List<MacaroonCaveat> caveats = new ArrayList<>();
    
            MacaroonCaveat currentCaveat = new MacaroonCaveat();
    
    
    Severity: Minor
    Found in dpc-macaroons/src/main/java/gov/cms/dpc/macaroons/MacaroonBakery.java - About 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public void execute(Map<String, List<String>> parameters, PrintWriter output) {
            final List<String> expirationCollection = parameters.get("expiration");
            final List<String> labelCollection = parameters.get("label");
            final List<String> organizationCollection = parameters.get("organization");

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

      def self.to_csv(user_ids)
        users = User.find(user_ids)
        CSV.generate(headers: true) do |csv|
          csv << ATTRS
          users.each do |user|
    Severity: Minor
    Found in dpc-web/app/models/user.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof RosterEntity)) return false;
            RosterEntity that = (RosterEntity) o;
    Severity: Minor
    Found in dpc-common/src/main/java/gov/cms/dpc/common/entities/RosterEntity.java - About 55 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 to_csv has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.to_csv(user_ids)
        users = User.find(user_ids)
        CSV.generate(headers: true) do |csv|
          csv << ATTRS
          users.each do |user|
    Severity: Minor
    Found in dpc-admin/app/models/user.rb - About 55 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 createEmptyBatch has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected List<JobQueueBatch> createEmptyBatch(UUID jobID,
                                                       UUID orgID,
                                                       String orgNPI,
                                                       String providerNPI,
                                                       List<DPCResourceType> resourceTypes,
    Severity: Major
    Found in dpc-queue/src/main/java/gov/cms/dpc/queue/JobQueueCommon.java - About 50 mins to fix

      Function generateRequestFile has 8 return statements (exceeds 4 allowed).
      Open

      func generateRequestFile() (string, error) {
          session, sessErr := getAwsSession()
          if sessErr != nil {
              return "", sessErr
          }
      Severity: Major
      Found in lambda/opt-out-export/main.go - About 50 mins to fix

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

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

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

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

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

            @Override
            public boolean equals(Object o) {
                if (this == o) return true;
                if (!(o instanceof AttributionRelationship)) return false;
                AttributionRelationship that = (AttributionRelationship) o;

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

            private static TrustManager[] getTrustingManager() {
                return new TrustManager[]{new X509TrustManager() {
                    @Override
                    public X509Certificate[] getAcceptedIssuers() {
                        return null;
        Severity: Minor
        Found in dpc-testing/src/main/java/gov/cms/dpc/testing/APIAuthHelpers.java - 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

        Method handleExpirationTime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            @SuppressWarnings("OptionalUsedAsFieldOrParameterType")
            private OffsetDateTime handleExpirationTime(Optional<OffsetDateTimeParam> expiresQueryParam, Optional<CreateTokenRequest> token) {
                // Compute default expiration
                final OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC);
                final OffsetDateTime defaultExpiration = now.plus(this.policy.getExpirationPolicy().getExpirationOffset(), this.policy.getExpirationPolicy().getExpirationUnit());
        Severity: Minor
        Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/TokenResource.java - 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

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

            def initialize(env, jwt, golden_macaroon, org_key, org_signature, path_to_org_pub_key)
        Severity: Minor
        Found in scripts/generate_credentials.rb - About 45 mins to fix

          Consider simplifying this complex logical expression.
          Open

            if (typeof ElementProto.matches !== 'function') {
              ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
                var element = this;
                var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
                var index = 0;
          Severity: Major
          Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 40 mins to fix

            Function getAssumeRoleArn has 6 return statements (exceeds 4 allowed).
            Open

            func getAssumeRoleArn() (string, error) {
                if isTesting {
                    val := os.Getenv("AWS_ASSUME_ROLE_ARN")
                    if val == "" {
                        return "", fmt.Errorf("AWS_ASSUME_ROLE_ARN must be set during testing")
            Severity: Major
            Found in lambda/opt-out-import/db.go - About 40 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 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 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 createRosterSubmission has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private static void createRosterSubmission(IGenericClient client, InputStream resource, Bundle providerBundle, UUID organizationID, Map<String, Reference> patientReferences) throws IOException {
                      Severity
                      Category
                      Status
                      Source
                      Language