whizzzkid/instagram-reverse-proxy

View on GitHub

Showing 5 of 5 total issues

File app.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
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.
Severity: Minor
Found in app.js - About 4 hrs to fix

    Function fetchFromInstagramGQL has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    InstaProxy.fetchFromInstagramGQL = function (param, request, response) {
      let queryId;
    
      if (param.id != null) {
        queryId = this.GRAPH_USER_QUERY_ID;
    Severity: Minor
    Found in app.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 fetchFromInstagramGQL has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    InstaProxy.fetchFromInstagramGQL = function (param, request, response) {
      let queryId;
    
      if (param.id != null) {
        queryId = this.GRAPH_USER_QUERY_ID;
    Severity: Minor
    Found in app.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

        if (this.ENABLE_REFERER_CHECK) {
          let referer = request.headers.referer;
          let isSafe = (this.DEBUG_MODE || this.ALLOW_UNDEFINED_REFERER) ? (
              referer === undefined ||
              referer === 'undefined' ||
      Severity: Major
      Found in app.js - About 40 mins to fix

        Function safeRefererMW has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        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 ||
        Severity: Minor
        Found in app.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