Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bunch of small cleanup tasks - #56

Closed
mbernier opened this issue Oct 30, 2017 · 0 comments · Fixed by #57
Closed

Bunch of small cleanup tasks - #56

mbernier opened this issue Oct 30, 2017 · 0 comments · Fixed by #57
Labels
difficulty: easy fix is easy in difficulty

Comments

@mbernier
Copy link

Issue Summary

  • Use the new Ruby 1.9 hash syntax. task :default => :test Found in Rakefile by rubocop

  • Prefer single-quoted strings when you don't need string interpolation or special symbols. OPEN desc "Run tests" - Found in Rakefile by rubocop

  • Final newline missing. task :default => :test - Found in Rakefile by rubocop

  • Unnecessary spacing detected. host = 'https://api.sendgrid.com' - Found in examples/example.rb by rubocop

  • Operator = should be surrounded by a single space. host = 'https://api.sendgrid.com' - Found in examples/example.rb by rubocop

  • Use && instead of and. elsif !@request_body and (name.to_s == "post") - Found in lib/ruby_http_client.rb by rubocop

  • Align ) with (. - line 147 - Found in lib/ruby_http_client.rb by rubocop

  • Use Hash#key? instead of Hash#has_key?. (!@request_headers.has_key?('Content-Type') || - Found in lib/ruby_http_client.rb by rubocop

  • When using method_missing, define respond_to_missing? and fall back on super. def method_missing(name, *args, &_block) # Capture the version if name.to_s == 'version' @version = args[0] return _ - Found in lib/ruby_http_client.rb by rubocop

  • Don't use parentheses around the condition of an if. if (@request_body && (!@request_headers.has_key?('Content-Type') || @request_headers['Content-Type'] == 'application/json') ) - Found in lib/ruby_http_client.rb by rubocop

  • %w-literals should be delimited by [ and ]. @methods = %w(delete get patch post put) - Found in lib/ruby_http_client.rb by rubocop

  • Prefer single-quoted strings when you don't need string interpolation or special symbols. elsif !@request_body and (name.to_s == "post") - Found in lib/ruby_http_client.rb by rubocop

  • Add an empty line after magic comments. lib = File.expand_path('../lib', __FILE__) - Found in ruby_http_client.gemspec by rubocop

Steps to Reproduce

  1. Once done, make a PR and wait for the build
  2. Codeclimate should not be reporting these issues for these files any longer
@mbernier mbernier added difficulty: easy fix is easy in difficulty hacktoberfest labels Oct 30, 2017
mbernier pushed a commit that referenced this issue Dec 11, 2017
[Closes #56] Fix some rubocop issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy fix is easy in difficulty
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants