dfcreative/placer

View on GitHub

Showing 5 of 9 total issues

Function place has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function place (element, options) {
    //inherit defaults
    options = softExtend(options, defaults);

    options.target = options.target || options.to || win;
Severity: Minor
Found in index.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 getBestSide has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getBestSide (placee, opts) {
    var initSide = opts.side === 'auto' ? 'bottom' : opts.side;

    var withinRect = offsets(opts.within),
        placeeRect = offsets(placee),
Severity: Minor
Found in index.js - About 1 hr to fix

    Function getParentRect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function getParentRect (target) {
        var rect;
    
        //handle special static body case
        if (target == null || (target === window) || (target === doc.body && getComputedStyle(target).position === 'static') || target === root) {
    Severity: Minor
    Found in index.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 getBestSide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function getBestSide (placee, opts) {
        var initSide = opts.side === 'auto' ? 'bottom' : opts.side;
    
        var withinRect = offsets(opts.within),
            placeeRect = offsets(placee),
    Severity: Minor
    Found in 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 center has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        center: function(placee, opts){
            //get to & within rectangles
            var targetRect = offsets(opts.target);
            var parentRect = getParentRect(placee.offsetParent);
    
    
    Severity: Minor
    Found in index.js - About 25 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