hktysk/react-stack-gallery

View on GitHub

Showing 3 of 3 total issues

Function _interopRequireWildcard has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
Severity: Minor
Found in build/index.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

Function placeItems has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function placeItems(
  screen: number,
  lines: number,
  marginPerc: number,
  square: boolean
Severity: Minor
Found in src/placeItems.ts - About 1 hr to fix

    Function placeItems has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function placeItems(screen, lines, marginPerc, square) {
      var items = Array.from(document.getElementsByClassName('like-pinterst-gallery-cards'));
      var margin = {
        one: Math.floor(screen * marginPerc),
        half: Math.floor(screen * marginPerc / 2),
    Severity: Minor
    Found in build/placeItems.js - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language