ehosp/eHOSP-Services-CE

View on GitHub
src/resources/assets/js/lib/nxt-ui.js

Summary

Maintainability
D
1 day
Test Coverage

File nxt-ui.js has 472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*******************************************************************************
* Main Functions
*
*******************************************************************************/

Severity: Minor
Found in src/resources/assets/js/lib/nxt-ui.js - About 7 hrs to fix

    Function nxt_motor has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function nxt_motor() {
        motorHTML = `
        <div id="left">
            <div id="port">
                <h3>Port</h3>
    Severity: Major
    Found in src/resources/assets/js/lib/nxt-ui.js - About 2 hrs to fix

      Function fileUpload has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function fileUpload() {
          var x = document.getElementById("myFile");
          var txt = "";
          if ('files' in x) {
              if (x.files.length == 0) {
      Severity: Minor
      Found in src/resources/assets/js/lib/nxt-ui.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 nxt_sound has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function nxt_sound() {
          soundHTML = `
          <div id="left">
              <div id="action">
                  <h3>Action</h3>
      Severity: Minor
      Found in src/resources/assets/js/lib/nxt-ui.js - About 1 hr to fix

        Function __modal__ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function __modal__(header, htmlBody) {
            var html = `
                <div class="modal-content">
                <div class="modal-header">
                    <span class="close">Χ</span>
        Severity: Minor
        Found in src/resources/assets/js/lib/nxt-ui.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status