nowhere-cloud/node-frontend

View on GitHub

Showing 5 of 6 total issues

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

  const getPState = () => {
    /* eslint-disable complexity */
    $.get(`../api/vm/${uuid}/pstate`).done((rsvp) => {
      if (rsvp.Status === 'Success') {
        $('#pstate').html(rsvp.Value.power_state);
Severity: Minor
Found in assets/_javascripts/heute.js - About 1 hr to fix

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

    const HTTPPatchJSONClient = (endpoint, postData) => {
      let url = URL.parse(endpoint);
      let promise = new Promise((fulfill, reject) => {
        Request.patch({
          uri: url,
    Severity: Minor
    Found in helpers/promise-http.js - About 1 hr to fix

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

      const HTTPPostJSONClient = (endpoint, postData) => {
        let url = URL.parse(endpoint);
        let promise = new Promise((fulfill, reject) => {
          Request.post({
            uri: url,
      Severity: Minor
      Found in helpers/promise-http.js - About 1 hr to fix

        Function User_Strategy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const User_Strategy = new LocalStrategy((username, password, callback) => {
          if (env !== 'development') {
            HTTP.PostJSON('http://api:3000/user/validate', {
              username: username,
              password: password
        Severity: Minor
        Found in helpers/authenticator.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

        Function deSerialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const deSerialize = (uid, cb) => {
          if (uid === 1) {
            // Administrator
            return cb(null, {
              id: 1,
        Severity: Minor
        Found in helpers/authenticator.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