From 220b9614255b74546d9e79f860aff80c8d529540 Mon Sep 17 00:00:00 2001 From: "Tj (bougyman) Vanderpoel" Date: Fri, 26 Jan 2024 09:25:05 -0600 Subject: [PATCH] Back to single quoted strings --- .rubocop.yml | 4 +-- Gemfile | 20 +++++++------- Rakefile | 6 ++-- bin/console | 6 ++-- exe/lc | 2 +- features/support/setup.rb | 2 +- lib/linear.rb | 8 +++--- lib/linear/api.rb | 14 +++++----- lib/linear/cli.rb | 18 ++++++------ lib/linear/cli/version.rb | 2 +- lib/linear/commands/issue.rb | 2 +- lib/linear/commands/issue/list.rb | 10 +++---- lib/linear/commands/whoami.rb | 6 ++-- lib/linear/fragments.rb | 4 +-- lib/linear/models/issue.rb | 4 +-- lib/linear/models/user.rb | 4 +-- linear-cli.gemspec | 46 +++++++++++++++---------------- spec/helper.rb | 2 +- spec/linear/cli_spec.rb | 6 ++-- spec/spec_helper.rb | 4 +-- 20 files changed, 85 insertions(+), 85 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7861579..98730f9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,12 +4,12 @@ require: - rubocop-rspec AllCops: - TargetRubyVersion: 3.3.0 + TargetRubyVersion: 3.2.0 NewCops: enable Style/StringLiterals: Enabled: true - EnforcedStyle: double_quotes + EnforcedStyle: single_quotes Style/StringLiteralsInInterpolation: Enabled: true diff --git a/Gemfile b/Gemfile index 65ce7ec..242b7a8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,18 @@ # frozen_string_literal: true -source "https://rubygems.org" +source 'https://rubygems.org' # Specify your gem's dependencies in linear-cli.gemspec gemspec group :development, :test do - gem "aruba", "~> 2.2" - gem "cucumber", "~> 9.1" - gem "gem-release", "~> 2.2" - gem "pry-byebug" - gem "rake", "~> 13.0" - gem "rspec", "~> 3.0" - gem "rubocop", "~> 1.21" - gem "rubocop-rake", require: false - gem "rubocop-rspec", require: false + gem 'aruba', '~> 2.2' + gem 'cucumber', '~> 9.1' + gem 'gem-release', '~> 2.2' + gem 'pry-byebug' + gem 'rake', '~> 13.0' + gem 'rspec', '~> 3.0' + gem 'rubocop', '~> 1.21' + gem 'rubocop-rake', require: false + gem 'rubocop-rspec', require: false end diff --git a/Rakefile b/Rakefile index cca7175..4964751 100644 --- a/Rakefile +++ b/Rakefile @@ -1,11 +1,11 @@ # frozen_string_literal: true -require "bundler/gem_tasks" -require "rspec/core/rake_task" +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) -require "rubocop/rake_task" +require 'rubocop/rake_task' RuboCop::RakeTask.new diff --git a/bin/console b/bin/console index 7210598..c80a3e4 100755 --- a/bin/console +++ b/bin/console @@ -1,9 +1,9 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require "bundler/setup" -require "pry" -require "linear" +require 'bundler/setup' +require 'pry' +require 'linear' # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/exe/lc b/exe/lc index e78d63a..5f3b67a 100755 --- a/exe/lc +++ b/exe/lc @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require "linear" +require 'linear' Rubyists::Linear::L :cli Dry::CLI.new(Rubyists::Linear::CLI).call diff --git a/features/support/setup.rb b/features/support/setup.rb index 25a3b5d..751674f 100644 --- a/features/support/setup.rb +++ b/features/support/setup.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -require "aruba/cucumber" +require 'aruba/cucumber' diff --git a/lib/linear.rb b/lib/linear.rb index a3e9985..e7cd919 100644 --- a/lib/linear.rb +++ b/lib/linear.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require "pathname" -require "semantic_logger" +require 'pathname' +require 'semantic_logger' SemanticLogger.default_level = :info SemanticLogger.add_appender(io: $stderr, formatter: :color) @@ -17,7 +17,7 @@ module Rubyists module Linear include SemanticLogger::Loggable # rubocop:disable Layout/SpaceAroundOperators - ROOT = (Pathname(__FILE__)/"../..").expand_path + ROOT = (Pathname(__FILE__)/'../..').expand_path LIBROOT = ROOT/:lib/:linear MODEL_ROOT = ROOT/:lib/:linear/:models SPEC_ROOT = ROOT/:spec @@ -42,7 +42,7 @@ def self.verbosity def self.verbosity=(debug) return verbosity unless debug - logger.warn "Debug level should be between 0 and 3" unless debug.between?(0, 3) + logger.warn 'Debug level should be between 0 and 3' unless debug.between?(0, 3) @verbosity = debug level = @verbosity > (DEBUG_LEVELS.size - 1) ? :trace : DEBUG_LEVELS[@verbosity] SemanticLogger.default_level = level diff --git a/lib/linear/api.rb b/lib/linear/api.rb index 59f08ab..2ea0a83 100644 --- a/lib/linear/api.rb +++ b/lib/linear/api.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true -require "httpx" -require "semantic_logger" +require 'httpx' +require 'semantic_logger' module Rubyists module Linear # Responsible for making requests to the Linear API class GraphApi include SemanticLogger::Loggable - BASE_URI = "https://api.linear.app/graphql" + BASE_URI = 'https://api.linear.app/graphql' RETRY_AFTER = lambda do |*| @retries ||= 0 @retries += 1 @@ -25,13 +25,13 @@ def session def headers @headers ||= { - "Content-Type" => "application/json", - "Authorization" => api_key + 'Content-Type' => 'application/json', + 'Authorization' => api_key } end def query(query) - gql = format('{ "query": "%s" }', query.to_s.gsub("\n", "").gsub('"', '\"')) + gql = format('{ "query": "%s" }', query.to_s.gsub("\n", '').gsub('"', '\"')) res = session.post(BASE_URI, body: gql) raise SmellsBad, "Bad Response from #{BASE_URI}: #{res}" if res.error @@ -43,7 +43,7 @@ def query(query) end def api_key - @api_key ||= ENV.fetch("LINEAR_API_KEY") + @api_key ||= ENV.fetch('LINEAR_API_KEY') end end Api = Rubyists::Linear::GraphApi.new diff --git a/lib/linear/cli.rb b/lib/linear/cli.rb index 799ba68..bddf93d 100644 --- a/lib/linear/cli.rb +++ b/lib/linear/cli.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require "dry/cli" -require "dry/cli/completion/command" -require "neatjson" -require_relative "../linear" +require 'dry/cli' +require 'dry/cli/completion/command' +require 'neatjson' +require_relative '../linear' # The Rubyists module is the top-level namespace for all Rubyists projects module Rubyists @@ -16,13 +16,13 @@ module CLI module CommonOptions def self.included(mod) mod.instance_eval do - option :output, type: :string, default: "text", values: %w[text json], desc: "Output format" - option :debug, type: :integer, default: 0, desc: "Debug level" + option :output, type: :string, default: 'text', values: %w[text json], desc: 'Output format' + option :debug, type: :integer, default: 0, desc: 'Debug level' end end def display(subject, options) - return puts(JSON.neat_generate(subject)) if options[:output] == "json" + return puts(JSON.neat_generate(subject)) if options[:output] == 'json' return subject.each(&:display) if subject.respond_to?(:each) unless subject.respond_to?(:display) raise SmellsBad, "Cannot display #{subject}, there is no #display method and it is not a collection" @@ -57,14 +57,14 @@ def self.prepended(_mod) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize end # Load all our commands - Pathname.new(__FILE__).dirname.join("commands").glob("*.rb").each do |file| + Pathname.new(__FILE__).dirname.join('commands').glob('*.rb').each do |file| require file.expand_path end module Linear # Open this back up to register commands module CLI - register "completion", Dry::CLI::Completion::Command[self] + register 'completion', Dry::CLI::Completion::Command[self] end end end diff --git a/lib/linear/cli/version.rb b/lib/linear/cli/version.rb index 547e41d..569ed06 100644 --- a/lib/linear/cli/version.rb +++ b/lib/linear/cli/version.rb @@ -2,6 +2,6 @@ module Rubyists module Linear - VERSION = "0.1.7" + VERSION = '0.1.7' end end diff --git a/lib/linear/commands/issue.rb b/lib/linear/commands/issue.rb index d2975ab..316f8f4 100644 --- a/lib/linear/commands/issue.rb +++ b/lib/linear/commands/issue.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -Pathname.new(__FILE__).dirname.join("issue").glob("*.rb").each do |file| +Pathname.new(__FILE__).dirname.join('issue').glob('*.rb').each do |file| require file.expand_path end diff --git a/lib/linear/commands/issue/list.rb b/lib/linear/commands/issue/list.rb index bd64c83..63117ee 100644 --- a/lib/linear/commands/issue/list.rb +++ b/lib/linear/commands/issue/list.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "semantic_logger" +require 'semantic_logger' module Rubyists # Namespace for Linear @@ -16,10 +16,10 @@ class List include SemanticLogger::Loggable include Rubyists::Linear::CLI::CommonOptions - option :mine, type: :boolean, default: true, desc: "Only show my issues" + option :mine, type: :boolean, default: true, desc: 'Only show my issues' def call(**options) - logger.debug "Listing issues" + logger.debug 'Listing issues' display issues_for(options), options end @@ -32,8 +32,8 @@ def issues_for(options) prepend Rubyists::Linear::CLI::Caller end end - register "issue", aliases: %w[i] do |issue| - issue.register "ls", Issue::List + register 'issue', aliases: %w[i] do |issue| + issue.register 'ls', Issue::List end end end diff --git a/lib/linear/commands/whoami.rb b/lib/linear/commands/whoami.rb index 5b5f8c4..e3997a6 100644 --- a/lib/linear/commands/whoami.rb +++ b/lib/linear/commands/whoami.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "semantic_logger" +require 'semantic_logger' module Rubyists # Namespace for Linear @@ -15,13 +15,13 @@ class WhoAmI include Rubyists::Linear::CLI::CommonOptions def call(**options) - logger.debug "Getting user info" + logger.debug 'Getting user info' display Rubyists::Linear::User.me, options end prepend Rubyists::Linear::CLI::Caller end - register "whoami", WhoAmI + register 'whoami', WhoAmI end end end diff --git a/lib/linear/fragments.rb b/lib/linear/fragments.rb index 8524b24..b065f81 100644 --- a/lib/linear/fragments.rb +++ b/lib/linear/fragments.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -require "gqli" +require 'gqli' module Rubyists module Linear # Reusable fragments module Fragments extend GQLi::DSL - PageInfo = fragment("PageInfo", "PageInfo") do + PageInfo = fragment('PageInfo', 'PageInfo') do pageInfo do hasNextPage endCursor diff --git a/lib/linear/models/issue.rb b/lib/linear/models/issue.rb index 75ef16a..e464070 100644 --- a/lib/linear/models/issue.rb +++ b/lib/linear/models/issue.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "gqli" +require 'gqli' module Rubyists # Namespace for Linear @@ -15,7 +15,7 @@ class Issue BASIC_FILTER = { completedAt: { null: true } }.freeze - Base = fragment("BaseIssue", "Issue") do + Base = fragment('BaseIssue', 'Issue') do id identifier title diff --git a/lib/linear/models/user.rb b/lib/linear/models/user.rb index 8f710d0..bd9ac68 100644 --- a/lib/linear/models/user.rb +++ b/lib/linear/models/user.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "gqli" +require 'gqli' module Rubyists # Namespace for Linear @@ -12,7 +12,7 @@ class User include GQLi::DSL include SemanticLogger::Loggable - Base = fragment("BaseUser", "User") do + Base = fragment('BaseUser', 'User') do id name email diff --git a/linear-cli.gemspec b/linear-cli.gemspec index fcd290d..e76123e 100644 --- a/linear-cli.gemspec +++ b/linear-cli.gemspec @@ -1,24 +1,24 @@ # frozen_string_literal: true -require_relative "lib/linear" +require_relative 'lib/linear' Gem::Specification.new do |spec| - spec.name = "linear-cli" + spec.name = 'linear-cli' spec.version = Rubyists::Linear::VERSION - spec.authors = ["Tj (bougyman) Vanderpoel"] - spec.email = ["tj@rubyists.com"] + spec.authors = ['Tj (bougyman) Vanderpoel'] + spec.email = ['tj@rubyists.com'] - spec.summary = "CLI for interacting with Linear.app." - spec.description = "A CLI for interacting with Linear.app. Loosely based on the GitHub CLI" - spec.homepage = "https://github.com/rubyists/linear-cli" - spec.required_ruby_version = ">= 3.3.0" + spec.summary = 'CLI for interacting with Linear.app.' + spec.description = 'A CLI for interacting with Linear.app. Loosely based on the GitHub CLI' + spec.homepage = 'https://github.com/rubyists/linear-cli' + spec.required_ruby_version = '>= 3.2.0' - spec.license = "MIT" - spec.metadata["allowed_push_host"] = "https://rubygems.org" + spec.license = 'MIT' + spec.metadata['allowed_push_host'] = 'https://rubygems.org' - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = spec.homepage - spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md" + spec.metadata['homepage_uri'] = spec.homepage + spec.metadata['source_code_uri'] = spec.homepage + spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. @@ -28,20 +28,20 @@ Gem::Specification.new do |spec| f.start_with?(*%w[pkg/ bin/ test/ spec/ features/ .git .github appveyor .rspec .rubocop cucumber.yml Gemfile]) end end - spec.bindir = "exe" + spec.bindir = 'exe' spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] # Uncomment to register a new dependency of your gem - spec.add_dependency "base64" - spec.add_dependency "dry-cli", "~> 1.0" - spec.add_dependency "dry-cli-completion", "~> 1.0" - spec.add_dependency "gqli", "~> 1.2" - spec.add_dependency "httpx", "~> 1.2" - spec.add_dependency "neatjson" - spec.add_dependency "semantic_logger", "~> 4.0" + spec.add_dependency 'base64' + spec.add_dependency 'dry-cli', '~> 1.0' + spec.add_dependency 'dry-cli-completion', '~> 1.0' + spec.add_dependency 'gqli', '~> 1.2' + spec.add_dependency 'httpx', '~> 1.2' + spec.add_dependency 'neatjson' + spec.add_dependency 'semantic_logger', '~> 4.0' # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html - spec.metadata["rubygems_mfa_required"] = "true" + spec.metadata['rubygems_mfa_required'] = 'true' end diff --git a/spec/helper.rb b/spec/helper.rb index 67b78ec..abac065 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -require_relative "../lib/linear" +require_relative '../lib/linear' diff --git a/spec/linear/cli_spec.rb b/spec/linear/cli_spec.rb index 8032b5e..2dcfacf 100644 --- a/spec/linear/cli_spec.rb +++ b/spec/linear/cli_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require_relative "../helper" +require_relative '../helper' -RSpec.describe "Rubyists::Linear::CLI" do - it "has a version number" do +RSpec.describe 'Rubyists::Linear::CLI' do + it 'has a version number' do expect(Rubyists::Linear::VERSION).not_to be_nil end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b4f1952..81b534d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -require "linear/cli" +require 'linear/cli' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = ".rspec_status" + config.example_status_persistence_file_path = '.rspec_status' # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching!