Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
2 answers
98 views

Parser for file made up of sections

I'm parsing a file made up of various sections. I have a current_section variable that tracks which portion of the file I'm currently processing and the following <...
Neils Christoffersen's user avatar
0 votes
1 answer
191 views

Case of Cyclomatic Complexity

I'm trying to recreate the method inject (Works like Reduce) from ruby Enumerable Module. Using Rubocop (A Linter) I got the error: ...
Sevila's user avatar
  • 111
3 votes
2 answers
166 views

Keep ABC size down for conditional string concatenation in Ruby

This method takes a comment object and displays it correctly depending on what columns are available. EVENT_TEXT and REASON_TEXT ...
willlma's user avatar
  • 273
2 votes
2 answers
301 views

Masking user input passwords

I have a method that accepts user input. Additionally, it masks passwords then the input is a password. It also bypasses the prompt of if an env variable supplies the needed input. Apparently, my ...
american-ninja-warrior's user avatar
4 votes
1 answer
62 views

Preview method for multiple types of panels

Using Rubocop, pretty much any case statement is caught by the Cyclomatic Complexity cop, often the Assignment Branch Condition and method length cops as well. To get around this, I've been ...
Shaun's user avatar
  • 157
1 vote
1 answer
58 views

Establishing parameters for a sales report, with default boolean and date values

The idea is that I am getting the params from a GET request in the form of a Hash (symbol→str) and I want to transform them into dates and booleans. For that reason,...
Daniel's user avatar
  • 177
3 votes
2 answers
187 views

Readability and cyclomatic complexity of database transaction code

I consider these two options exactly the same. I prefer the first one but I'm not sure if it's better than the second option in terms of cyclomatic complexity or readability. Assuming that this is ...
Arturo Herrero's user avatar
2 votes
3 answers
2k views

Validating the presence of properties in a document

How can I reduce cyclomatic complexity of validation and refactor it better way? ...
Mike S's user avatar
  • 131
3 votes
2 answers
654 views

Ruby function to fetch, filter, and generate data

I'm currently writing a script and I decided to run cane over it to look for some issues, and the following method was highlighted. I've done my best to cut it back, and at this point I'm inclined to ...
Matthew Scharley's user avatar
6 votes
4 answers
847 views

State machine for handling Telnet sequences for an FTP server

I've asked Code Climate to generate metrics for the ftpd Ruby gem. It correctly identified the God class; I know what to do about that. But one of the smaller classes has me stumped. This is telnet....
Wayne Conrad's user avatar
  • 3,284