Showing 7 of 7 total issues
Function ToiletController
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ToiletController( toiletService, $mdSidenav, $mdBottomSheet, $log, $scope ) {
var self = this;
self.selected = null;
self.toilets = [ ];
Function ToiletService
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ToiletService($q, Toilet) {
var toilets = [
{
name: 'Lia Lugo',
avatar: 'svg-1',
Function timeAgoInWords
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var timeAgoInWords = function(from) {
var minutes = (new Date() - from) / 60000;
if (minutes < 0) {
minutes = 0;
Function ToiletController
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function ToiletController( toiletService, $mdSidenav, $mdBottomSheet, $log, $scope ) {
Function timeAgoInWords
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var timeAgoInWords = function(from) {
var minutes = (new Date() - from) / 60000;
if (minutes < 0) {
minutes = 0;
- Read upRead up
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
Method generate_auth_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_auth_token
return unless self.new_record?
loop do
self.auth_token = SecureRandom.hex
- Read upRead up
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
Method require_user_signed_in
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def require_user_signed_in
unless user_signed_in?
# If the user came from a page, we can send them back. Otherwise, send
# them to the root path.
- Read upRead up
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"