ilios/frontend

View on GitHub

Showing 90 of 90 total issues

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

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

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

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

  async getDataObjects(sessions) {
    if (!sessions) {
      return [];
    }

Severity: Minor
Found in packages/ilios-common/addon/components/visualizer-course-objectives.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

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

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

        get compiledCalendarEvents() {
          if (this.args.selectedView === 'day') {
            return this.args.calendarEvents;
          } else {
            const hashedEvents = {};
      Severity: Minor
      Found in packages/ilios-common/addon/components/ilios-calendar.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 moveFocus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        @action
        moveFocus(event) {
          const { key, target } = event;
          switch (key) {
            case 'ArrowDown':
      Severity: Minor
      Found in packages/frontend/app/components/locale-chooser.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