datacite/bracco

View on GitHub

Showing 118 of 895 total issues

File spdx.js has 4654 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export default {
  licenses: [
    {
      reference: './0BSD.html',
      isDeprecatedLicenseId: false,
Severity: Major
Found in app/spdx.js - About 1 wk to fix

    File dfg-mappings.js has 1929 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const OECD_SCHEME = 'Fields of Science and Technology (FOS)';
    const OECD_SCHEME_URI = 'http://www.oecd.org/science/inno/38235147.pdf';
    const MAPPING = {
      mappingListVersion: '1.0',
      originalUrl:
    Severity: Major
    Found in app/utils/dfg-mappings.js - About 5 days to fix

      File edit.js has 480 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Controller from '@ember/controller';
      import { inject as service } from '@ember/service';
      import { computed } from '@ember/object';
      import { w } from '@ember/string';
      import countryList from 'iso-3166-country-list';
      Severity: Minor
      Found in app/controllers/providers/show/edit.js - About 7 hrs to fix

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

            submit(doi) {
              doi.set('event', this.setEvent(doi.get('state')));
        
              // schema-version will be determined by API
              doi.set('schemaVersion', 'http://datacite.org/schema/kernel-4');
        Severity: Major
        Found in app/controllers/repositories/show/dois/new.js - About 6 hrs to fix

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

              submit(doi) {
                // change state via event if there is a change
                let stateChange = doi.changedAttributes().state;
                if (typeof stateChange !== 'undefined') {
                  doi.set('event', this.setEvent(stateChange));
          Severity: Major
          Found in app/controllers/dois/show/edit.js - About 6 hrs to fix

            File new.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import Controller from '@ember/controller';
            import { inject as service } from '@ember/service';
            import { computed } from '@ember/object';
            import { w } from '@ember/string';
            import countryList from 'iso-3166-country-list';
            Severity: Minor
            Found in app/controllers/providers/new.js - About 4 hrs to fix

              File doi.test.ts has 337 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /// <reference types="cypress" />
              /* eslint-disable no-undef */
              
              function escapeRE(string) {
                //return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
              Severity: Minor
              Found in cypress/e2e/client_admin/doi.test.ts - About 4 hrs to fix

                File provider.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
                import { computed } from '@ember/object';
                import { reads } from '@ember/object/computed';
                import { isPresent, isBlank } from '@ember/utils';
                import { w } from '@ember/string';
                Severity: Minor
                Found in app/models/provider.js - About 4 hrs to fix

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

                    didReceiveAttrs() {
                      this._super(...arguments);
                  
                      if (this.model.get('landingPage').status == 200) {
                        let redirectText = 'resolved ';
                  Severity: Major
                  Found in app/components/doi-health.js - About 3 hrs to fix

                    `` has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                      actions: {
                        toggleInput() {
                          let estimate = this.model.get('doiEstimate');
                    
                          this.model.set('doiEstimate', '0');
                    Severity: Minor
                    Found in app/controllers/providers/show/edit.js - About 3 hrs to fix

                      Function doiFormErrors has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function doiFormErrors([model]) {
                        let errorAttributes = model.validations.errors.mapBy('attribute');
                      
                        // check validation errors for data model fragments if not in draft state
                        if (model.state !== 'draft' && ['new', 'edit'].includes(model.mode)) {
                      Severity: Minor
                      Found in app/helpers/doi-form-errors.js - About 3 hrs 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 updateRelatedItemIdentifier has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        updateRelatedItemIdentifier(value) {
                          const ark = /^ark:\/[0-9]{5}\/\S+$/;
                          const lsid =
                            /^[uU][rR][nN]:[lL][sS][iI][dD]:(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%]):(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%]):(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%])[:]?(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%])?$/;
                          const purl = {
                      Severity: Major
                      Found in app/components/doi-related-item-identifier.js - About 3 hrs to fix

                        Function barChart has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          barChart() {
                            let formatYear = timeFormat('%Y');
                            // let formatFixed = format(",.0f");
                        
                            let chartId = this.chartId;
                        Severity: Major
                        Found in app/components/bar-chart.js - About 3 hrs to fix

                          Function barChart has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            barChart() {
                              let formatMonthYear = timeFormat('%B %Y');
                              // let formatFixed = format(",.0f");
                          
                              let chartId = this.chartId;
                          Severity: Major
                          Found in app/components/month-chart.js - About 3 hrs to fix

                            Function donutChart has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              donutChart() {
                                let formatFixed = format(',.0f');
                            
                                let chartId = this.chartId;
                                let data = this.data ? this.data : [];
                            Severity: Major
                            Found in app/components/donut-chart.js - About 2 hrs to fix

                              Function reasonUtil has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export default function reasonUtil(val = null, hash = { default: '' }) {
                                let ret = hash.default;
                              
                                if (val) {
                                  if (typeof val === 'object') {
                              Severity: Minor
                              Found in app/utils/reason-util.js - About 2 hrs 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 exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = function () {
                                return {
                                  clientAllowedKeys: [
                                    'SITE_TITLE',
                                    'NAVMENU_TITLE',
                              Severity: Major
                              Found in dotenv.js - About 2 hrs to fix

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

                                  validate(value, options, model) {
                                    const ark = /^ark:\/[0-9]{5}\/\S+$/;
                                    const lsid =
                                      /^[uU][rR][nN]:[lL][sS][iI][dD]:(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%]):(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%]):(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%])[:]?(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%])?$/;
                                    const purl = {
                                Severity: Minor
                                Found in app/validators/related-item-identifier-format.js - About 2 hrs 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 selectRe3Data has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    selectRe3Data(re3data) {
                                      if (re3data) {
                                        let self = this;
                                        this.store
                                          .findRecord('re3data', re3data.id)
                                Severity: Major
                                Found in app/controllers/repositories/show/edit.js - About 2 hrs to fix

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

                                    validate(value) {
                                      if (!value) {
                                        return true;
                                      } else if (
                                        value.startsWith('https://orcid.org') ||
                                  Severity: Major
                                  Found in app/validators/name-identifier.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language