Showing 12 of 26 total issues
Function EpaRepository
has 202 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EpaRepository(client, Transformer){
var _index = 'epa-release';
var _type = 'records';
var self = this;
Function exports
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Transformer){
var TriTransformer = new Transformer(function(model){
for(var x in model){
Function TriTransformer
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
var TriTransformer = new Transformer(function(model){
for(var x in model){
if(model[x] == ""){
model[x] = null;
Function exports
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(app, Responder, Repo, DotObjectTransformer){
function getFields(req){
return req.query.fields ? req.query.fields.split(',') : [];
}
Function exports
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(Transformer){
var TriTransformer = new Transformer(function(model){
for(var x in model){
- Read upRead up
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 getFacilities
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.getFacilities = function(options, callback){
var fields = [];
if(options.fields){
options.fields.forEach(function(field){
Function EpaServiceProvider
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EpaServiceProvider(){
var _register = function(Container){
_registerElasticClient(Container);
_registerConverter(Container);
Function FieldLimitingInterceptor
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
var FieldLimitingInterceptor = interceptor(function(req, res){
return {
// Only JSON responses will be intercepted
isInterceptable: function(){
var isJson = /application\/json/.test(res.get('Content-Type'));
Function FieldLimitingInterceptor
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var FieldLimitingInterceptor = interceptor(function(req, res){
return {
// Only JSON responses will be intercepted
isInterceptable: function(){
var isJson = /application\/json/.test(res.get('Content-Type'));
- Read upRead up
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 EpaRepository
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function EpaRepository(client, Transformer){
var _index = 'epa-release';
var _type = 'records';
var self = this;
- Read upRead up
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 _createQuery
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var _createQuery = function(groupBy, oper, fields, filters){
var obj = {};
// If summing
if(oper == 'sum' || oper == 'avg'){
Function intercept
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
intercept: function(body, send) {
var json = JSON.parse(body);
if(! json.hasOwnProperty('data')){
send(body);