hhff/ember-infinity

View on GitHub

Showing 7 of 7 total issues

Function model has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  model(modelName, options, ExtendedInfinityModel) {
    if (typeOf(ExtendedInfinityModel) === "class") {
      if (!(ExtendedInfinityModel.prototype instanceof InfinityModel)) {
        throw new EmberError("Ember Infinity: You must pass an Infinity Model instance as the third argument");
      }
Severity: Major
Found in addon/services/infinity.js - About 3 hrs to fix

    Function model has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      model(modelName, options, ExtendedInfinityModel) {
        if (typeOf(ExtendedInfinityModel) === "class") {
          if (!(ExtendedInfinityModel.prototype instanceof InfinityModel)) {
            throw new EmberError("Ember Infinity: You must pass an Infinity Model instance as the third argument");
          }
    Severity: Minor
    Found in addon/services/infinity.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

    File infinity.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Service from '@ember/service';
    import InfinityModel from 'ember-infinity/lib/infinity-model';
    import InfinityPromiseArray from 'ember-infinity/lib/infinity-promise-array';
    import EmberError from '@ember/error';
    import { getOwner } from '@ember/application';
    Severity: Minor
    Found in addon/services/infinity.js - About 2 hrs to fix

      Function canLoadMore has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        get canLoadMore() {
          if (typeof this._canLoadMore === 'boolean') {
            return this._canLoadMore;
          }
      
      
      Severity: Minor
      Found in addon/lib/infinity-model.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 loadNextPage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        loadNextPage(infinityModel, increment = 1) {
          set(infinityModel, 'isLoaded', false);
          set(infinityModel, 'loadingMore', true);
          set(this, '_previousScrollHeight', this._calculateHeight(infinityModel));
      
      
      Severity: Minor
      Found in addon/services/infinity.js - About 1 hr to fix

        Function objectAssign has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export let objectAssign = Object.assign || function objectAssign(target) {
          'use strict';
          if (target == null) {
            throw new TypeError('Cannot convert undefined or null to object');
          }
        Severity: Minor
        Found in addon/utils.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

        Avoid too many return statements within this function.
        Open

            return false;
        Severity: Major
        Found in addon/lib/infinity-model.js - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language