Skip to content

Commit

Permalink
Merge pull request #97 from apainintheneck/use-standard-instead-of-ru…
Browse files Browse the repository at this point in the history
…bocop

Use standard instead of rubocop
  • Loading branch information
apainintheneck authored Feb 23, 2025
2 parents a89dbeb + abf419d commit 5bc6a5f
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
bundler-cache: true

- name: Run linter
run: bundle exec rake lint
run: bundle exec rake standard

- name: Run tests
run: bundle exec rake test
78 changes: 0 additions & 78 deletions .rubocop.yml

This file was deleted.

4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ gem "rake"

gem "minitest"

gem "rubocop"
gem "rubocop-minitest"
gem "rubocop-rake"
gem "standard"

gem "countries"
gem "iso-639"
Expand Down
31 changes: 18 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ GEM
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.10.0)
rubocop (1.72.1)
rubocop (1.71.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -44,14 +43,22 @@ GEM
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
rubocop-minitest (0.37.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rake (0.7.0)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
standard (1.45.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.71.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.6)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.6.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.23.0)
strings (0.2.1)
strings-ansi (~> 0.2)
unicode-display_width (>= 1.5, < 3.0)
Expand All @@ -75,9 +82,7 @@ DEPENDENCIES
minitest
money
rake
rubocop
rubocop-minitest
rubocop-rake
standard

BUNDLED WITH
2.4.10
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Language data is sourced from the [ISO-639](https://github.com/xwmx/iso-639) gem

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. Use either `rake lint` to lint the code or `rake fix` to automatically fix simple linter errors.
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. Use either `rake standard` to lint the code.

You can also run `bin/console` for an interactive prompt that will allow you to experiment.

Expand Down
9 changes: 2 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "bundler/gem_tasks"
require "rake/testtask"
require "standard/rake"
require "tempfile"

Rake::TestTask.new(:test) do |t|
Expand All @@ -14,13 +15,7 @@ require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[lint test readme:outdated cache:outdated]

desc "Shortcut for `rake rubocop`"
task lint: :rubocop

desc "Shortcut for `rake rubocop:autocorrect`"
task fix: :"rubocop:autocorrect"
task default: %i[standard test readme:outdated cache:outdated]

namespace "readme" do
desc "Check if the readme needs to be regenerated"
Expand Down
2 changes: 1 addition & 1 deletion atlasq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.metadata = {
"homepage_uri" => "https://github.com/apainintheneck/atlasq/",
"changelog_uri" => "https://github.com/apainintheneck/atlasq/blob/main/CHANGELOG.md",
"rubygems_mfa_required" => "true",
"rubygems_mfa_required" => "true"
}

spec.files = Dir["{lib,exe}/**/*", "{cache}/**/*.json"]
Expand Down
12 changes: 6 additions & 6 deletions lib/atlasq/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.title(title)
[
"*",
"* #{title}",
"*#{" *" * ((title.size / 2) + 2)}",
"*#{" *" * ((title.size / 2) + 2)}"
].join("\n")
end

Expand Down Expand Up @@ -56,7 +56,7 @@ def self.brief_template(title:, elements:)

[
Format.title(title),
*elements,
*elements
].join("\n")
end

Expand All @@ -78,7 +78,7 @@ def self.country(country_code)
[
Format.country_title(country_code),
Format.one_line_country(country_code),
Format.multiline_country(country_code),
Format.multiline_country(country_code)
].join("\n")
end

Expand Down Expand Up @@ -113,7 +113,7 @@ def self.subregions(subregions)
subregions = subregions.to_h do |region, countries|
[
Util::String.titleize(region),
countries.map(&Format.method(:one_line_country)),
countries.map(&Format.method(:one_line_country))
]
end

Expand All @@ -127,7 +127,7 @@ def self.currencies(currencies, partial_match: false)
currencies = currencies.to_h do |currency, countries|
[
Format.one_line_currency(currency),
countries.map(&Format.method(:one_line_country)),
countries.map(&Format.method(:one_line_country))
]
end

Expand Down Expand Up @@ -156,7 +156,7 @@ def self.languages(languages, partial_match: false)
languages = languages.to_h do |language, countries|
[
Format.one_line_language(language),
countries.map(&Format.method(:one_line_country)),
countries.map(&Format.method(:one_line_country))
]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/atlasq/util/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module String
ABBREVIATIONS = {
"AMER" => "North, Central and South America",
"APAC" => "Asia-Pacific",
"EMEA" => "Europe, Middle East, and Africa",
"EMEA" => "Europe, Middle East, and Africa"
}.freeze

# @param string [String]
Expand Down
3 changes: 0 additions & 3 deletions lib/atlasq/util/word_map.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# frozen_string_literal: true

require "set"
require "unaccent"

module Atlasq
module Util
# This data structure provides partial match support for words in sentences.
Expand Down
14 changes: 7 additions & 7 deletions script/generate_formatted_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def one_line_country(country)
country.number,
country.alpha2,
country.alpha3,
country.iso_short_name,
country.iso_short_name
].compact
.join(" | ")
.then { |country_string| "(#{country_string})" }
Expand All @@ -41,7 +41,7 @@ def languages(language_codes)
ALL_COUNTRIES.to_h do |country|
[
country.alpha2.downcase,
one_line_country(country),
one_line_country(country)
]
end
end
Expand All @@ -50,7 +50,7 @@ def languages(language_codes)
ALL_COUNTRIES.to_h do |country|
[
country.alpha2.downcase,
"Country: #{country.iso_long_name}",
"Country: #{country.iso_long_name}"
]
end
end
Expand All @@ -62,7 +62,7 @@ def languages(language_codes)
"Nationality" => country.nationality,
"Region" => country.subregion,
"Continent" => country.continent,
"Currency" => "#{country.currency.symbol} #{country.currency.name}",
"Currency" => "#{country.currency.symbol} #{country.currency.name}"
}.reject do |_, value|
# "countries" like Antarctica can have missing language, nationality,
# and region data so we remove that missing data beforehand.
Expand All @@ -76,7 +76,7 @@ def languages(language_codes)

[
country.alpha2.downcase,
info_ladder.join("\n"),
info_ladder.join("\n")
]
end
end
Expand All @@ -85,7 +85,7 @@ def languages(language_codes)
ALL_CURRENCIES.to_h do |currency|
[
currency.iso_code.downcase,
"[#{currency.iso_code}] #{currency.symbol} #{currency.name}",
"[#{currency.iso_code}] #{currency.symbol} #{currency.name}"
]
end
end
Expand All @@ -94,7 +94,7 @@ def languages(language_codes)
ALL_LANGUAGES.to_h do |language|
[
language.alpha2,
"(#{language.alpha2}/#{language.alpha3}) #{language.english_name}",
"(#{language.alpha2}/#{language.alpha3}) #{language.english_name}"
]
end
end
Expand Down
4 changes: 2 additions & 2 deletions script/generate_readme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def atlasq(*args)

[
"$ atlasq #{escaped_args}",
`#{EXECUTABLE_PATH} #{escaped_args}`,
`#{EXECUTABLE_PATH} #{escaped_args}`
].join("\n")
end

Expand Down Expand Up @@ -95,7 +95,7 @@ def atlasq(*args)
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. Use either `rake lint` to lint the code or `rake fix` to automatically fix simple linter errors.
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. Use either `rake standard` to lint the code.
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Expand Down
Loading

0 comments on commit 5bc6a5f

Please sign in to comment.