datacite/bracco

View on GitHub

Showing 118 of 898 total issues

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

  validate(value, options) {
    const resourceTypeGeneralList = [
      'Audiovisual',
      'Book',
      'BookChapter',
Severity: Minor
Found in app/validators/resource-type.js - About 1 hr to fix

    Function exports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = (on, config) => {
      let options = browserify.defaultOptions;
      options.browserifyOptions.transform[1][1].babelrc = true;
      options.typescript = require.resolve('typescript');
      on('file:preprocessor', browserify(options));
    Severity: Minor
    Found in cypress/plugins/index.js - About 1 hr to fix

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

        didReceiveAttrs() {
          this._super(...arguments);
      
          if (this.default) {
            this.set('type', null);
      Severity: Minor
      Found in app/components/application-header.js - About 1 hr to fix

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

          didReceiveAttrs() {
            this._super(...arguments);
        
            if (this.model.get('landingPage').status == 200) {
              let redirectText = 'resolved ';
        Severity: Minor
        Found in app/components/doi-health.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 providerFormErrors has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export function providerFormErrors([model]) {
          let errorAttributes = model.validations.errors.mapBy('attribute');
        
          // check validation errors for embedded data model fragments
          // but only if contacts exist
        Severity: Minor
        Found in app/helpers/provider-form-errors.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 didReceiveAttrs has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          didReceiveAttrs() {
            this._super(...arguments);
        
            let promise = new Promise((resolve, reject) => {
              const url =
        Severity: Minor
        Found in app/components/repository-info.js - About 1 hr to fix

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

            didReceiveAttrs() {
              this._super(...arguments);
          
              let promise = new Promise((resolve, reject) => {
                const url = ENV.API_URL + '/providers/' + this.model.get('id') + '/stats';
          Severity: Minor
          Found in app/components/index-info.js - About 1 hr to fix

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

              didReceiveAttrs() {
                this._super(...arguments);
            
                let promise = new Promise((resolve, reject) => {
                  const url = ENV.API_URL + '/providers/' + this.model.get('id') + '/stats';
            Severity: Minor
            Found in app/components/provider-info.js - About 1 hr to fix

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

                Function selectStyle has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  selectStyle(style) {
                    let self = this;
                    let url =
                      ENV.API_URL + '/dois/' + this.model.get('doi') + '?style=' + style;
                    let headers = { Accept: 'text/x-bibliography' };
                Severity: Minor
                Found in app/components/doi-citation.js - About 1 hr to fix

                  Function submit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      submit() {
                        let self = this;
                        // iterate through all contacts and update roles
                        let m = this.model;
                        this.model.get('contacts').forEach(function (contact) {
                  Severity: Minor
                  Found in app/controllers/providers/new.js - About 1 hr to fix

                    Function joinNameParts has a Cognitive Complexity of 12 (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-contributor.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 prefix_list has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      prefix_list(n = 1, provider_id = null, query = '') {
                        let tot = n < 0 ? 0 : n;
                        let prefixes = [];
                    
                        let promise = new Promise((resolve, reject) => {
                    Severity: Minor
                    Found in app/services/prefixes.js - About 1 hr to fix

                      Function load has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        load() {
                          if (this.get('session.data.authenticated.access_token')) {
                            // using authenticator:oauth2
                            let jwt = this.get('session.data.authenticated.access_token');
                      
                      
                      Severity: Minor
                      Found in app/services/current-user.js - About 1 hr to fix

                        Function formatCreators has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function formatCreators(creators, hash) {
                          let limit = creators.length;
                        
                          if (hash.showOnly) {
                            limit = hash.showOnly;
                        Severity: Minor
                        Found in app/utils/format-creators.js - About 1 hr to fix

                          Function updateNameIdentifier has 34 lines of code (exceeds 25 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

                            Consider simplifying this complex logical expression.
                            Open

                                if (
                                  isPresent(this.get('model.publicationYear')) ||
                                  isPresent(this.get('model.titles')) ||
                                  isPresent(this.get('model.publisher')) ||
                                  isPresent(this.get('model.creators')) ||
                            Severity: Critical
                            Found in app/components/doi-metadata.js - About 1 hr to fix

                              Function contentNegotiationUrl has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function contentNegotiationUrl([doi], hash) {
                                let mimeType = '';
                                switch (hash.format) {
                                  case 'datacite':
                                    mimeType = 'application/vnd.datacite.datacite+xml';
                              Severity: Minor
                              Found in app/helpers/content-negotiation-url.js - About 1 hr to fix

                                Function searchProvider has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  searchProvider(query) {
                                    let self = this;
                                    if (this.currentUser.get('isAdmin')) {
                                      this.store
                                        .query('provider', {
                                Severity: Minor
                                Found in app/components/repository-transfer.js - About 1 hr to fix

                                  Function model has 32 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/contacts/index.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language