Skip to content
CAI
Software that uses CAICheck a score

DavyJonesLocker/client_side_validations

64.9

Adequate · 19 September 2026

853

lines of production code

Ruby

with JavaScript

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a Ruby gem that provides client-side form validation for Rails applications by synchronizing server-side ActiveModel and ActiveRecord rules with the browser. It generates structured validation metadata for HTML forms and executes native JavaScript checks to prevent invalid submissions. The library supports modern Rails versions and integrates with various asset pipelines through dedicated generators.

How it got here

2011 — v25 modernization and Rails 7.2 support

28 changes.

This period focused on upgrading the library to version 25.0.0, dropping legacy dependencies like Mongoid and jQuery, and adding support for Rails 7.2 and Ruby 3.2. The architecture was modernized by replacing the JavaScript build toolchain with Rolldown and Oxlint, refactoring validators to support conditionals and proc-based options, and shifting validation metadata to a centralized JSON structure. Comprehensive test suites were added for both Ruby and client-side JavaScript to ensure stability across these significant changes.

2019–2021 — ES6 migration and jQuery removal

4 changes.

The codebase underwent a comprehensive modernization by rewriting client-side validation logic and validators in ES6 modules, completely removing the jQuery dependency in favor of native DOM APIs. This refactoring improved maintainability and ensured compatibility with modern JavaScript environments, including support for Rails 7.2+ and Turbo, while updating distributed assets to version 25.0.0.

Features

Added client-side validations initializer template with configurable error handling

A new initializer template has been added to the generator templates, providing a commented-out configuration block for ClientSideValidations. This template allows users to enable specific disabled validators, toggle locale-aware number formatting, and customize the \field\_error\_proc\ to control how validation error messages are rendered within input fields, specifically supporting encapsulation within label tags for cleaner error display.

lib/generators/templates · high confidence

New asset and install generators for client-side validations

The library now provides dedicated Rails generators to simplify setup. The new CopyAssetsGenerator automatically detects the asset pipeline (Sprockets or Webpacker) and copies the necessary JavaScript validation files to the appropriate directory (app/assets/javascripts or public/javascripts). The InstallGenerator extends this by also copying the configuration initializer to config/initializers, streamlining the integration process for new Rails applications.

_lib/generators/client\_side\validations · high confidence

Removals

Removed custom Mongoid uniqueness validator

The custom uniqueness validator for Mongoid (\lib/client\_side\_validations/mongoid/uniqueness.rb\) has been removed. This file previously defined a \message\_types\ method returning \\[:taken\]\, which is no longer part of the library's validation logic.

_lib/client\_side\validations/mongoid · high confidence

Behavioural changes

Added support for Rails 7.2, 8.0, 8.1, and edge versions

The gemfiles directory now includes new appraisal configurations for testing against Rails 7.2.0, 8.0.0, 8.1.0, and the Rails main branch (edge). These files, generated by Appraisal2, allow the library to be tested for compatibility with these newer and upcoming Rails versions, ensuring users can adopt the library as they upgrade their Rails applications.

gemfiles · high confidence

Client Side Validations JS v25.0.0

The vendor JavaScript asset for client-side form validation has been updated to version 25.0.0. This release replaces the previous jQuery-dependent implementation with a modern, vanilla JavaScript codebase that uses native DOM APIs (such as \addEventListener\ and \CustomEvent\) instead of jQuery methods. For users, this means the validation library no longer requires jQuery as a runtime dependency, resulting in a lighter footprint and improved compatibility with modern JavaScript bundlers and frameworks that do not rely on jQuery.

vendor · high confidence

Client Side Validations JS v25.0.0 released with modernized JavaScript and removed jQuery dependency

The distributed JavaScript assets in the dist folder have been regenerated for version 25.0.0, reflecting a major overhaul of the client-side validation library. The codebase has been converted to ES6 modules and modern JavaScript syntax, removing the previous jQuery dependency entirely in favor of native DOM APIs. This update also introduces Turbo compatibility, ensures validation does not run on dynamically disabled inputs, and utilizes the HTML dataset API for accessing configuration settings, resulting in a lighter and more standards-compliant runtime for users.

