varvet/pundit
60.5
Adequate · 14 November 2026
1k
lines of production code
Ruby
primary language
7
measurements over time
What this system is
Pundit is a Ruby gem that provides a structured authorization framework for Rails applications, enabling developers to define and enforce access policies for models and controllers. It offers a context-based authorization mechanism with flexible caching, along with Rails generators to scaffold policies and tests. The system integrates with RSpec to simplify permission testing and includes development tools to streamline setup and code quality enforcement.
How it got here
2012 — Context-based authorization refactoring
6 changes.
This period focused on restructuring Pundit's internal authorization logic around a new request-scoped Context class to manage user state and policy caching. The update introduced generators for scaffolding policies, added comprehensive test coverage, and established a new linting infrastructure using RuboCop and StandardRB.
2014–2025 — test infrastructure and development tooling
6 changes.
This period focused on expanding test coverage for Pundit's authorization logic, context classes, and view helpers by introducing comprehensive test suites and support utilities. The work also included establishing lightweight model and policy stubs to facilitate mocking, alongside adding convenience scripts to streamline the local development environment setup.
Features
Added development convenience scripts
New bin scripts have been added to streamline the development workflow. The bin/console script provides an interactive Ruby environment with Bundler and Pundit pre-loaded for easier experimentation, while bin/setup automates the initial environment configuration by running bundle install.
bin · high confidence
New generators for application and model policies with test scaffolding
The library now includes Rails generators to scaffold Pundit policies. Running \rails generate pundit:install\ creates a base \ApplicationPolicy\ class with default deny-all permissions and a scope structure. Running \rails generate pundit:policy \<name\>\ generates a model-specific policy inheriting from \ApplicationPolicy\ and automatically creates corresponding test files for either RSpec or Test::Unit, depending on the project's test framework.
lib/generators · high confidence
Behavioural changes
Deprecate direct inclusion of Pundit module in favor of Pundit::Authorization
Including the \Pundit\ module directly in controllers or helpers is now deprecated and will emit a warning directing users to include \Pundit::Authorization\ instead. The \Pundit\ module now acts as a shim that delegates to \Pundit::Authorization\, while also exposing class-level methods (\authorize\, \policy\, \policy\_scope\, etc.) that create a \Pundit::Context\ to handle authorization logic. This change separates the core authorization logic into its own module and introduces a context-based approach for managing user and policy cache state.
lib · high confidence
Pundit authorization logic restructured around a request-scoped Context and cache stores
Pundit's internal authorization mechanism has been refactored to use a new \Pundit::Context\ class that encapsulates the current user and a policy cache for the duration of a request. Controller helpers in \Pundit::Authorization\ now delegate to this context, and the previous \policies\ cache method is deprecated in favor of \pundit\_policies\. A new \CacheStore\ interface is introduced with \LegacyStore\ (caching by record only) and \NullStore\ (no caching) implementations, allowing for more flexible policy lookup caching. Additionally, a \pundit\_reset!\ method is added to clear cached authorization data when the user context changes, and RSpec integration is updated to support the \:focus\ metadata for filtering tests.
lib/pundit · high confidence
Update to Pundit 2.5.2 and introduce RuboCop/Standard linting
This release updates the gem to version 2.5.2 and introduces a new linting infrastructure using RuboCop and StandardRB. The configuration files \.rubocop\_ignore\_git.yml\ and \.standard.yml\ are added to manage code style, with the latter extending the RuboCop config and targeting Ruby 3.2. The \Rakefile\ is updated to include tasks for running RSpec, YARD documentation, and RuboCop checks. The changelog notes fixes for RSpec 4 compatibility, a deprecation of \Pundit::Authorization\#policies\ in favor of \\#pundit\_policies\, and improved error handling for the \permissions\ matcher.
(repo-wide) · high confidence
Test coverage
Added comprehensive test suite for Pundit authorization and policy resolution; Added test coverage for PostPolicy permissions; Added test coverage for Pundit::Context and view-level policy\_scope; Added test support models for Pundit policy testing; Added test support policies for Pundit coverage; Added test support utilities for controller, cache, and instance tracking.
Dependencies
Updated gemspec metadata and added development dependencies
The Pundit gemspec has been updated to include comprehensive metadata such as license, homepage, and issue tracker URIs, and authors have been expanded to include Varvet AB. Additionally, the Gemfile now explicitly lists development and testing dependencies including RSpec, SimpleCov, Standard, and Logger (to address JRuby 9.3 compatibility), while the gemspec adds a runtime dependency on ActiveSupport.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 61 → 60 (-0.1)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 76 → 74 (-1.9)
- Architecture 69 → 69 (+0.0)
- Maturity 53 → 53 (+0.0)
- Readiness 59 → 59 (+0.0)
- Security 100 → 100 (+0.0)
Resolved (1)
- Off-boarding risk: anonymized user #1
New (1)
- Off-boarding risk: anonymized user #1
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
varvet/pundit 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 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit ea9e31a2d7993f038ee52b94ccc9c7411637ba89 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.