simon-johansson/kommunkoder

View on GitHub
kommunkoder.js

Summary

Maintainability
F
2 wks
Test Coverage

Function 1 has 1161 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.kommunkoder = 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){
module.exports=[{
  "code": "0114",
  "municipality": "Upplands Väsby",
  "county": "Stockholms län"
Severity: Major
Found in kommunkoder.js - About 5 days to fix

    File kommunkoder.js has 1927 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     *   kommunkoder - v1.1.1
     *   Collection of all municipalities in Sweden with corresponding county and municipality codes (kommunkoder).
     *   https://github.com/simon-johansson/kommunkoder
     *   by Simon Johansson <mail@simon-johansson.com>
    Severity: Major
    Found in kommunkoder.js - About 5 days to fix

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

      },{"./baseIsEqualDeep":12}],12:[function(require,module,exports){
      var equalArrays = require('./equalArrays'),
          equalByTag = require('./equalByTag'),
          equalObjects = require('./equalObjects'),
          isArray = require('../lang/isArray'),
      Severity: Major
      Found in kommunkoder.js - About 2 hrs to fix

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

        function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
          var objIsArr = isArray(object),
              othIsArr = isArray(other),
              objTag = arrayTag,
              othTag = arrayTag;
        Severity: Minor
        Found in kommunkoder.js - About 1 hr to fix

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

          },{}],22:[function(require,module,exports){
          var keys = require('../object/keys');
          
          /** Used for native method references. */
          var objectProto = Object.prototype;
          Severity: Minor
          Found in kommunkoder.js - About 1 hr to fix

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

            },{"../internal/isObjectLike":26}],37:[function(require,module,exports){
            var isLength = require('../internal/isLength'),
                isObjectLike = require('../internal/isObjectLike');
            
            /** `Object#toString` result references. */
            Severity: Minor
            Found in kommunkoder.js - About 1 hr to fix

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

              function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
                var objProps = keys(object),
                    objLength = objProps.length,
                    othProps = keys(other),
                    othLength = othProps.length;
              Severity: Minor
              Found in kommunkoder.js - About 1 hr to fix

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

                },{"../lang/isArray":32,"../lang/isTypedArray":37,"./equalArrays":20,"./equalByTag":21,"./equalObjects":22}],13:[function(require,module,exports){
                var baseIsEqual = require('./baseIsEqual');
                
                /** Used for native method references. */
                var objectProto = Object.prototype;
                Severity: Minor
                Found in kommunkoder.js - About 1 hr to fix

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

                  },{"../utility/identity":43}],20:[function(require,module,exports){
                  /**
                   * A specialized version of `baseIsEqualDeep` for arrays with support for
                   * partial deep comparisons.
                   *
                  Severity: Minor
                  Found in kommunkoder.js - About 1 hr to fix

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

                    },{"../internal/isLength":25,"../internal/shimKeys":29,"../lang/isNative":33,"../lang/isObject":35}],40:[function(require,module,exports){
                    var isArguments = require('../lang/isArguments'),
                        isArray = require('../lang/isArray'),
                        isIndex = require('../internal/isIndex'),
                        isLength = require('../internal/isLength'),
                    Severity: Minor
                    Found in kommunkoder.js - About 1 hr to fix

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

                      },{}],2:[function(require,module,exports){
                      'use strict';
                      
                      var isUndefined = require('lodash/lang/isUndefined');
                      var isArray =     require('lodash/lang/isArray');
                      Severity: Minor
                      Found in kommunkoder.js - About 1 hr to fix

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

                        function equalArrays(array, other, equalFunc, customizer, isWhere, stackA, stackB) {
                          var index = -1,
                              arrLength = array.length,
                              othLength = other.length,
                              result = true;
                        Severity: Minor
                        Found in kommunkoder.js - About 1 hr to fix

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

                          function baseIsMatch(object, props, values, strictCompareFlags, customizer) {
                            var length = props.length;
                            if (object == null) {
                              return !length;
                            }
                          Severity: Minor
                          Found in kommunkoder.js - About 1 hr to fix

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

                            },{"./baseIsEqual":11}],14:[function(require,module,exports){
                            var baseIsMatch = require('./baseIsMatch'),
                                isStrictComparable = require('./isStrictComparable'),
                                keys = require('../object/keys');
                            
                            
                            Severity: Minor
                            Found in kommunkoder.js - About 1 hr to fix

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

                              },{}],19:[function(require,module,exports){
                              var identity = require('../utility/identity');
                              
                              /**
                               * A specialized version of `baseCallback` which only supports `this` binding
                              Severity: Minor
                              Found in kommunkoder.js - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
                                        !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
                                      return false;
                                    }
                                Severity: Major
                                Found in kommunkoder.js - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                    if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') ||
                                        value == null || other == null) {
                                      // Return `false` unless both values are `NaN`.
                                      return value !== value && other !== other;
                                    }
                                  Severity: Major
                                  Found in kommunkoder.js - About 1 hr to fix

                                    Function baseIsEqualDeep has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
                                    Severity: Major
                                    Found in kommunkoder.js - About 50 mins to fix

                                      Function equalArrays has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      function equalArrays(array, other, equalFunc, customizer, isWhere, stackA, stackB) {
                                      Severity: Major
                                      Found in kommunkoder.js - About 50 mins to fix

                                        Function equalObjects has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
                                        Severity: Major
                                        Found in kommunkoder.js - About 50 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                    if (result) {
                                                      break;
                                                    }
                                          Severity: Major
                                          Found in kommunkoder.js - About 45 mins to fix

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

                                            function baseIsEqual(value, other, customizer, isWhere, stackA, stackB) {
                                            Severity: Minor
                                            Found in kommunkoder.js - About 45 mins to fix

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

                                              function baseIsMatch(object, props, values, strictCompareFlags, customizer) {
                                              Severity: Minor
                                              Found in kommunkoder.js - About 35 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                  return result;
                                                Severity: Major
                                                Found in kommunkoder.js - About 30 mins to fix

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                  },{}],36:[function(require,module,exports){
                                                  var isObjectLike = require('../internal/isObjectLike');
                                                  
                                                  /** `Object#toString` result references. */
                                                  var stringTag = '[object String]';
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 4 hrs to fix
                                                  kommunkoder.js on lines 2355..2399

                                                  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 126.

                                                  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

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                  },{"../internal/isObjectLike":26,"../string/escapeRegExp":41}],34:[function(require,module,exports){
                                                  var isObjectLike = require('../internal/isObjectLike');
                                                  
                                                  /** `Object#toString` result references. */
                                                  var numberTag = '[object Number]';
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 4 hrs to fix
                                                  kommunkoder.js on lines 2431..2469

                                                  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 126.

                                                  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

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

                                                  function get (query) {
                                                    if (isUndefined(query)) {
                                                      return data;
                                                    } if (isArray(query)) {
                                                      return iterateOverQuery(query);
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 4 hrs to fix
                                                  index.js on lines 28..40

                                                  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 118.

                                                  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

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                  typedArrayTags[dateTag] = typedArrayTags[errorTag] =
                                                  typedArrayTags[funcTag] = typedArrayTags[mapTag] =
                                                  typedArrayTags[numberTag] = typedArrayTags[objectTag] =
                                                  typedArrayTags[regexpTag] = typedArrayTags[setTag] =
                                                  typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 1 hr to fix
                                                  kommunkoder.js on lines 2501..2505

                                                  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 73.

                                                  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

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                  typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
                                                  typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
                                                  typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
                                                  typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
                                                  typedArrayTags[uint32Tag] = true;
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 1 hr to fix
                                                  kommunkoder.js on lines 2508..2512

                                                  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 73.

                                                  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

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                    if (!othIsArr) {
                                                      othTag = objToString.call(other);
                                                      if (othTag == argsTag) {
                                                        othTag = objectTag;
                                                      } else if (othTag != objectTag) {
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 1 hr to fix
                                                  kommunkoder.js on lines 1557..1564

                                                  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 65.

                                                  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

                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                  Open

                                                    if (!objIsArr) {
                                                      objTag = objToString.call(object);
                                                      if (objTag == argsTag) {
                                                        objTag = objectTag;
                                                      } else if (objTag != objectTag) {
                                                  Severity: Major
                                                  Found in kommunkoder.js and 1 other location - About 1 hr to fix
                                                  kommunkoder.js on lines 1565..1572

                                                  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 65.

                                                  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