ilios/frontend

View on GitHub

Showing 90 of 90 total issues

File user.js has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Model, { hasMany, belongsTo, attr } from '@ember-data/model';
import { TrackedAsyncData } from 'ember-async-data';
import { cached } from '@glimmer/tracking';
import { mapBy, uniqueValues } from 'ilios-common/utils/array-helpers';

Severity: Major
Found in packages/ilios-common/addon/models/user.js - About 1 day to fix

    File session.js has 504 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Model, { hasMany, belongsTo, attr } from '@ember-data/model';
    import { DateTime } from 'luxon';
    import sortableByPosition from 'ilios-common/utils/sortable-by-position';
    import striptags from 'striptags';
    import { filter } from 'rsvp';
    Severity: Major
    Found in packages/ilios-common/addon/models/session.js - About 1 day to fix

      File offering-form.js has 502 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Component from '@glimmer/component';
      import { tracked } from '@glimmer/tracking';
      import { action } from '@ember/object';
      import { service } from '@ember/service';
      import { isEmpty, isPresent } from '@ember/utils';
      Severity: Major
      Found in packages/ilios-common/addon/components/offering-form.js - About 1 day to fix

        File sequence-block-overview.js has 428 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import Component from '@glimmer/component';
        import { tracked } from '@glimmer/tracking';
        import { action } from '@ember/object';
        import { service } from '@ember/service';
        import { isPresent } from '@ember/utils';

          File permission-checker.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import Service, { service } from '@ember/service';
          
          export default class PermissionCheckerService extends Service {
            @service currentUser;
            @service permissionMatrix;
          Severity: Minor
          Found in packages/ilios-common/addon/services/permission-checker.js - About 5 hrs to fix

            File learner-group.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import Model, { hasMany, belongsTo, attr } from '@ember-data/model';
            import escapeRegExp from 'ilios-common/utils/escape-reg-exp';
            import { map } from 'rsvp';
            import { TrackedAsyncData } from 'ember-async-data';
            import { cached } from '@glimmer/tracking';
            Severity: Minor
            Found in packages/ilios-common/addon/models/learner-group.js - About 4 hrs to fix

              Function parseFile has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                async parseFile(proposedUsers) {
                  const cohort = await this.args.learnerGroup.cohort;
                  const data = await map(
                    proposedUsers,
                    async ({ firstName, lastName, campusId, subGroupName }) => {
              Severity: Minor
              Found in packages/frontend/app/components/learner-group/upload-data.js - About 4 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 _asArray has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              function _asArray(maybeArray) {
                if (typeof maybeArray === 'number') {
                  throw new Error('Numbers not supported as arrays [ilios-common]');
                }
                if (typeof maybeArray === 'string') {
              Severity: Minor
              Found in packages/ilios-common/addon/utils/as-array.js - About 4 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

              File bulk-new-users.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import Component from '@glimmer/component';
              import { tracked } from '@glimmer/tracking';
              import { getOwner } from '@ember/application';
              import { action } from '@ember/object';
              import CoreObject from '@ember/object/core';
              Severity: Minor
              Found in packages/frontend/app/components/bulk-new-users.js - About 4 hrs to fix

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

                import Component from '@glimmer/component';
                import { service } from '@ember/service';
                import { dropTask } from 'ember-concurrency';
                import { validatable, Length, Custom } from 'ilios-common/decorators/validation';
                import { TrackedAsyncData } from 'ember-async-data';
                Severity: Minor
                Found in packages/frontend/app/components/reports/new-subject.js - About 4 hrs to fix

                  Function calendarEventTooltip has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function calendarEventTooltip(event, intl, timeFormat) {
                    const addLocationToContents = function (contents, eventLocation) {
                      if (!isBlank(eventLocation)) {
                        contents = contents + `${eventLocation}<br />`;
                      }
                  Severity: Minor
                  Found in packages/ilios-common/addon/utils/calendar-event-tooltip.js - About 4 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

                  File current-user.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { isEmpty } from '@ember/utils';
                  import { get } from '@ember/object';
                  import Service, { service } from '@ember/service';
                  import { DateTime } from 'luxon';
                  import jwtDecode from 'ilios-common/utils/jwt-decode';
                  Severity: Minor
                  Found in packages/ilios-common/addon/services/current-user.js - About 3 hrs to fix

                    File user-profile-permissions.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import Component from '@glimmer/component';
                    import { tracked } from '@glimmer/tracking';
                    import { action } from '@ember/object';
                    import { service } from '@ember/service';
                    import { DateTime } from 'luxon';
                    Severity: Minor
                    Found in packages/frontend/app/components/user-profile-permissions.js - About 3 hrs to fix

                      File root.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import Component from '@glimmer/component';
                      import { tracked } from '@glimmer/tracking';
                      import { action } from '@ember/object';
                      import ObjectProxy from '@ember/object/proxy';
                      import { service } from '@ember/service';
                      Severity: Minor
                      Found in packages/frontend/app/components/learner-group/root.js - About 3 hrs to fix

                        File session-overview.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import Component from '@glimmer/component';
                        import { tracked } from '@glimmer/tracking';
                        import { action } from '@ember/object';
                        import { service } from '@ember/service';
                        import { isEmpty } from '@ember/utils';
                        Severity: Minor
                        Found in packages/ilios-common/addon/components/session-overview.js - About 2 hrs to fix

                          File new-sequence-block.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import Component from '@glimmer/component';
                          import { tracked } from '@glimmer/tracking';
                          import { action } from '@ember/object';
                          import { service } from '@ember/service';
                          import { dropTask, restartableTask } from 'ember-concurrency';

                            File course.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import Model, { hasMany, belongsTo, attr } from '@ember-data/model';
                            import sortableByPosition from 'ilios-common/utils/sortable-by-position';
                            import { TrackedAsyncData } from 'ember-async-data';
                            import { cached } from '@glimmer/tracking';
                            import { map } from 'rsvp';
                            Severity: Minor
                            Found in packages/ilios-common/addon/models/course.js - About 2 hrs to fix

                              File new-directory-user.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import Component from '@glimmer/component';
                              import { tracked } from '@glimmer/tracking';
                              import { action } from '@ember/object';
                              import { service } from '@ember/service';
                              import { isEmpty, isPresent } from '@ember/utils';
                              Severity: Minor
                              Found in packages/frontend/app/components/new-directory-user.js - About 2 hrs to fix

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

                                  perform(keys = []) {
                                    let swapped = false;
                                
                                    let compFuncs = keys.map((key) => this.comparator(key));
                                    let compFunc = (a, b) => {
                                Severity: Minor
                                Found in packages/ilios-common/addon/helpers/sort-by.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 transformNode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  transformNode(node) {
                                    if (node.path.original === 'has-error-for') {
                                      if (!node.params[0] || node.params[0].type !== 'PathExpression') {
                                        throw new Error(
                                          'the (has-error-for) helper requires a path to be passed in as its first parameter, received: ' +
                                Severity: Minor
                                Found in packages/ilios-common/lib/has-error-for-transform.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

                                Severity
                                Category
                                Status
                                Source
                                Language