datacite/bracco

View on GitHub

Showing 118 of 898 total issues

Function authenticate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  authenticate(jwt) {
    return new Promise((resolve, reject) => {
      const serverTokenEndpoint = this.serverTokenEndpoint;

      fetch(serverTokenEndpoint, {
Severity: Minor
Found in app/authenticators/globus.js - About 1 hr to fix

    Function promise has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        let promise = new Promise((resolve, reject) => {
          const url =
            ENV.API_URL +
            '/provider-prefixes?provider-id=' +
            provider_id +
    Severity: Minor
    Found in app/services/prefixes.js - About 1 hr to fix

      Function get_n_available has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        get_n_available() {
          let promise = new Promise((resolve, reject) => {
            const url =
              ENV.API_URL + '/prefixes?page[number]=1&page[size]=0&state=unassigned';
            const headers = { Accept: 'application/json' };
      Severity: Minor
      Found in app/services/prefixes.js - About 1 hr to fix

        Function updateFunderReference has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          updateFunderReference(funder) {
            switch (true) {
              case funder === null:
                this.fragment.set('funderIdentifierType', 'Other');
                this.fragment.set('funderIdentifier', null);
        Severity: Minor
        Found in app/components/doi-funding-reference.js - About 1 hr to fix

          Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            validate(value, options, model) {
              let providerId = model.get('provider').get('symbol') + '.';
              if (value === providerId) {
                return true;
              } else {
          Severity: Minor
          Found in app/validators/unique-repository-id.js - About 1 hr to fix

            Function setDefaultPrefix has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              setDefaultPrefix() {
                let self = this;
                this.store
                  .query('repository-prefix', {
                    'repository-id': this.repository.get('id'),
            Severity: Minor
            Found in app/components/doi-doi.js - About 1 hr to fix

              Function count has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                count: computed('data', 'summarize', function () {
                  if (this.data) {
                    if (this.summarize) {
                      return A(this.data).reduce(function (a, b) {
                        return a + b.count;
              Severity: Minor
              Found in app/components/month-chart.js - 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

              Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                validate(value, options) {
                  if (!value && options.allowBlank) {
                    return true;
                  } else if (!value) {
                    let message = "This field can't be blank.";
              Severity: Minor
              Found in app/validators/url-format.js - 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

              Function formatMetadata has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              export function formatMetadata([publicationYear], hash) {
                let container = '';
                if (hash.container && hash.container.title) {
                  container = ' via ' + hash.container.title;
                } else if (hash.publisher && hash.publisher.name) {
              Severity: Minor
              Found in app/helpers/format-metadata.js - 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

              Function count has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                count: computed('data', 'summarize', 'currentYear', function () {
                  if (this.data) {
                    if (this.summarize) {
                      return A(this.data).reduce(function (a, b) {
                        return a + b.count;
              Severity: Minor
              Found in app/components/bar-chart.js - 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

              Function formatText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function formatText([text], hash) {
                text = entities.decode(text);
              
                let allowedTags = [
                  'strong',
              Severity: Minor
              Found in app/helpers/format-text.js - 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

              Function didReceiveAttrs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                didReceiveAttrs() {
                  this._super(...arguments);
              
                  if (this.licenseURL != null) {
                    let uri = new URI(this.licenseURL);
              Severity: Minor
              Found in app/components/cc-license.js - 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

              Function formatContact has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function formatContact([contact]) {
                let name = null;
                let email = null;
              
                // use email as fallback if not givenName or familyName
              Severity: Minor
              Found in app/helpers/format-contact.js - 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

              Function deserialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                deserialize(serialized) {
                  if (serialized) {
                    return {
                      city: serialized.city ? serialized.city : '',
                      state: serialized.state
              Severity: Minor
              Found in app/transforms/billing-information.js - 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

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

                normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) {
              Severity: Minor
              Found in app/serializers/person.js - About 35 mins to fix

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

                  normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) {
                Severity: Minor
                Found in app/serializers/ror.js - About 35 mins to fix

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

                    normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
                  Severity: Minor
                  Found in app/serializers/ror.js - About 35 mins to fix

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

                    export function formatNumbers(counter) {
                      if (counter < 1e3) {
                        return counter;
                      }
                      if (counter >= 1e3 && counter < 1e6) {
                    Severity: Minor
                    Found in app/helpers/format-numbers.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 didReceiveAttrs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      didReceiveAttrs() {
                        this._super(...arguments);
                    
                        this.selectNameType(this.fragment.get('nameType'));
                    
                    
                    Severity: Minor
                    Found in app/components/doi-related-item-creator.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

                    Avoid too many return statements within this function.
                    Open

                        return json;
                    Severity: Major
                    Found in app/serializers/related-item.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language