bkdotcom/PHPDebugConsole

View on GitHub
src/Debug/js_src/FileLinks.js

Summary

Maintainability
A
3 hrs
Test Coverage

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

function createFileLinksTrace ($entry, remove) {
  var isUpdate = $entry.find('.file-link').length > 0
  if (!isUpdate) {
    $entry.find('table thead tr > *:last-child').after('<th></th>')
  } else if (remove) {
Severity: Minor
Found in src/Debug/js_src/FileLinks.js - About 1 hr to fix

    Function createFileLinkReplace has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function createFileLinkReplace ($string, matches, text, remove, isUpdate) {
    Severity: Minor
    Found in src/Debug/js_src/FileLinks.js - About 35 mins to fix

      Function createFileLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function createFileLink (string, remove, foundFiles) {
        var $replace
        var $string = $(string)
        var attrs = string.attributes
        var text = $.trim($string.text())
      Severity: Minor
      Found in src/Debug/js_src/FileLinks.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function create ($entry, $strings, remove) {
        var $objects = $entry.find('.t_object > .object-inner > .property.debug-value > .t_identifier').filter(function () {
          return this.innerText.match(/^file$/)
        })
        var detectFiles = $entry.data('detectFiles') === true || $objects.length > 0
      Severity: Minor
      Found in src/Debug/js_src/FileLinks.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 createFileLinkMatches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function createFileLinkMatches ($string, foundFiles) {
        var matches = []
        var text = $.trim($string.text())
        if ($string.data('file')) {
          // filepath specified in data-file attr
      Severity: Minor
      Found in src/Debug/js_src/FileLinks.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

      There are no issues that match your filters.

      Category
      Status