datacite/bracco

View on GitHub

Showing 118 of 898 total issues

Function model has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  model() {
    let self = this;
    let id = this.modelFor('dois/show').get('id');
    return this.store
      .findRecord('doi', id, {
Severity: Minor
Found in app/routes/dois/show/edit.js - About 1 hr to fix

    Function joinNameParts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      joinNameParts(options = {}) {
        if (options.nameIdentifierScheme === 'ORCID') {
          this.fragment.set('nameType', 'Personal');
          this.set('nameType', 'Personal');
          this.set('isReadonlyNameParts', true);
    Severity: Minor
    Found in app/components/doi-related-item-creator.js - About 1 hr 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 model has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      model() {
        if (this.currentUser.get('client_id')) {
          return this.store
            .findRecord('repository', this.currentUser.get('uid'))
            .then(function (repository) {
    Severity: Minor
    Found in app/routes/password.js - About 1 hr to fix

      Function afterModel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        afterModel() {
          if (this.get('currentUser.role_id') === 'staff_admin') {
            var self = this;
      
            this.prefixes.available().then(
      Severity: Minor
      Found in app/routes/index.js - About 1 hr to fix

        Function searchPrefix has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          searchPrefix(query) {
            let self = this;
            let prefixes = [];
        
            this.prefixes_service
        Severity: Minor
        Found in app/controllers/repositories/show/prefixes/new.js - About 1 hr to fix

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

              let promise = new Promise((resolve, reject) => {
                this.store
                  .query('provider-prefix', {
                    query,
                    'provider-id': provider_id,
          Severity: Minor
          Found in app/services/prefixes.js - About 1 hr to fix

            Function sendLink has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                sendLink() {
                  this.set('requestSent', false);
                  let { identification } = this;
                  let self = this;
                  let url = ENV.API_URL + '/reset';
            Severity: Minor
            Found in app/controllers/reset.js - About 1 hr to fix

              Function get_n_available_pp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function didReceiveAttrs has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  didReceiveAttrs() {
                    this._super(...arguments);
                
                    this.set('query', this.model.get('query.query'));
                    this.set('sort', this.model.get('query.sort'));
                Severity: Minor
                Found in app/components/model-search.js - About 1 hr to fix

                  Function model has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    model(params) {
                      let providerId = null;
                      let consortiumId = null;
                      let model = this.modelFor('providers/show');
                      if (model.memberType === 'consortium') {
                  Severity: Minor
                  Found in app/routes/providers/show/prefixes/index.js - About 1 hr to fix

                    Function model has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      model(params) {
                        let providerId = null;
                        let consortiumId = null;
                        let model = this.modelFor('providers/show');
                        if (model.memberType === 'consortium') {
                    Severity: Minor
                    Found in app/routes/providers/show/repositories/index.js - About 1 hr to fix

                      Function model has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        model(params) {
                          let providerId = null;
                          let consortiumId = null;
                          let model = this.modelFor('providers/show');
                          if (model.memberType === 'consortium') {
                      Severity: Minor
                      Found in app/routes/providers/show/dois.js - About 1 hr to fix

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

                          validate(value, options, model) {
                            if (!value && options.allowBlank) {
                              return true;
                            } else {
                              return this.store
                        Severity: Minor
                        Found in app/validators/url-domain.js - About 1 hr to fix

                          Function model has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            model() {
                              let self = this;
                              let url = ENV.FABRICA_URL + '/authorize';
                              fetch(url)
                                .then(function (response) {
                          Severity: Minor
                          Found in app/routes/authorize.js - About 1 hr to fix

                            Function validate has 28 lines of code (exceeds 25 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 1 hr to fix

                              Function formattedBillingInformation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  function () {
                                    if (this.billingInformation) {
                                      return addressFormatter.format(
                                        {
                                          road: this.billingInformation.address,
                              Severity: Minor
                              Found in app/models/provider.js - About 1 hr 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 updateNameIdentifier has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                updateNameIdentifier(value) {
                                  if (
                                    value.startsWith('https://orcid.org') ||
                                    value.startsWith('http://orcid.org')
                                  ) {
                              Severity: Minor
                              Found in app/components/doi-name-identifier.js - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                validate(value, options) {
                                  if (!value && options.allowBlank) {
                                    return true;
                                  } else if (options.version) {
                                    if (isUUID(value, options.version)) {
                              Severity: Minor
                              Found in app/validators/uuid-format.js - About 1 hr 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 27 lines of code (exceeds 25 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 1 hr to fix

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

                                  validate(value, options, model) {
                                    let providerId = model.get('provider.id');
                                    let query = `email:${value} !uid:${model.get('id')}`;
                                
                                    // email should be unique per provider,
                                Severity: Minor
                                Found in app/validators/unique-email.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language