yoctore/yocto-logger

View on GitHub
src/index.js

Summary

Maintainability
C
1 day
Test Coverage

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

  constructor () {
    /**
     * Lists of logger levels custom for your own usage
     *
     * @memberof Logger
Severity: Major
Found in src/index.js - About 2 hrs to fix

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

      constructor () {
        /**
         * Lists of logger levels custom for your own usage
         *
         * @memberof Logger
    Severity: Minor
    Found in src/index.js - 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

    File index.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    const winston       = require('winston');
    const _             = require('lodash');
    const chalk         = require('chalk');
    Severity: Minor
    Found in src/index.js - About 2 hrs to fix

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

        addDailyRotateTransport (options = {}, isWeb = false) {
          // Try to normalize options
          _.set(options, 'changeChangeLevel', options.canChangeLevel || true);
          _.set(options, 'extname', options.extname || 'combined');
          _.set(options, 'destination',
      Severity: Minor
      Found in src/index.js - About 1 hr to fix

        Function enableRequestToDailyRotateFiles has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          enableRequestToDailyRotateFiles (options = {}) {
            // Add default options
            options.extname = 'access';
            options.level = 'info';
            options.canChangeLevel = false;
        Severity: Minor
        Found in src/index.js - About 1 hr to fix

          Function process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            process (level, message, meta) {
              // Try to find correct level
              level = _.find(this.levels, [ 'name', level ]);
          
              // Level allow callback usage ?
          Severity: Minor
          Found in src/index.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 addDailyRotateTransport has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            addDailyRotateTransport (options = {}, isWeb = false) {
              // Try to normalize options
              _.set(options, 'changeChangeLevel', options.canChangeLevel || true);
              _.set(options, 'extname', options.extname || 'combined');
              _.set(options, 'destination',
          Severity: Minor
          Found in src/index.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 banner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            banner (message, ... meta) {
              // Default step value
              const step = 20;
          
              // Define separtor element
          Severity: Minor
          Found in src/index.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