meandmax/lory

View on GitHub
src/lory.js

Summary

Maintainability
F
5 days
Test Coverage

Function lory has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
Open

export function lory (slider, opts) {
    let position;
    let slidesWidth;
    let frameWidth;
    let slides;
Severity: Minor
Found in src/lory.js - About 2 days 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 lory has 353 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function lory (slider, opts) {
    let position;
    let slidesWidth;
    let frameWidth;
    let slides;
Severity: Major
Found in src/lory.js - About 1 day to fix

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

    /* globals jQuery */
    
    import detectPrefixes from './utils/detect-prefixes.js';
    import supportsPassive from './utils/detect-supportsPassive';
    import dispatchEvent from './utils/dispatch-event.js';
    Severity: Minor
    Found in src/lory.js - About 4 hrs to fix

      Function slide has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function slide (nextIndex, direction) {
              const {
                  slideSpeed,
                  slidesToScroll,
                  infinite,
      Severity: Major
      Found in src/lory.js - About 3 hrs to fix

        Function setup has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function setup () {
                dispatchSliderEvent('before', 'init');
        
                prefixes = detectPrefixes();
                options = {...defaults, ...opts};
        Severity: Minor
        Found in src/lory.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status