rahulkapoor90/VITacademics-Enhancement-Suite

View on GitHub
Extension for Firefox/scripts/zip/jszip.js

Summary

Maintainability
F
1 yr
Test Coverage

File jszip.js has 6421 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!

JSZip v3.1.3 - A Javascript class for generating and reading zip files
<http://stuartk.com/jszip>

Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 wks to fix

Function 70 has 984 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],70:[function(require,module,exports){
'use strict';


var utils         = require('../utils/common');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 4 days to fix

Function 67 has 957 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],67:[function(require,module,exports){
'use strict';

var utils   = require('../utils/common');
var trees   = require('./trees');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 4 days to fix

Function inflate has 775 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function inflate(strm, flush) {
  var state;
  var input, output;          // input/output buffers
  var next;                   /* next input INDEX */
  var put;                    /* next output INDEX */
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 3 days to fix

Function 73 has 455 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],73:[function(require,module,exports){
'use strict';


var utils = require('../utils/common');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 days to fix

Function 8 has 295 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./stream/GenericWorker":28,"./utils":32,"pako":59}],8:[function(require,module,exports){
'use strict';

var utils = require('../utils');
var GenericWorker = require('../stream/GenericWorker');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 day to fix

Function 32 has 293 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(require,module,exports){
'use strict';

var support = require('./support');
var base64 = require('./base64');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 day to fix

Function deflate has 256 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflate(strm, flush) {
  var old_flush, s;
  var beg, val; // for gzip header write only

  if (!strm || !strm.state ||
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 day to fix

Function 15 has 224 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],15:[function(require,module,exports){
'use strict';
var utf8 = require('./utf8');
var utils = require('./utils');
var GenericWorker = require('./stream/GenericWorker');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 day to fix

Function 58 has 223 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],58:[function(require,module,exports){
'use strict';
var immediate = require('immediate');

/* istanbul ignore next */
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 day to fix

Function 69 has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],69:[function(require,module,exports){
'use strict';

// See state defs from inflate.js
var BAD = 30;       /* got a data error -- remain here until reset */
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 7 hrs to fix

Function 34 has 175 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(require,module,exports){
'use strict';
var readerFor = require('./reader/readerFor');
var utils = require('./utils');
var CompressedObject = require('./compressedObject');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 7 hrs to fix

Function inflate_fast has 174 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function inflate_fast(strm, start) {
  var state;
  var _in;                    /* local strm.input */
  var last;                   /* have enough input while in < last */
  var _out;                   /* local strm.output */
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 6 hrs to fix

Function 31 has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"readable-stream":16}],31:[function(require,module,exports){
'use strict';

var utils = require('./utils');
var support = require('./support');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 6 hrs to fix

Function 33 has 160 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"core-js/library/fn/set-immediate":36}],33:[function(require,module,exports){
'use strict';
var readerFor = require('./reader/readerFor');
var utils = require('./utils');
var sig = require('./signature');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 6 hrs to fix

Function 61 has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./utils/common":62,"./utils/strings":63,"./zlib/deflate":67,"./zlib/messages":72,"./zlib/zstream":74}],61:[function(require,module,exports){
'use strict';


var zlib_inflate = require('./zlib/inflate');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 6 hrs to fix

Function 60 has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./lib/deflate":60,"./lib/inflate":61,"./lib/utils/common":62,"./lib/zlib/constants":65}],60:[function(require,module,exports){
'use strict';


var zlib_deflate = require('./zlib/deflate');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 6 hrs to fix

Function 71 has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../utils/common":62,"./adler32":64,"./crc32":66,"./inffast":69,"./inftrees":71}],71:[function(require,module,exports){
'use strict';


var utils = require('../utils/common');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 5 hrs to fix

Function 28 has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../utils":32,"./GenericWorker":28}],28:[function(require,module,exports){
'use strict';

/**
 * A worker that does nothing but passing chunks to the next one. This is like
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 5 hrs to fix

Function 29 has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],29:[function(require,module,exports){
'use strict';

var utils = require('../utils');
var ConvertWorker = require('./ConvertWorker');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 5 hrs to fix

Function inflate_table has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
{
  var bits = opts.bits;
      //here = opts.here; /* table entry for duplication */

Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 4 hrs to fix

Function 63 has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],63:[function(require,module,exports){
// String encode/decode helpers
'use strict';


Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 4 hrs to fix

Function generateZipParts has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) {
    var file = streamInfo['file'],
    compression = streamInfo['compression'],
    useCustomEncoding = encodeFileName !== utf8.utf8encode,
    encodedFileName = utils.transformTo("string", encodeFileName(file.name)),
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 4 hrs to fix

Function 27 has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../utils":32,"./GenericWorker":28}],27:[function(require,module,exports){
'use strict';

var utils = require('../utils');
var GenericWorker = require('./GenericWorker');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 3 hrs to fix

Function push has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Inflate.prototype.push = function (data, mode) {
  var strm = this.strm;
  var chunkSize = this.options.chunkSize;
  var dictionary = this.options.dictionary;
  var status, _mode;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 3 hrs to fix

Function deflate_slow has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflate_slow(s, flush) {
  var hash_head;          /* head of hash chain */
  var bflush;              /* set if current block must be flushed */

  var max_insert;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 3 hrs to fix

Function 35 has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(require,module,exports){
'use strict';

var StreamHelper = require('./stream/StreamHelper');
var DataWorker = require('./stream/DataWorker');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 62 has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./utils/common":62,"./utils/strings":63,"./zlib/constants":65,"./zlib/gzheader":68,"./zlib/inflate":70,"./zlib/messages":72,"./zlib/zstream":74}],62:[function(require,module,exports){
'use strict';


var TYPED_OK =  (typeof Uint8Array !== 'undefined') &&
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 11 has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var external = require("./external");
var utf8 = require('./utf8');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 1 has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var support = require('./support');
// private property
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 54 has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],54:[function(require,module,exports){
var ctx                = require('./_ctx')
  , invoke             = require('./_invoke')
  , html               = require('./_html')
  , cel                = require('./_dom-create')
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 57 has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./_export":44,"./_task":54}],57:[function(require,module,exports){
(function (global){
'use strict';
var Mutation = global.MutationObserver || global.WebKitMutationObserver;

Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function deflate_fast has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflate_fast(s, flush) {
  var hash_head;        /* head of the hash chain */
  var bflush;           /* set if current block must be flushed */

  for (;;) {
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function deflateSetDictionary has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflateSetDictionary(strm, dictionary) {
  var dictLength = dictionary.length;

  var s;
  var str, n;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

      if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
        strend = s.strstart + MAX_MATCH;
        do {
          /*jshint noempty:false*/
        } while (prev === _win[++scan] && prev === _win[++scan] &&
Severity: Critical
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function deflate_rle has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflate_rle(s, flush) {
  var bflush;            /* set if current block must be flushed */
  var prev;              /* byte at distance one to match */
  var scan, strend;      /* scan goes up to strend for length of run */

Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 18 has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../utils":32,"./DataReader":18}],18:[function(require,module,exports){
'use strict';
var utils = require('../utils');

function DataReader(data) {
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 12 has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(require,module,exports){
"use strict";

var utils = require('../utils');
var GenericWorker = require('../stream/GenericWorker');
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function Deflate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Deflate(options) {
  if (!(this instanceof Deflate)) return new Deflate(options);

  this.options = utils.assign({
    level: Z_DEFAULT_COMPRESSION,
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function 44 has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./_global":46,"./_is-object":51}],44:[function(require,module,exports){
var global    = require('./_global')
  , core      = require('./_core')
  , ctx       = require('./_ctx')
  , hide      = require('./_hide')
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 2 hrs to fix

Function tr_static_init has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function tr_static_init() {
  var n;        /* iterates over tree elements */
  var bits;     /* bit counter */
  var length;   /* length value */
  var code;     /* code value */
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function deflate_stored has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflate_stored(s, flush) {
  /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
   * to pending_buf_size, and each stored block has a 5 byte header:
   */
  var max_block_size = 0xffff;
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(data, options) {
    var zip = this;
    options = utils.extend(options || {}, {
        base64: false,
        checkCRC32: false,
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function readEndOfCentral has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    readEndOfCentral: function() {
        var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
        if (offset < 0) {
            // Check if the content is a truncated zip or complete garbage.
            // A "LOCAL_FILE_HEADER" is not required at the beginning (auto
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function push has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Deflate.prototype.push = function (data, mode) {
  var strm = this.strm;
  var chunkSize = this.options.chunkSize;
  var status, _mode;

Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function fileAdd has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var fileAdd = function(name, data, originalOptions) {
    // be sure sub folders exist
    var dataType = utils.getTypeOf(data),
        parent;

Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function fill_window has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function fill_window(s) {
  var _w_size = s.w_size;
  var p, n, m, more, str;

  //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function deflateInit2 has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
  if (!strm) { // === Z_NULL
    return Z_STREAM_ERROR;
  }
  var wrap = 1;
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

var string2buf = function (str) {
    var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;

    // count binary size
    for (m_pos = 0; m_pos < str_len; m_pos++) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

},{"./support":30,"./utils":32}],2:[function(require,module,exports){
'use strict';

var external = require("./external");
var DataWorker = require('./stream/DataWorker');
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

function longest_match(s, cur_match) {
  var chain_length = s.max_chain_length;      /* max hash chain length */
  var scan = s.strstart; /* current string */
  var match;                       /* matched string */
  var len;                           /* length of current match */
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 17 has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"stream":undefined}],17:[function(require,module,exports){
'use strict';
var DataReader = require('./DataReader');
var utils = require('../utils');

Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||
    windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
    strategy < 0 || strategy > Z_FIXED) {
    return err(strm, Z_STREAM_ERROR);
  }
Severity: Critical
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function decode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.decode = function(input) {
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0, resultIndex = 0;

Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function gen_bitlen has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function gen_bitlen(s, desc)
//    deflate_state *s;
//    tree_desc *desc;    /* the tree descriptor */
{
  var tree            = desc.dyn_tree;
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 7 has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"lie":58}],7:[function(require,module,exports){
'use strict';
var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined');

var pako = require("pako");
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 4 has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"./flate":7,"./stream/GenericWorker":28}],4:[function(require,module,exports){
'use strict';

var utils = require('./utils');

Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function generateInternalStream has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    generateInternalStream: function(options) {
      var worker, opts = {};
      try {
          opts = utils.extend(options || {}, {
              streamFiles: false,
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function string2buf has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.string2buf = function (str) {
  var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;

  // count binary size
  for (m_pos = 0; m_pos < str_len; m_pos++) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function prepareContent has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {

    // if inputData is already a promise, this flatten it.
    var promise = external.Promise.resolve(inputData).then(function(data) {
        
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function send_tree has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function send_tree(s, tree, max_code)
//    deflate_state *s;
//    ct_data *tree; /* the tree to be scanned */
//    int max_code;       /* and its largest code of non zero frequency */
{
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 9 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(require,module,exports){
'use strict';

var compressions = require('../compressions');
var ZipFileWorker = require('./ZipFileWorker');
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function deflate_huff has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deflate_huff(s, flush) {
  var bflush;             /* set if current block must be flushed */

  for (;;) {
    /* Make sure that we have a literal to write. */
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function Inflate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Inflate(options) {
  if (!(this instanceof Inflate)) return new Inflate(options);

  this.options = utils.assign({
    chunkSize: 16384,
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function $export has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var $export = function(type, name, source){
  var IS_FORCED = type & $export.F
    , IS_GLOBAL = type & $export.G
    , IS_STATIC = type & $export.S
    , IS_PROTO  = type & $export.P
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 30 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(require,module,exports){
'use strict';

exports.base64 = true;
exports.array = true;
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function all has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function all(iterable) {
  var self = this;
  if (Object.prototype.toString.call(iterable) !== '[object Array]') {
    return this.reject(new TypeError('must be an array'));
  }
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function updatewindow has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updatewindow(strm, src, end, copy) {
  var dist;
  var state = strm.state;

  /* if it hasn't been done already, allocate space for the window */
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function buf2string has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var buf2string = function (buf) {
    var str, i, out, c, c_len;
    var len = buf.length;

    // Reserve max possible length (2 words per char)
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 10 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{"../compressions":3,"./ZipFileWorker":8}],10:[function(require,module,exports){
'use strict';

/**
 * Representation a of zip file in js
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function 65 has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],65:[function(require,module,exports){
'use strict';


module.exports = {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function _tick has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

DataWorker.prototype._tick = function() {

    if(this.isPaused || this.isFinished) {
        return false;
    }
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function race has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function race(iterable) {
  var self = this;
  if (Object.prototype.toString.call(iterable) !== '[object Array]') {
    return this.reject(new TypeError('must be an array'));
  }
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function accumulate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function accumulate(helper, updateCallback) {
    return new external.Promise(function (resolve, reject){
        var dataArray = [];
        var chunkType = helper._internalType,
            resultType = helper._outputType,
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function processChunk has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Utf8DecodeWorker.prototype.processChunk = function (chunk) {

    var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data);

    // 1st step, re-use what's left of the previous chunk
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

},{"../stream/GenericWorker":28,"../utils":32}],13:[function(require,module,exports){
'use strict';

var Readable = require('readable-stream').Readable;

Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

NodejsStreamInputAdapter.prototype._bindStream = function (stream) {
    var self = this;
    this._stream = stream;
    stream.pause();
    stream
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

function _tr_flush_block(s, buf, stored_len, last)
//DeflateState *s;
//charf *buf;       /* input block, or NULL if too old */
//ulg stored_len;   /* length of input block */
//int last;         /* one if this is the last block for a file */
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

function scan_tree(s, tree, max_code)
//    deflate_state *s;
//    ct_data *tree;   /* the tree to be scanned */
//    int max_code;    /* and its largest code of non zero frequency */
{
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

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

function build_tree(s, desc)
//    deflate_state *s;
//    tree_desc *desc; /* the tree descriptor */
{
  var tree     = desc.dyn_tree;
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

  if (status !== INIT_STATE &&
    status !== EXTRA_STATE &&
    status !== NAME_STATE &&
    status !== COMMENT_STATE &&
    status !== HCRC_STATE &&
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function exports has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 1 hr to fix

Function deflateInit2 has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Function generateZipParts has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

var generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          while (copy--) {
            state.lens[state.have++] = len;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if ((here_bits) <= bits) { break; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.pending === s.pending_buf_size) {
            val = 1;
            break;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (state.flags & 0x0200) {
            state.check = crc32(state.check, input, copy, next);
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if ((last_bits + here_bits) <= bits) { break; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (state.head && len &&
              (state.length < 65536 /*state.head.name_max*/)) {
            state.head.name += String.fromCharCode(len);
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.gzhead.hcrc && s.pending > beg) {
            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.lookahead === 0) {
            s.strstart = 0;
            s.block_start = 0;
            s.insert = 0;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (state.sane) {
            strm.msg = 'invalid distance too far back';
            state.mode = BAD;
            break;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (state.head) {
            len = state.head.extra_len - state.length;
            if (!state.head.extra) {
              // Use untyped array for more conveniend processing later
              state.head.extra = new Array(state.head.extra_len);
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if ((last_bits + here_bits) <= bits) { break; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.gzhead.hcrc && s.pending > beg) {
            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.gzhead.hcrc && s.pending > beg) {
            strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.pending === s.pending_buf_size) {
            val = 1;
            break;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (state.have + copy > state.nlen + state.ndist) {
            strm.msg = 'invalid bit length repeat';
            state.mode = BAD;
            break;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (s.pending === s.pending_buf_size) {
            break;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (bits < op) {
            hold += input[_in++] << bits;
            bits += 8;
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (op & 16) {                      /* distance base */
            dist = here & 0xffff/*here.val*/;
            op &= 15;                       /* number of extra bits */
            if (bits < op) {
              hold += input[_in++] << bits;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (state.head && len &&
              (state.length < 65536 /*state.head.comm_max*/)) {
            state.head.comment += String.fromCharCode(len);
          }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (here_val === 16) {
            //=== NEEDBITS(here.bits + 2);
            n = here_bits + 2;
            while (bits < n) {
              if (have === 0) { break inf_leave; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

        if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
            this.zip64 = true;

            /*
            Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 40 mins to fix

Function Config has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function Config(good_length, max_lazy, nice_length, max_chain, func) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Function StaticTreeDesc has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Function CompressedObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Function generateCentralDirectoryEnd has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Function prepareContent has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Function arraySet has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  arraySet: function (dest, src, src_offs, len, dest_offs) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Function arraySet has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  arraySet: function (dest, src, src_offs, len, dest_offs) {
Severity: Minor
Found in Extension for Firefox/scripts/zip/jszip.js - About 35 mins to fix

Avoid too many return statements within this function.
Open

  return 0;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return Z_OK;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return BS_NEED_MORE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return err(strm, Z_BUF_ERROR);
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return Z_OK;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return BS_BLOCK_DONE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return Z_OK;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return BS_FINISH_DONE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return BS_BLOCK_DONE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  if (s.wrap <= 0) { return Z_STREAM_END; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return true;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return 1;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return BS_BLOCK_DONE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return s.pending !== 0 ? Z_OK : Z_STREAM_END;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return BS_NEED_MORE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return BS_BLOCK_DONE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  if (flush !== Z_FINISH) { return Z_OK; }
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return "arraybuffer";
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return BS_NEED_MORE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return BS_NEED_MORE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return BS_NEED_MORE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return true;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return BS_FINISH_DONE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return BS_NEED_MORE;
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js - About 30 mins to fix

Identical blocks of code found in 3 locations. Consider refactoring.
Open

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var support = require('./support');
// private property
Severity: Major
Found in Extension for Firefox/scripts/zip/jszip.js and 2 other locations - About 1 yr to fix
Extension for Edge/scripts/zip/jszip.js on lines 13..11391
Extension for chrome/scripts/zip/jszip.js on lines 13..11391

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78010.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status