mapbox/geojson-mapnikify

View on GitHub

Showing 6 of 9 total issues

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

module.exports = function(feature, callback) {
    if (!feature.properties) return callback(new Error('Invalid feature'));
    var uri = feature.properties['marker-url'];
    var tint = feature.properties['marker-color'];

Severity: Minor
Found in lib/urlmarker.js - About 1 hr to fix

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

    function getMarker(feature, retina, callback) {
        var fp = feature.properties || {},
            size = fp['marker-size'][0],
            symbol = fp['marker-symbol'] ? fp['marker-symbol'] : '',
            color = fp['marker-color'].replace('#', '');
    Severity: Minor
    Found in index.js - About 1 hr to fix

      Function normalizeFilled has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      function normalizeFilled(properties) {
          if (!hexcolor.test(properties.stroke)) delete properties.stroke;
          if (properties.stroke && properties.stroke[0] !== '#') properties.stroke = '#' + properties.stroke;
          if (isNaN(parseFloat(properties['stroke-width']))) {
              delete properties['stroke-width'];
      Severity: Minor
      Found in lib/normalizestyle.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 normalizeParams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function normalizeParams(options) {
          var params = {};
      
          if(typeof options === 'string') {
              params.uri = options;
      Severity: Minor
      Found in lib/get.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 getMarker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function getMarker(feature, retina, callback) {
          var fp = feature.properties || {},
              size = fp['marker-size'][0],
              symbol = fp['marker-symbol'] ? fp['marker-symbol'] : '',
              color = fp['marker-color'].replace('#', '');
      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 generateXML has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function generateXML(data, retina, callback) {
          var gj = normalize(data),
              q = queue(1);
      
          if (!gj) return callback(new Error('invalid GeoJSON'));
      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