shadowban-eu/TwitterShadowBanV2

View on GitHub

Showing 35 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

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if (original.console.debug) console.debug = function()
            {
              self.log(self.flatten(Array.prototype.slice.call(arguments).join(",")),"log-debug", true);
              original.console.debug.apply(this, arguments);
            }
        Severity: Major
        Found in src/js/console-log-viewer.js and 4 other locations - About 2 hrs to fix
        src/js/console-log-viewer.js on lines 135..139
        src/js/console-log-viewer.js on lines 145..149
        src/js/console-log-viewer.js on lines 150..154
        src/js/console-log-viewer.js on lines 155..159

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if (original.console.warn) console.warn = function()
            {
              self.log(self.flatten(Array.prototype.slice.call(arguments).join(",")),"log-warn", true);
              original.console.warn.apply(this, arguments);
            }
        Severity: Major
        Found in src/js/console-log-viewer.js and 4 other locations - About 2 hrs to fix
        src/js/console-log-viewer.js on lines 135..139
        src/js/console-log-viewer.js on lines 140..144
        src/js/console-log-viewer.js on lines 145..149
        src/js/console-log-viewer.js on lines 155..159

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if (original.console.log) console.log = function()
            {
              self.log(self.flatten(Array.prototype.slice.call(arguments).join(",")),"log-normal", true);
              original.console.log.apply(this, arguments);
            }
        Severity: Major
        Found in src/js/console-log-viewer.js and 4 other locations - About 2 hrs to fix
        src/js/console-log-viewer.js on lines 140..144
        src/js/console-log-viewer.js on lines 145..149
        src/js/console-log-viewer.js on lines 150..154
        src/js/console-log-viewer.js on lines 155..159

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if (original.console.info) console.info = function()
            {
              self.log(self.flatten(Array.prototype.slice.call(arguments).join(",")),"log-info", true);
              original.console.info.apply(this, arguments);
            }
        Severity: Major
        Found in src/js/console-log-viewer.js and 4 other locations - About 2 hrs to fix
        src/js/console-log-viewer.js on lines 135..139
        src/js/console-log-viewer.js on lines 140..144
        src/js/console-log-viewer.js on lines 150..154
        src/js/console-log-viewer.js on lines 155..159

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if (original.console.error) console.error = function()
            {
              self.log(self.flatten(Array.prototype.slice.call(arguments).join(",")),"log-error", true);
              original.console.error.apply(this, arguments);
            }
        Severity: Major
        Found in src/js/console-log-viewer.js and 4 other locations - About 2 hrs to fix
        src/js/console-log-viewer.js on lines 135..139
        src/js/console-log-viewer.js on lines 140..144
        src/js/console-log-viewer.js on lines 145..149
        src/js/console-log-viewer.js on lines 150..154

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 93.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                }, {
                  id: 'checkConventional',
                  idx: 3,
                  message: i18next.t('tasks:checkConventional.message'),
                  icon: 'contact_support',
                Severity: Major
                Found in src/js/tasks.js and 2 other locations - About 2 hrs to fix
                src/js/tasks.js on lines 30..41
                src/js/tasks.js on lines 51..62

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 78.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                }, {
                  id: 'checkBarrier',
                  idx: 4,
                  message: i18next.t('tasks:checkBarrier.message'),
                  icon: 'contact_support',
                Severity: Major
                Found in src/js/tasks.js and 2 other locations - About 2 hrs to fix
                src/js/tasks.js on lines 51..62
                src/js/tasks.js on lines 62..73

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 78.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                }, {
                  id: 'checkSearch',
                  idx: 2,
                  message: i18next.t('tasks:checkSearch.message'),
                  icon: 'contact_support',
                Severity: Major
                Found in src/js/tasks.js and 2 other locations - About 2 hrs to fix
                src/js/tasks.js on lines 30..41
                src/js/tasks.js on lines 62..73

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 78.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        document.getElementById("debug_console_pause_button").addEventListener("click", function(e) {
                          ConsoleLogViewer.LOG_ENABLED = !ConsoleLogViewer.LOG_ENABLED;
                          self.setLogEnabled(ConsoleLogViewer.LOG_ENABLED);
                          e.preventDefault();
                        }, false);
                    Severity: Major
                    Found in src/js/console-log-viewer.js and 1 other location - About 1 hr to fix
                    src/js/console-log-viewer.js on lines 224..228

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 69.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language