ToX82/logHappens

View on GitHub

Showing 6 of 11 total issues

Function entries has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function entries($file, $offset = 0, $limit = 10, $search = '')
    {
        $logs = [];
        $data = $this->config[$file];
        include ROOT . "parsers/" . $data['parser'] . ".php";
Severity: Minor
Found in logics/Parsers.php - About 2 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 recountAll has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function recountAll() {
    var baseUrl = $('.baseUrl').html();
    var $sidebar = $('#left-sidebar-nav');
    var currentPage = $('.log-container h4').attr('data-file');
    var notificationText = '';
Severity: Minor
Found in webroot/js/custom.js - About 1 hr to fix

    Method normalizeChars has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function normalizeChars($inputString)
    {
        $fix_list = array(
            // 3 char errors first
            '‚' => '‚', '„' => '„', '…' => '…', '‡' => '‡',
    Severity: Minor
    Found in libs/utilities.php - About 1 hr to fix

      Method entries has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function entries($file, $offset = 0, $limit = 10, $search = '')
          {
              $logs = [];
              $data = $this->config[$file];
              include ROOT . "parsers/" . $data['parser'] . ".php";
      Severity: Minor
      Found in logics/Parsers.php - About 1 hr to fix

        Function __construct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct()
            {
                $config = [];
        
                if (!is_file(ROOT . 'config.json')) {
        Severity: Minor
        Found in logics/Parsers.php - About 55 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 checkDatedLogFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function checkDatedLogFiles($parsers)
            {
                $placeholders = [
                    'Y', // A full numeric representation of a year, 4 digits
                    'y', // A two digit representation of a year
        Severity: Minor
        Found in logics/Parsers.php - 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