LeKovr/webtail

View on GitHub

Showing 10 of 10 total issues

File webtail.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
  WebTail project js file
  https://github.com/LeKovr/webtail
*/

Severity: Minor
Found in html/webtail.js - About 2 hrs to fix

    Function processLine has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function processLine(l) {
        var m = JSON.parse(l, JSON.dateParser);
        $("#log").text('');
    
        if (m.type === 'index') {
    Severity: Minor
    Found in html/webtail.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 connect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function connect() {
        try {
            var host = 'ws';
            if (window.location.protocol === 'https:') host = 'wss';
            host = host + '://' + WebTail.uri;
    Severity: Minor
    Found in html/webtail.js - About 1 hr to fix

      Function showFiles has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function showFiles(file) {
          WebTail.logs = file;
          const row = $('table.table tbody tr:last');
          const splitter = /^(.+)\/([^/]+)$/;
          var prevDir = '';
      Severity: Minor
      Found in html/webtail.js - About 1 hr to fix

        Function showPage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function showPage() {
            WebTail.unread = 0;
            WebTail.focused = true;
            var m;
            if (WebTail.attached !== undefined) {
        Severity: Minor
        Found in html/webtail.js - About 1 hr to fix

          Function showFiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function showFiles(file) {
              WebTail.logs = file;
              const row = $('table.table tbody tr:last');
              const splitter = /^(.+)\/([^/]+)$/;
              var prevDir = '';
          Severity: Minor
          Found in html/webtail.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 dateParser has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              JSON.dateParser = function(key, value) {
                  if (typeof value !== 'string') return value;
                  var a = reISO.exec(value);
                  if (a) return new Date(value);
                  a = reMsAjax.exec(value);
          Severity: Minor
          Found in html/webtail.js - About 45 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 processLog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function processLog(data) {
              var $area = $('#tail-data');
              var str = (data !== undefined) ? data : '';
              var mask = $('#mask').val();
              var container;
          Severity: Minor
          Found in html/webtail.js - About 35 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 connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function connect() {
              try {
                  var host = 'ws';
                  if (window.location.protocol === 'https:') host = 'wss';
                  host = host + '://' + WebTail.uri;
          Severity: Minor
          Found in html/webtail.js - About 35 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

          Method Client.runWritePump has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
          Open

          func (c *Client) runWritePump(wg *sync.WaitGroup) {
              wg.Add(1)
              ticker := time.NewTicker(pingPeriod)
              defer func() {
                  ticker.Stop()
          Severity: Minor
          Found in client.go - 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