adam-26/tag-relativeformat

View on GitHub

Showing 6 of 22 total issues

Function exports has 210 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {

    var libpath = require('path');

    grunt.initConfig({
Severity: Major
Found in Gruntfile.js - About 1 day to fix

    Function _format has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    RelativeFormat.prototype._format = function (date, options) {
        var now = options && options.now !== undefined ? options.now : dateNow();
    
        if (date === undefined) {
            date = now;
    Severity: Minor
    Found in src/core.js - About 1 hr 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 _format has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    RelativeFormat.prototype._format = function (date, options) {
        var now = options && options.now !== undefined ? options.now : dateNow();
    
        if (date === undefined) {
            date = now;
    Severity: Minor
    Found in src/core.js - About 1 hr to fix

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

      export default function (from, to) {
          // Convert to ms timestamps.
          from = +from;
          to   = +to;
      
      
      Severity: Minor
      Found in src/diff.js - About 1 hr to fix

        Function _resolveLocale has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        RelativeFormat.prototype._resolveLocale = function (locales) {
            if (typeof locales === 'string') {
                locales = [locales];
            }
        
        
        Severity: Minor
        Found in src/core.js - About 45 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 _compileMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        RelativeFormat.prototype._compileMessage = function (units) {
            // `this._locales` is the original set of locales the user specified to the
            // constructor, while `this._locale` is the resolved root locale.
            var locales        = this._locales;
            var resolvedLocale = this._locale;
        Severity: Minor
        Found in src/core.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

        Severity
        Category
        Status
        Source
        Language