countries/countries
59.1
Adequate · 19 September 2026
1.2k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a Ruby gem that provides a comprehensive API for accessing and manipulating ISO 3166 country data. It supports querying countries by various codes, retrieving subdivision details, and handling translations via configurable locale management. The library also offers optional integrations with Mongoid for persistence and Money for currency data, along with tools to update postal code and subdivision translation sources.
Features
Added CLDR data import infrastructure for subdivision translations
New support classes have been added to the library's source layer to enable importing and merging subdivision translation data from the Unicode CLDR repository. This includes a downloader to fetch CLDR XML files, a subdivision updater to process and merge this data into local YAML files, and helper loaders to manage the local cache. This change provides the backend mechanism for keeping subdivision translations up to date, though it does not yet expose a direct user-facing command or API for triggering the update.
lib/countries/sources · high confidence
Added Ruby console script for interactive experimentation
A new \bin/console\ script has been added to the project, allowing users to launch an interactive Ruby IRB session with the \countries\ gem already loaded. This facilitates easier experimentation and debugging of the gem's functionality directly from the command line.
bin · high confidence
Added rake task to update country postal code data
A new \postal\_codes:update\ rake task has been added to \lib/countries/tasks/postal\_codes.rake\. This task allows users to retrieve and update postal code availability and format information for countries by fetching data from the Chromium i18n address service and applying the changes to the local YAML country data files.
lib/countries/tasks · high confidence
Behavioural changes
Introduces global configuration and locale management for country data
The library now exposes a central \ISO3166.configure\ API, allowing users to manage loaded locales and enable optional extensions like currency support via the Money gem. This change shifts translation loading to be explicit and configurable, defaulting to \I18n.available\_locales\ when available, and introduces thread-safe data handling with mutex synchronization. Additionally, it adds Mongoid integration for storing country objects and provides a global \Country\ alias for easier access.
lib/countries · high confidence
Library initialization and Mongoid integration
The main library entry point now explicitly requires the version, ISO3166, and Mongoid modules. This ensures that the ISO3166 country data is loaded by default and that Mongoid support is automatically activated if the Mongoid gem is present in the environment.
lib · high confidence
Project tooling and configuration overhaul
The project has replaced the legacy Jeweler gem with Bundler for gem management and switched the test runner from RSpec 1-style tasks to RSpec 2's RakeTask. Code quality is now enforced via new .rubocop.yml and .reek.yml configuration files, and the Rakefile has been updated to use Bundler/gem\_tasks and modern RSpec task definitions. Documentation has been migrated from RDoc to Markdown (README.rdoc removed, README.md added), and the .gitignore has been expanded to exclude common IDE, cache, and lock files.
(repo-wide) · high confidence
Refactored Country class into modular components and added new search and conversion capabilities
The Country class has been split into separate modules (class\_methods, finder\_methods, subdivision\_methods, etc.) to improve maintainability. This change introduces new features such as emoji flag support (emoji\_flag), country code conversion methods (from\_alpha2\_to\_alpha3, from\_alpha3\_to\_alpha2), and enhanced search capabilities including collect\_countries\_with and collect\_likely\_countries\_by\_subdivision\_name. It also adds a pluck method for efficient attribute extraction and improves subdivision handling with new methods like find\_subdivision\_by\_name and subdivision\_names\_with\_codes. The search functionality now supports accent-insensitive queries and handles nil inputs more robustly.
lib/countries/country · high confidence
Test coverage
Comprehensive test suite overhaul and infrastructure modernization
The test suite has been significantly expanded and modernized to improve coverage and reliability. New specs were added for the global Country class alias, configuration management (including lazy loading and locale handling), country data integrity, subdivision details, Mongoid integration, timezone support, and thread safety. The test infrastructure was upgraded by replacing the legacy 'spec' runner with RSpec, integrating SimpleCov for code coverage, adding a performance benchmark suite, and updating the spec helper to enforce stricter ordering and filtering.
spec · high confidence
Dependencies
Initial dependency setup for countries gem v8.1.0
The project now uses a standard Gemfile and gemspec to manage dependencies, establishing a minimum Ruby version of 3.2. The gem declares a runtime dependency on \unaccent\ (\~\> 0.3) and includes \money\, \rake\, and \tzinfo\ in the Gemfile. Development dependencies are explicitly defined, including \activesupport\ (\>= 8, \< 9), \nokogiri\ (\>= 1.8), \rspec\ (\>= 3), \simplecov\ (\~\> 0.22), and testing tools like \benchmark\, \debug\, \memory\_profiler\, and \ruby-prof\.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 59.
Lenses
- Code Health 100
- Architecture 69
- Maturity 38
- Readiness 82
- Security 90
Changes since last survey
- 300 commits — 233 feature/other, 67 fixes
By area
- lib/countries — 138 commits
- (repo) — 101 commits
- (root) — 47 commits
- .github/workflows — 7 commits
- spec/country_spec.rb — 4 commits
- spec/configuration_spec.rb — 2 commits
- spec/00_global_spec.rb — 1 commit
Notable commits
- fix: Add fy language to NL, fixes #843
- fix: Add the old iso_short_names as unofficial_names. Fixes #923
- fix: Additional ES languages + fixes to outdated official languages
- fix: Allow locales to be set with strings. Fixes #916
- fix: Fix ER currency. Fixes #859
- fix: Fix Rubocop issues
- fix: Fix Ruby 4.0 test failure: benchmark no longer a default gem Remove the require from data_spec.rb (Benchmark is unused there). Add benchmark to the Gemfile dev/test group, since spec/perf_spec.rb uses it
- fix: Fix SG - Singapura country name in pt-BR
- fix: Fix Spanish translation of DZ (Algeria). Fixes #889
- fix: Fix Turkey translation to english.
- fix: Fix VAT rate for Finland as of 01/09/2024
- fix: Fix ZA province name
- fix: Fix coverage measurement and close spec gaps
- fix: Fix error in collect_countries_with and update specs
- fix: Fix error when searching ISO3166::Country[nil]. Fixes #912
- fix: Fix example for languages with dashes
- fix: Fix flaky specs: - Ensure Data.reset is called after locales are changed - Ensure :en locale is set by default for all specs - Do not freeze Country methods
- fix: Fix four IN subdivision names where top-level name: is inconsistent
- fix: Fix inconsistent subdivision coordinates
- fix: Fix misuse File.join with nested array
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
countries/countries was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 1dd30159c2083cd1fbf844f7ad82befe678c844c — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.