Skip to content

Commit

Permalink
Prefer double-quoted strings unless you need single quotes to avoid e…
Browse files Browse the repository at this point in the history
…xtra backslashes for escaping
  • Loading branch information
sferik committed Apr 30, 2023
1 parent 6f4719a commit e4c8efa
Show file tree
Hide file tree
Showing 33 changed files with 3,493 additions and 3,490 deletions.
7 changes: 5 additions & 2 deletions .rubocop.yml
Expand Up @@ -75,6 +75,9 @@ Style/EachWithObject:
Style/Encoding:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/Lambda:
Enabled: false

Expand All @@ -85,8 +88,8 @@ Style/RegexpLiteral:
Exclude:
- 'Guardfile'

Style/FrozenStringLiteralComment:
Enabled: false
Style/StringLiterals:
EnforcedStyle: double_quotes

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: 'comma'
Expand Down
26 changes: 13 additions & 13 deletions Gemfile
@@ -1,22 +1,22 @@
source 'https://rubygems.org'
source "https://rubygems.org"

gem 'rake'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem "rake"
gem "rubocop-rake"
gem "rubocop-rspec"

group :development do
gem 'pry'
gem "pry"
end

group :test do
gem 'coveralls'
gem 'rb-readline', '>= 0.5.5'
gem 'rspec', '>= 3'
gem 'rubocop', '>= 0.79'
gem 'simplecov', '>= 0.18.2'
gem 'timecop'
gem 'tins'
gem 'webmock', '>= 3.8.2'
gem "coveralls"
gem "rb-readline", ">= 0.5.5"
gem "rspec", ">= 3"
gem "rubocop", ">= 0.79"
gem "simplecov", ">= 0.18.2"
gem "timecop"
gem "tins"
gem "webmock", ">= 3.8.2"
end

gemspec
14 changes: 7 additions & 7 deletions Rakefile
@@ -1,21 +1,21 @@
require 'bundler'
require "bundler"
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)

begin
require 'rubocop/rake_task'
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
desc 'Run RuboCop'
desc "Run RuboCop"
task :rubocop do
warn 'Rubocop is disabled'
warn "Rubocop is disabled"
end
end

Dir.glob('tasks/*.rake').each { |r| import r }
Dir.glob("tasks/*.rake").each { |r| import r }

task release: ['completion:zsh', 'completion:bash']
task release: ["completion:zsh", "completion:bash"]
task test: :spec
task default: %i[spec rubocop]
26 changes: 13 additions & 13 deletions bin/t
Expand Up @@ -2,11 +2,11 @@

# Trap interrupts to quit cleanly. See
# https://twitter.com/mitchellh/status/283014103189053442
Signal.trap('INT') { abort }
Signal.trap("INT") { abort }

require 'oauth'
require 't'
require 'twitter'
require "oauth"
require "t"
require "twitter"

# Output message to $stderr, prefixed with the program name
def pute(*args)
Expand All @@ -19,21 +19,21 @@ end
begin
T::CLI.start(ARGV)
rescue Interrupt
pute 'Quitting...'
pute "Quitting..."
rescue OAuth::Unauthorized
pute 'Authorization failed'
pute "Authorization failed"
rescue Twitter::Error::TooManyRequests => e
pute e.message, "The rate limit for this request will reset in #{e.rate_limit.reset_in} #{e.rate_limit.reset_in == 1 ? 'second' : 'seconds'}."
rescue Twitter::Error::BadRequest => e
pute e.message, 'Run `t authorize` to authorize.'
pute e.message, "Run `t authorize` to authorize."
rescue Twitter::Error::Forbidden, Twitter::Error::Unauthorized => e
if e.message == 'Error processing your OAuth request: Read-only application cannot POST' ||
e.message == 'This application is not allowed to access or delete your direct messages'
if e.message == "Error processing your OAuth request: Read-only application cannot POST" ||
e.message == "This application is not allowed to access or delete your direct messages"
warn(%q(Make sure to set your Twitter application's Access Level to "Read, Write and Access direct messages".))
require 'thor'
Thor::Shell::Basic.new.ask 'Press [Enter] to open the Twitter Developer site.'
require 'launchy'
Launchy.open('https://dev.twitter.com/apps') { |u, _, _| warn "Manually open #{u}" }
require "thor"
Thor::Shell::Basic.new.ask "Press [Enter] to open the Twitter Developer site."
require "launchy"
Launchy.open("https://dev.twitter.com/apps") { |u, _, _| warn "Manually open #{u}" }
else
pute e.message
end
Expand Down
4 changes: 2 additions & 2 deletions lib/t.rb
@@ -1,5 +1,5 @@
require 't/cli'
require 'time'
require "t/cli"
require "time"

module T
class << self
Expand Down

0 comments on commit e4c8efa

Please sign in to comment.