asdqwex/discobot

View on GitHub
src/modules/reminder.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function onMessage has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  onMessage: function (bot, user, userID, channelID, message, rawEvent) {
    var parts = message.split(' ')
    parts.splice(0, 2)
    var verb = parts.splice(0, 1).join()
    if (verb === 'at') {
Severity: Minor
Found in src/modules/reminder.js - About 1 hr to fix

    Function onMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      onMessage: function (bot, user, userID, channelID, message, rawEvent) {
        var parts = message.split(' ')
        parts.splice(0, 2)
        var verb = parts.splice(0, 1).join()
        if (verb === 'at') {
    Severity: Minor
    Found in src/modules/reminder.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 onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      onMessage: function (bot, user, userID, channelID, message, rawEvent) {
    Severity: Minor
    Found in src/modules/reminder.js - About 45 mins to fix

      Identifier 'time_arr' is not in camel case.
      Open

            var time_arr = t.split(':')
      Severity: Minor
      Found in src/modules/reminder.js by eslint

      Require Camelcase (camelcase)

      When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

      Rule Details

      This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

      Options

      This rule has an object option:

      • "properties": "always" (default) enforces camelcase style for property names
      • "properties": "never" does not check property names

      always

      Examples of incorrect code for this rule with the default { "properties": "always" } option:

      /*eslint camelcase: "error"*/
      
      import { no_camelcased } from "external-module"
      
      var my_favorite_color = "#112C85";
      
      function do_something() {
          // ...
      }
      
      obj.do_something = function() {
          // ...
      };
      
      var obj = {
          my_pref: 1
      };

      Examples of correct code for this rule with the default { "properties": "always" } option:

      /*eslint camelcase: "error"*/
      
      import { no_camelcased as camelCased } from "external-module";
      
      var myFavoriteColor   = "#112C85";
      var _myFavoriteColor  = "#112C85";
      var myFavoriteColor_  = "#112C85";
      var MY_FAVORITE_COLOR = "#112C85";
      var foo = bar.baz_boom;
      var foo = { qux: bar.baz_boom };
      
      obj.do_something();
      do_something();
      new do_something();
      
      var { category_id: category } = query;

      never

      Examples of correct code for this rule with the { "properties": "never" } option:

      /*eslint camelcase: ["error", {properties: "never"}]*/
      
      var obj = {
          my_pref: 1
      };

      When Not To Use It

      If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

      Identifier 'msg_data' is not in camel case.
      Open

            var msg_data = []
      Severity: Minor
      Found in src/modules/reminder.js by eslint

      Require Camelcase (camelcase)

      When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

      Rule Details

      This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

      Options

      This rule has an object option:

      • "properties": "always" (default) enforces camelcase style for property names
      • "properties": "never" does not check property names

      always

      Examples of incorrect code for this rule with the default { "properties": "always" } option:

      /*eslint camelcase: "error"*/
      
      import { no_camelcased } from "external-module"
      
      var my_favorite_color = "#112C85";
      
      function do_something() {
          // ...
      }
      
      obj.do_something = function() {
          // ...
      };
      
      var obj = {
          my_pref: 1
      };

      Examples of correct code for this rule with the default { "properties": "always" } option:

      /*eslint camelcase: "error"*/
      
      import { no_camelcased as camelCased } from "external-module";
      
      var myFavoriteColor   = "#112C85";
      var _myFavoriteColor  = "#112C85";
      var myFavoriteColor_  = "#112C85";
      var MY_FAVORITE_COLOR = "#112C85";
      var foo = bar.baz_boom;
      var foo = { qux: bar.baz_boom };
      
      obj.do_something();
      do_something();
      new do_something();
      
      var { category_id: category } = query;

      never

      Examples of correct code for this rule with the { "properties": "never" } option:

      /*eslint camelcase: ["error", {properties: "never"}]*/
      
      var obj = {
          my_pref: 1
      };

      When Not To Use It

      If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

      Identifier 'day_arr' is not in camel case.
      Open

            var day_arr = day.split('/')
      Severity: Minor
      Found in src/modules/reminder.js by eslint

      Require Camelcase (camelcase)

      When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

      Rule Details

      This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

      Options

      This rule has an object option:

      • "properties": "always" (default) enforces camelcase style for property names
      • "properties": "never" does not check property names

      always

      Examples of incorrect code for this rule with the default { "properties": "always" } option:

      /*eslint camelcase: "error"*/
      
      import { no_camelcased } from "external-module"
      
      var my_favorite_color = "#112C85";
      
      function do_something() {
          // ...
      }
      
      obj.do_something = function() {
          // ...
      };
      
      var obj = {
          my_pref: 1
      };

      Examples of correct code for this rule with the default { "properties": "always" } option:

      /*eslint camelcase: "error"*/
      
      import { no_camelcased as camelCased } from "external-module";
      
      var myFavoriteColor   = "#112C85";
      var _myFavoriteColor  = "#112C85";
      var myFavoriteColor_  = "#112C85";
      var MY_FAVORITE_COLOR = "#112C85";
      var foo = bar.baz_boom;
      var foo = { qux: bar.baz_boom };
      
      obj.do_something();
      do_something();
      new do_something();
      
      var { category_id: category } = query;

      never

      Examples of correct code for this rule with the { "properties": "never" } option:

      /*eslint camelcase: ["error", {properties: "never"}]*/
      
      var obj = {
          my_pref: 1
      };

      When Not To Use It

      If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

      There are no issues that match your filters.

      Category
      Status