Showing 5 of 5 total issues
File app.js
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* This is going to build over the Instagram's public API.
*
* Instagram currently allows accessing public posts but misses a lot of
* functionality like limits, pagination, jsonp, etc. This aims to fix that.
Function fetchFromInstagramGQL
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
InstaProxy.fetchFromInstagramGQL = function (param, request, response) {
let queryId;
if (param.id != null) {
queryId = this.GRAPH_USER_QUERY_ID;
- 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 fetchFromInstagramGQL
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
InstaProxy.fetchFromInstagramGQL = function (param, request, response) {
let queryId;
if (param.id != null) {
queryId = this.GRAPH_USER_QUERY_ID;
Consider simplifying this complex logical expression. Open
Open
if (this.ENABLE_REFERER_CHECK) {
let referer = request.headers.referer;
let isSafe = (this.DEBUG_MODE || this.ALLOW_UNDEFINED_REFERER) ? (
referer === undefined ||
referer === 'undefined' ||
Function safeRefererMW
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
InstaProxy.safeRefererMW = function (request, response, next) {
if (this.ENABLE_REFERER_CHECK) {
let referer = request.headers.referer;
let isSafe = (this.DEBUG_MODE || this.ALLOW_UNDEFINED_REFERER) ? (
referer === undefined ||
- 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"