dist · high confidence

Client Side Validations v25.0.0: Modernized Rails integration and architecture

This release updates the gem to version 25.0.0 and significantly refactors the internal architecture to align with modern Rails conventions. The library now uses \ActiveSupport.on\_load\ hooks to inject validations into \ActionView\ and \ActiveRecord\, replacing previous eager-loading patterns. It drops support for legacy frameworks (Mongoid integration removed, older Rails versions deprecated) and introduces a new \Config\ module for global settings like disabled validators. The core validation logic has been rewritten to support \proc\ values in validators, handle conditional validators more robustly (including \will\_save\_change\_to?\ checks), and improve error message generation with fallbacks for missing translations.

_lib/client\_side\validations · high confidence

Client-side validation logic refactored into modular ES modules

The client-side validation engine has been restructured from a single monolithic file into separate ES modules (core, events, utils, index) to improve maintainability and remove legacy dependencies. This change replaces jQuery-based DOM manipulation and event handling with native browser APIs and a custom event binding system, and migrates data access to use the HTML5 dataset API. For users, this ensures better compatibility with modern JavaScript environments and frameworks like Turbo, while preserving the existing validation behavior and callback interfaces.

src · high confidence

Improved JSON serialization for Range and Regexp validators

Client-side validation now correctly serializes Range and Regexp objects to JSON, fixing issues where these types were not properly converted for JavaScript consumption. Range objects are now serialized as arrays containing their start and end values, ensuring inclusion/exclusion validators work with floats and other types. Regexp objects are converted using the js\_regex gem, which handles complex regular expressions (including modifiers and flags) more reliably than the previous implementation, resolving stack overflow errors and incorrect pattern matching on the client side.

_lib/client\_side\_validations/core\ext · high confidence

Modernize JavaScript build toolchain and linting

The project replaces the previous JavaScript build and linting infrastructure with Oxlint v1 for linting and Rolldown v1 for bundling, resulting in significantly faster development and build times. Babel is no longer required as Rolldown handles transpilation, and the build process now uses pnpm. Configuration files for these tools (\.oxlintrc.json\, \rolldown.config.mjs\) and updated Rake tasks for JavaScript linting and building are included in this change.

(repo-wide) · high confidence

Refactored ActiveModel validators to support conditionals and proc-based options

The client-side validation logic for ActiveModel validators has been refactored to support conditional validation execution and dynamic (proc-based) options. A new \Conditionals\ module enables the use of \if\ and \unless\ specifications, allowing validations to be skipped based on runtime conditions. Additionally, validators such as \Length\, \Numericality\, and \Format\ now support proc values for their options (e.g., dynamic length limits or regex patterns), resolving these values only when forced. The internal structure of validators has also been standardized to use a single \message\_type\ method instead of \message\_types\, and support for \allow\_nil\ has been aligned with \allow\_blank\ in \Numericality\ and \Length\ validators.

_lib/client\_side\_validations/active\model · high confidence

Refactored library initialization to use modular requires

The main library entry point has been restructured to explicitly require specific components (config, active\_model, active\_record, action\_view, engine, and generators) only when their respective dependencies are defined. This replaces the previous placeholder implementation with a modular loading strategy that conditionally loads Rails-specific engine and generator code, improving initialization clarity and dependency management.

lib · high confidence

Uniqueness validator now generates client-side validation hashes

The uniqueness validator in the ActiveRecord adapter has been refactored to generate a structured client-side validation hash instead of just returning message types. This change enables the client-side library to receive specific validation parameters such as case sensitivity, the model's primary key ID, and scope values, allowing for more accurate and context-aware validation feedback in the browser. The implementation also handles class name overrides and respects allow\_nil/allow\_blank options.

_lib/client\_side\_validations/active\record · high confidence

Validators now render in settings JSON instead of inline data attributes

Client-side validation rules are no longer injected as inline \data-\ attributes on individual form fields. Instead, the \form\_builder.rb\ and \form\_helper.rb\ modules now collect validation metadata during form construction and output it as a single \data-client-side-validations\ JSON object on the form element itself. This change simplifies the HTML structure, resolves issues with HTML parsers misinterpreting validation tags inside JavaScript, and ensures that validation settings are consistently available for the client-side engine regardless of how the form is rendered.

