paazmaya/grunt-hgactivity

View on GitHub

Showing 4 of 4 total issues

Function hgactivity has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function hgactivity(grunt) {

  const hasOwnProperty = Object.prototype.hasOwnProperty;

  grunt.registerMultiTask('hgactivity', 'Repository activity', function register() {
Severity: Minor
Found in tasks/hgactivity.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 hgactivity has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function hgactivity(grunt) {

  const hasOwnProperty = Object.prototype.hasOwnProperty;

  grunt.registerMultiTask('hgactivity', 'Repository activity', function register() {
Severity: Major
Found in tasks/hgactivity.js - About 4 hrs to fix

    Function register has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      grunt.registerMultiTask('hgactivity', 'Repository activity', function register() {
        const args = ['activity']; // Command line arguments for 'hg activity'
        const dates = []; // Collection of dates used as delimiters of each time span, if interval used
        const commands = []; // List of commands that are finally called
    
    
    Severity: Major
    Found in tasks/hgactivity.js - About 4 hrs to fix

      Function splitEach has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const splitEach = function splitEach(split) {
            const divider = split !== 'none' ?
              '_' + split :
              '';
            const filename = options.filenamePrefix + divider;
      Severity: Minor
      Found in tasks/hgactivity.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language