CMSgov/dpc-app

View on GitHub

Showing 100 of 394 total issues

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

    public List<JobQueueBatchFile> processJobBatchPartial(UUID aggregatorID, IJobQueue queue, JobQueueBatch job, String mbi) {
        StopWatch stopWatch = StopWatch.createStarted();
        Optional<OutcomeReason> failReason = Optional.empty();
        Optional<Flowable<Resource>> flowable = Optional.empty();

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

        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

          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

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