shadowban-eu/TwitterShadowBanV2

View on GitHub

Showing 21 of 35 total issues

Function ConsoleLogViewer has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
Open

var ConsoleLogViewer = (function() {
  ConsoleLogViewer.ALIGNMENT = "top"; // top | bottom
  ConsoleLogViewer.IS_MINIMIZED = false; // true | false
  ConsoleLogViewer.LOG_ENABLED = true;
  ConsoleLogViewer.IS_CLOSED = false;
Severity: Minor
Found in src/js/console-log-viewer.js - About 1 day 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 ConsoleLogViewer has 260 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var ConsoleLogViewer = (function() {
  ConsoleLogViewer.ALIGNMENT = "top"; // top | bottom
  ConsoleLogViewer.IS_MINIMIZED = false; // true | false
  ConsoleLogViewer.LOG_ENABLED = true;
  ConsoleLogViewer.IS_CLOSED = false;
Severity: Major
Found in src/js/console-log-viewer.js - About 1 day to fix

    File console-log-viewer.js has 545 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Displays logs and Javascript errors in an overlay on top of your site. Useful for mobile webdevelopment.
     *
     * <https://github.com/markknol/console-log-viewer>
     * @author Mark Knol <http://blog.stroep.nl>
    Severity: Major
    Found in src/js/console-log-viewer.js - About 1 day to fix

      Function fullTest has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const fullTest = async (screenName) => {
        let response;
        try {
          response = await fetch(`.api/${screenName}`);
        } catch (err) {
      Severity: Major
      Found in src/js/main.js - About 4 hrs to fix

        Function fullTest has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        const fullTest = async (screenName) => {
          let response;
          try {
            response = await fetch(`.api/${screenName}`);
          } catch (err) {
        Severity: Minor
        Found in src/js/main.js - About 3 hrs 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 addDivs has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          ConsoleLogViewer.prototype.addDivs = function(self)
          {
            var self = self;
            var alignment = window.location.href.indexOf("console_at_bottom=true") > -1 || window.location.href.indexOf("console_at_bottom=1") > -1 ? "bottom-aligned" : "top-aligned";
            var scripts = window.document.getElementsByTagName('script');
        Severity: Major
        Found in src/js/console-log-viewer.js - About 2 hrs to fix

          Function request has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            request: function(post) {
              var me = this;
              me.responseData = null;
              var r = this.req = js_Browser.createXMLHttpRequest();
              var onreadystatechange = function(_) {
          Severity: Major
          Found in src/js/console-log-viewer.js - About 2 hrs to fix

            Function __string_rec has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            js_Boot.__string_rec = function(o,s) {
              if(o == null) return "null";
              if(s.length >= 5) return "<...>";
              var t = typeof(o);
              if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
            Severity: Major
            Found in src/js/console-log-viewer.js - About 2 hrs to fix

              Function constructor has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(test) {
                  // create and add task elements
                  this.tasks = constructTaskData().sort((a, b) => (a.idx - b.idx)).map(task => new Task(task));
                  this.tasksById = this.tasks.reduce(
                    (acc, task) => ({ [task.id]: task, ...acc }),
              Severity: Major
              Found in src/js/ui.js - About 2 hrs to fix

                Function overwrite has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  ConsoleLogViewer.prototype.overwrite = function()
                  {
                    var self = this;
                    // store original functions
                    var original =
                Severity: Minor
                Found in src/js/console-log-viewer.js - About 1 hr to fix

                  Function createTaskElement has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static createTaskElement(task) {
                      const listItem = Task.template.firstElementChild.cloneNode(true);
                      const header = listItem.querySelector('[data-task-component="header"]');
                      const message = listItem.querySelector('[data-task-component="message"]');
                      const description = listItem.querySelector('[data-task-component="description"]');
                  Severity: Minor
                  Found in src/js/ui/Task.js - About 1 hr to fix

                    Function show has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    DebugSource.show = function(url,message) {
                      var $window = window.open("","_blank");
                      var http = new haxe_Http(url.split("#").shift());
                      http.onData = function(data) {
                        var startLineNumber = Std.parseInt(url.split("#").pop().split("-").shift()) - 1;
                    Severity: Minor
                    Found in src/js/console-log-viewer.js - About 1 hr to fix

                      Function update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        update(status, msg) {
                          // icon
                          const { icon } = this.components;
                          switch (status) {
                            case 'running':
                      Severity: Minor
                      Found in src/js/ui/Task.js - About 1 hr to fix

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

                          http.onData = function(data) {
                            var startLineNumber = Std.parseInt(url.split("#").pop().split("-").shift()) - 1;
                            var endLineNumber = Std.parseInt(url.split("#").pop().split("-").pop()) - 1;
                            var css = $window.document.createElement("style");
                            var stylesheet = "body{font:14px consolas,'courier new',monospaced;background:#FFF;}\npre{max-width:1000px;width:100%;white-space:pre-line;}\n.highlighted-line{background:yellow;display:inline-block;}\n.tab{padding-right:20px;}\n.keyword{color:blue;}\n.operator{color:lightgray;}\n.linenumber{display:inline-block;width:45px;margin-right:5px;background:darkgray;color:white;}\n.debug-error{display:block;background:red;color:white;}";
                        Severity: Minor
                        Found in src/js/console-log-viewer.js - About 1 hr to fix

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

                              var onreadystatechange = function(_) {
                                if(r.readyState != 4) return;
                                var s;
                                try {
                                  s = r.status;
                          Severity: Minor
                          Found in src/js/console-log-viewer.js - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      if(i != 2) str += "," + js_Boot.__string_rec(o[i],s); else str += js_Boot.__string_rec(o[i],s);
                            Severity: Major
                            Found in src/js/console-log-viewer.js - About 45 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    if(s2 != "[object Object]") return s2;
                              Severity: Major
                              Found in src/js/console-log-viewer.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return str1;
                                Severity: Major
                                Found in src/js/console-log-viewer.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return "???";
                                  Severity: Major
                                  Found in src/js/console-log-viewer.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                        return str2;
                                    Severity: Major
                                    Found in src/js/console-log-viewer.js - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language