_lib/client\_side\_validations/action\view · high confidence

Validators rewritten in ES6 with jQuery removed

The local validators (absence, presence, acceptance, confirmation, exclusion, inclusion, format, length, numericality, and uniqueness) have been rewritten using ES6 modules and modern JavaScript syntax, removing the previous jQuery dependency. This change improves code maintainability and reduces runtime overhead by relying on native DOM APIs instead of jQuery selectors and utilities.

src/validators · high confidence

Test coverage

Added ActionView form helper test suite; Added QUnit test coverage for client-side validators; Added QUnit test runner views for JavaScript validation tests; Added QUnit test suite for client-side validation settings and element validation; Added QUnit tests for ClientSideValidations callbacks; Added QUnit tests for form validation and submission behaviors; Added test fixtures for GUID, STI, and uniqueness validation scenarios; Added test infrastructure and coverage setup; Added test model for ActiveModel validation scenarios; Added test models for ActionView validation scenarios; Added tests for ActiveRecord uniqueness validator client-side hash generation; Added tests for Install and CopyAssets generators; Added tests for Regexp and Range JSON serialization; New local test server and headless runner for JavaScript validation tests; Refactor Active Model test suite to use ActiveSupport::TestCase; Removed legacy Mongoid test suite.

Dependencies

Update dependencies and modernize build tooling

This change updates the project's dependency manifests and build configuration. The Ruby gemspec now requires Ruby \>= 3.2 and Rails \>= 7.2, adding \js\_regex\ as a runtime dependency and removing legacy development dependencies (e.g., \ruby-debug\, \mongoid\) in favor of a modern set including \rubocop\, \minitest\, and \simplecov\. The Gemfile now explicitly lists development gems and uses HTTPS for the RubyGems source. On the JavaScript side, a new \package.json\ introduces \rolldown\ as the build tool, \oxlint\ for linting, and \puppeteer-core\ for testing, requiring Node \>= 18.12 and using pnpm as the package manager.

(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 65.

Lenses

  • Code Health 70
  • Architecture 69
  • Maturity 59
  • Readiness 69
  • Security 79

Changes since last survey

  • 300 commits — 274 feature/other, 26 fixes

By area

  • (root) — 158 commits
  • (repo) — 58 commits
  • .github/workflows — 39 commits
  • src/validators — 10 commits
  • test/javascript — 8 commits
  • lib/client_side_validations — 7 commits
  • test/action_view — 6 commits
  • dist/client-side-validations.esm.js — 5 commits
  • test/active_model — 3 commits
  • .github/dependabot.yml — 2 commits
  • gemfiles/rails_5.2.gemfile — 1 commit
  • lib/generators — 1 commit
  • test/active_record — 1 commit
  • test/core_ext — 1 commit

Notable commits

  • fix: Fix CI
  • fix: Fix Rails/ActiveSupportOnLoad offences
  • fix: Fix RuboCop config
  • fix: Fix RuboCop offence
  • fix: Fix deprecation
  • fix: Fix import instructions (#1009)
  • fix: Fix links
  • fix: Fix new RuboCop offenses and update dependencies (#983)
  • fix: Fix new Style/DirectiveScope offense (#1043)
  • fix: Fix package.json engines and required Node version (#950)
  • fix: Fix rubocop offence
  • fix: Fix safe performance offences
  • fix: Fix scripts
  • fix: Fix spec for js_regex 3.10.0
  • fix: Fix specs against Rails edge
  • fix: Fix supported Rails versions
  • fix: Fix tests under Rails edge
  • fix: Fix: form_with with validate: false exception on Rails 8 (#975)
  • fix: Merge pull request #922 from DavyJonesLocker/bugfix/920-fix-missing-translations
  • fix: Merge pull request #925 from DavyJonesLocker/chore/924-fix-tests-under-rails-edge
  • …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

DavyJonesLocker/client_side_validations 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 375d2a149ffef101c47a877938a10409181d7c19 — 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.