CleverStack/clever-subscription

View on GitHub

Showing 9 of 12 total issues

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

module.exports = function( grunt ) {
    // Arguments for individual module rebase/seed
    var dbTarget = grunt.option( 'module' ) || null;

    return [{
Severity: Major
Found in Gruntfile.js - About 4 hrs to fix

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

    module.exports = function( Promise, Service, SubscriptionModel, AccountSubscriptionModel, InvoiceService, InvoiceItemModel, AccountModel, async, moment ) {
      return Service.extend({
    
        model: SubscriptionModel,
    
    
    Severity: Major
    Found in services/SubscriptionService.js - About 3 hrs to fix

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

      module.exports = function ( Model, Promise, moment, config ) {
        return Model.extend( 'Subscription',
        {
          type                : config[ 'clever-subscription' ].driver,
          softDeletable       : true,
      Severity: Major
      Found in models/SubscriptionModel.js - About 2 hrs to fix

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

        module.exports = function( Controller, SubscriptionService, PermissionController ) {
          return Controller.extend(
          /** @Class **/
          {
            service: SubscriptionService,
        Severity: Minor
        Found in controllers/SubscriptionController.js - About 1 hr to fix

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

          module.exports = function ( Model, Promise, config, moment ) {
            return Model.extend( 'AccountsSubscription',
            {
              type                : config[ 'clever-subscription' ].driver,
              softDeletable       : true,
          Severity: Minor
          Found in models/AccountSubscriptionModel.js - About 1 hr to fix

            Function exports has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            module.exports = function( Promise, Service, SubscriptionModel, AccountSubscriptionModel, InvoiceService, InvoiceItemModel, AccountModel, async, moment ) {
            Severity: Major
            Found in services/SubscriptionService.js - About 1 hr to fix

              Function generateInvoiceItems has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  generateInvoiceItems: function( accSubscription, dates ) {
                    var subscription = accSubscription.subscription;
              
                    return new Promise( function( resolve, reject ) {
                      if ( !!dates.length ) {
              Severity: Minor
              Found in services/SubscriptionService.js - About 1 hr to fix

                Function generateInvoice has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    generateInvoice: function( subscription, items ) {
                      return new Promise( function( resolve, reject ) {
                        if ( !items.length ) {
                          return resolve();
                        }
                Severity: Minor
                Found in services/SubscriptionService.js - About 1 hr to fix

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

                  module.exports = function( Controller, SubscriptionService, PermissionController ) {
                    return Controller.extend(
                    /** @Class **/
                    {
                      service: SubscriptionService,
                  Severity: Minor
                  Found in controllers/SubscriptionController.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

                  Severity
                  Category
                  Status
                  Source
                  Language