crossfilter/universe

View on GitHub

Showing 61 of 61 total issues

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

module.exports = function (service) {
  var filters = require('./filters')(service)

  return function reductiofy(query) {
    var reducer = reductio()
Severity: Minor
Found in src/reductiofy.js - About 1 hr to fix

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

    function universe(data, options) {
      var service = {
        options: _.assign({}, options),
        columns: [],
        filters: {},
    Severity: Minor
    Found in src/universe.js - About 1 hr to fix

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

        return function reductiofy(query) {
          var reducer = reductio()
          // var groupBy = query.groupBy // groupBy is defined but never used
          aggregateOrNest(reducer, query.select)
      
      
      Severity: Minor
      Found in src/reductiofy.js - About 1 hr to fix

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

        function convertAggregatorString(keyString) {
          // var obj = {} // obj is defined but not used
        
          // 1. unwrap top parentheses
          // 2. detect arrays
        Severity: Minor
        Found in src/aggregation.js - About 1 hr to fix

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

          module.exports = function (service) {
            return {
              make: make,
              makeAccessor: makeAccessor,
            }
          Severity: Minor
          Found in src/dimension.js - About 1 hr to fix

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

              function onFilter(cb) {
                service.filterListeners.push(cb)
                return function () {
                  service.filterListeners.splice(service.filterListeners.indexOf(cb), 1)
                }
            Severity: Major
            Found in src/universe.js and 1 other location - About 1 hr to fix
            src/universe.js on lines 39..44

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

            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

              function onDataChange(cb) {
                service.dataListeners.push(cb)
                return function () {
                  service.dataListeners.splice(service.dataListeners.indexOf(cb), 1)
                }
            Severity: Major
            Found in src/universe.js and 1 other location - About 1 hr to fix
            src/universe.js on lines 46..51

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

            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

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

              function buildFilterObject(fil, isRange, replace) {
                if (_.isUndefined(fil)) {
                  return false
                }
                if (_.isFunction(fil)) {
            Severity: Minor
            Found in src/filters.js - About 1 hr to fix

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

                  var ds = _.map(newFilters, function (fil, i) {
                    var existing = service.filters[i]
                    // Filters are the same, so no change is needed on this column
                    if (fil === existing) {
                      return Promise.resolve()
              Severity: Minor
              Found in src/filters.js - About 1 hr to fix

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

                function $not(d, child) {
                  child = child(d)
                  for (var i = 0; i < child.length; i++) {
                    if (child[i]) {
                      return false
                Severity: Major
                Found in src/expressions.js and 1 other location - About 1 hr to fix
                src/expressions.js on lines 47..55

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

                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

                function $or(d, child) {
                  child = child(d)
                  for (var i = 0; i < child.length; i++) {
                    if (child[i]) {
                      return true
                Severity: Major
                Found in src/expressions.js and 1 other location - About 1 hr to fix
                src/expressions.js on lines 57..65

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

                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

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

                  function unwrapParensAndCommas(str) {
                    str = str.replace(' ', '')
                    return (
                      '"' +
                      str.replace(outerParens, function(p, pr) {
                Severity: Minor
                Found in src/aggregation.js - About 1 hr to fix

                  Function recurseObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function recurseObject(obj, cb) {
                    _recurseObject(obj, [])
                    return obj
                    function _recurseObject(obj, path) {
                      for (var k in obj) { //  eslint-disable-line guard-for-in
                  Severity: Minor
                  Found in src/lodash.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 makeSubAggregationFunction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function makeSubAggregationFunction(obj) {
                    // If its an object, either unwrap all of the properties as an
                    // array of keyValues, or unwrap the first keyValue set as an object
                    obj = _.isObject(obj) ? extractKeyValOrArray(obj) : obj
                  
                  
                  Severity: Minor
                  Found in src/aggregation.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 buildColumnKeys has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function buildColumnKeys(changes) {
                            if (column.key === true) {
                              return Promise.resolve()
                            }
                  
                  
                  Severity: Minor
                  Found in src/column.js - About 1 hr to fix

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

                    function makeSubAggregationFunction(obj) {
                      // If its an object, either unwrap all of the properties as an
                      // array of keyValues, or unwrap the first keyValue set as an object
                      obj = _.isObject(obj) ? extractKeyValOrArray(obj) : obj
                    
                    
                    Severity: Minor
                    Found in src/aggregation.js - About 1 hr to fix

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

                          return new Promise(function (resolve, reject) {
                            try {
                              resolve(service.cf.remove())
                            } catch (err) {
                              reject(err)
                      Severity: Major
                      Found in src/crossfilter.js and 2 other locations - About 1 hr to fix
                      src/column.js on lines 78..125
                      src/query.js on lines 228..241

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

                      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 3 locations. Consider refactoring.
                      Open

                          column.promise = new Promise(function (resolve, reject) {
                            try {
                              resolve(service.cf.all())
                            } catch (err) {
                              reject(err)
                      Severity: Major
                      Found in src/column.js and 2 other locations - About 1 hr to fix
                      src/crossfilter.js on lines 64..73
                      src/query.js on lines 228..241

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

                      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 3 locations. Consider refactoring.
                      Open

                              return new Promise(function (resolve, reject) {
                                try {
                                  resolve(q.group.dispose())
                                } catch (err) {
                                  reject(err)
                      Severity: Major
                      Found in src/query.js and 2 other locations - About 1 hr to fix
                      src/column.js on lines 78..125
                      src/crossfilter.js on lines 64..73

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

                      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

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

                      function map(a, b) {
                        var m
                        var key
                        if (isFunction(b)) {
                          if (isObject(a)) {
                      Severity: Minor
                      Found in src/lodash.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language