Skip to content

Instantly share code, notes, and snippets.

@danman01
Created April 4, 2017 16:55
Show Gist options
  • Save danman01/313d51f23b883f942832f585dff1b543 to your computer and use it in GitHub Desktop.
Save danman01/313d51f23b883f942832f585dff1b543 to your computer and use it in GitHub Desktop.
rubocop output of ruby array methods
[email protected]: ruby-array-methods (lm01/master)* $ bin/rake
Running RuboCop...
Inspecting 25 files
..CCCCCCC.CCCCCCCCWCCCC..
Offenses:
bin/cities_array.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
require_relative '../lib/cities.rb'
^
bin/people_array.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
require_relative '../lib/people.rb'
^
bin/rake:3:1: C: Add an empty line after magic comments.
#
^
bin/read_file.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
bin/read_files.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
# script processing two files
^
bin/rspec:3:1: C: Add an empty line after magic comments.
#
^
bin/rubocop:3:1: C: Add an empty line after magic comments.
#
^
bin/stepped_range.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
data/cities-dat2csv.rb:1:1: C: The name of this source file (cities-dat2csv.rb) should use snake_case.
#
^
data/cities-dat2csv.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
data/cities-dat2csv.rb:3:8: C: %w-literals should be delimited by [ and ].
keys = %w(Population Name Country Region Longitude Latitude)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
data/cities-dat2csv.rb:17:43: C: Use population.positive? instead of population > 0.
cities << city if type == 'City' && population > 0
^^^^^^^^^^^^^^
data/date_generator.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
data/date_generator.rb:8:23: C: Freeze mutable objects assigned to constants.
THIRTY_DAY_MONTHS = [4, 6, 9, 11]
^^^^^^^^^^^^^
data/people-generator.rb:1:1: C: The name of this source file (people-generator.rb) should use snake_case.
#
^
data/people-generator.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
data/people-generator.rb:5:14: C: Use ARGV.length.zero? instead of ARGV.length == 0.
name_count = ARGV.length == 0 ? 1219 : ARGV[0].to_i
^^^^^^^^^^^^^^^^
data/people-generator.rb:5:14: C: Use empty? instead of length == 0.
name_count = ARGV.length == 0 ? 1219 : ARGV[0].to_i
^^^^^^^^^^^^^^^^
data/people-generator.rb:17:18: C: %w-literals should be delimited by [ and ].
gender_neutral = %w(Blaine Chris Dana Pat Taylor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
data/people-generator.rb:25:5: C: Favor a normal if-statement over a modifier clause in a multiline statement.
people << { ...
^^^^^^^^^^^
data/people-generator.rb:36:5: C: Favor a normal if-statement over a modifier clause in a multiline statement.
people << { ...
^^^^^^^^^^^
data/people-generator.rb:45:19: C: %w-literals should be delimited by [ and ].
headers: %w(surname given_name gender dob)) do |csv|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
data/people-generator.rb:52:43: C: Closing array brace must be on the line after the last array element when opening brace is on a separate line from the first array element.
date_gen.random_date_string]
^
lib/card.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
# A simple representation of a playing card.
^
lib/card.rb:3:11: C: %w-literals should be delimited by [ and ].
SUITS = %w(C D H S).freeze
^^^^^^^^^^^
lib/card.rb:4:26: C: %w-literals should be delimited by [ and ].
RANKS = [(2..10).to_a, %w(J Q K A)].flatten
^^^^^^^^^^^
lib/card.rb:9:5: C: Favor a normal unless-statement over a modifier clause in a multiline statement.
fail ArgumentError, ...
^^^^^^^^^^^^^^^^^^^
lib/card.rb:9:5: C: Always use raise to signal exceptions.
fail ArgumentError,
^^^^
lib/card.rb:11:5: C: Favor a normal unless-statement over a modifier clause in a multiline statement.
fail ArgumentError, ...
^^^^^^^^^^^^^^^^^^^
lib/card.rb:11:5: C: Always use raise to signal exceptions.
fail ArgumentError,
^^^^
lib/cities.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
require 'csv'
^
lib/cities.rb:10:36: C: Do not use spaces between -> and opening brace in lambda literals
header_converters: -> (h) { h.downcase.to_sym }) do |city|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/city.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
lib/deck.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
require_relative 'card'
^
lib/deck.rb:23:3: C: Put empty method definitions on a single line.
def deal(cards, *hands) ...
^^^^^^^^^^^^^^^^^^^^^^^
lib/fibonacci.rb:1:1: W: Useless assignment to variable - fibs.
fibs = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
^^^^
lib/fibonacci.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
fibs = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
^
lib/people.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
require 'csv'
^
lib/people.rb:10:36: C: Do not use spaces between -> and opening brace in lambda literals
header_converters: -> (h) { h.downcase.to_sym }) do |person|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/person.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
#
^
lib/string.rb:1:1: C: Missing magic comment # frozen_string_literal: true.
# Add features to string
^
lib/string.rb:3:3: C: Put empty method definitions on a single line.
def normalize_words ...
^^^^^^^^^^^^^^^^^^^
lib/string.rb:6:3: C: Put empty method definitions on a single line.
def unique_words ...
^^^^^^^^^^^^^^^^
lib/string.rb:9:3: C: Put empty method definitions on a single line.
def word_count(unique) ...
^^^^^^^^^^^^^^^^^^^^^^
lib/string.rb:12:3: C: Put empty method definitions on a single line.
def word_frequencies ...
^^^^^^^^^^^^^^^^^^^^
lib/string.rb:15:3: C: Put empty method definitions on a single line.
def longest_word ...
^^^^^^^^^^^^^^^^
lib/tasks/aliases.rake:10:15: C: Use %i or %I for an array of symbols.
task default: [:nag, :test]
^^^^^^^^^^^^^
25 files inspected, 47 offenses detected
RuboCop failed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment