ilios/frontend

View on GitHub

Showing 92 of 92 total issues

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 validatable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function validatable(target) {
  return class extends target {
    @tracked _evdVisibleErrors = [];
    @tracked _evdShowAllErrors = false;

Severity: Minor
Found in packages/ilios-common/addon/decorators/validation/validatable.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 performsNonLearnerFunction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  get performsNonLearnerFunction() {
    if (this._directedCoursesData.isResolved && this._directedCoursesData.value.length) {
      return true;
    }
    if (this._administeredCoursesData.isResolved && this._administeredCoursesData.value.length) {
Severity: Minor
Found in packages/ilios-common/addon/models/user.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 sortIcon has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  get sortIcon() {
    if (this.sortedBy) {
      if (this.sortedAscending) {
        return this.sortType === 'numeric' ? 'arrow-down-1-9' : 'arrow-down-a-z';
      } else {
Severity: Minor
Found in packages/ilios-common/addon/components/sortable-heading.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 addDate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  @action
  addDate(which) {
    if (which == 'endDate') {
      if (this['startDate']) {
        this.updateOtherDate('endDate', this['startDate']);
Severity: Minor
Found in packages/ilios-common/addon/components/learningmaterial-manager.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 sortIcon has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  get sortIcon() {
    if (this.sortedBy) {
      if (this.sortedAscending) {
        return this.sortType === 'numeric' ? 'arrow-down-1-9' : 'arrow-down-a-z';
      } else {
Severity: Minor
Found in packages/ilios-common/addon/components/sortable-th.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 keyboard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  @action
  keyboard(event) {
    const keyCode = event.keyCode;
    const target = event.target;

Severity: Minor
Found in packages/frontend/app/components/new-directory-user.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 extractQueryParams has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const extractQueryParams = function (request) {
  const params = Object.keys(request.queryParams);
  const rhett = {
    filterParams: [],
    queryTerms: [],
Severity: Minor
Found in packages/ilios-common/addon-mirage-support/get-all.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 installUUIDPolyfill has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function installUUIDPolyfill() {
  const CRYPTO = window.crypto;

  if (!CRYPTO.randomUUID) {
    // we might be able to optimize this by requesting more bytes than we need at a time
Severity: Minor
Found in packages/ilios-common/addon/utils/load-polyfills.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 sortAsc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function sortAsc(key, a, b) {
  if (isEmpty(key)) {
    return 0;
  }

Severity: Minor
Found in packages/ilios-common/addon/helpers/sort-by.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 getRolesInSchool has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  async getRolesInSchool(school, rolesToCheck = []) {
    const roles = [];
    if (rolesToCheck.includes('SCHOOL_DIRECTOR') && (await this.isDirectingSchool(school))) {
      roles.push('SCHOOL_DIRECTOR');
    }
Severity: Minor
Found in packages/ilios-common/addon/services/current-user.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 sortDesc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function sortDesc(key, a, b) {
  if (isEmpty(key)) {
    return 0;
  }

Severity: Minor
Found in packages/ilios-common/addon/helpers/sort-by.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 updateDate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  @action
  updateDate(which, value) {
    const { hour, minute } = DateTime.fromJSDate(this[which]);
    const { year, ordinal } = DateTime.fromJSDate(value);
    this[which] = DateTime.fromObject({
Severity: Minor
Found in packages/ilios-common/addon/components/learningmaterial-manager.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 getShowCopy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  async getShowCopy(session) {
    if (this.router.currentRouteName === 'session.copy') {
      return false;
    }

Severity: Minor
Found in packages/ilios-common/addon/components/session-overview.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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (environment) {
  const ENV = {
    modulePrefix: 'frontend',
    environment,
    rootURL: '/',
Severity: Minor
Found in packages/frontend/config/environment.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

Consider simplifying this complex logical expression.
Open

    if (
      !this._offeringInstructorsData?.isResolved ||
      !this._offeringInstructorGroupsInstructors?.isResolved ||
      (this.isIndependentLearning && !this._ilmInstructorsData?.isResolved) ||
      (this.isIndependentLearning && !this._ilmSessionInstructorGroupsInstructorsData?.isResolved)
Severity: Major
Found in packages/ilios-common/addon/models/session.js - About 40 mins to fix

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

    export default async function cloneLearnerGroup(store, group, cohort, withLearners, parent = null) {
    Severity: Minor
    Found in packages/frontend/app/utils/clone-learner-group.js - About 35 mins to fix

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

        @action
        moveFocus({ key, target }) {
          switch (key) {
            case 'ArrowDown':
              if (target.nextElementSibling) {
      Severity: Minor
      Found in packages/ilios-common/addon/components/course/publication-menu.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 getBrowserLogo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        getBrowserLogo(id) {
          if (id === 'ios_saf') {
            id = 'safari-ios';
          }
          if (id === 'samsung') {
      Severity: Minor
      Found in packages/lti-dashboard/lib/ilios-error/index.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 getGraphQLFilters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        async getGraphQLFilters(prepositionalObject, prepositionalObjectTableRowId, school) {
          let rhett = [];
          if (school) {
            rhett.push(`schools: [${school.id}]`);
          }
      Severity: Minor
      Found in packages/frontend/app/components/reports/subject/learning-material.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

      Severity
      Category
      Status
      Source
      Language