Skip to content

Commit

Permalink
Adjust default yardoc settings
Browse files Browse the repository at this point in the history
* Show all APIs, not just the ones tagged as public.
* Show private methods, show protected methods.
* Hide everything tagged with @Private
* Fix yard choking on the template files
  `.tt` is the de-facto file name to be used for templates regardless.
* Hide the generator classes in yard, they aren't useful
* Fail yardoc on warnings to prevent failures in CI
  • Loading branch information
Burgestrand committed Oct 11, 2024
1 parent e244fc2 commit d0b723b
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .yardopts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--api public --hide-void-return --markup markdown
--no-private --private --protected --hide-void-return --markup markdown --fail-on-warning
4 changes: 3 additions & 1 deletion lib/generators/pundit/install/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# frozen_string_literal: true

module Pundit
# @private
module Generators
# @private
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path("templates", __dir__)

def copy_application_policy
template "application_policy.rb", "app/policies/application_policy.rb"
template "application_policy.rb.tt", "app/policies/application_policy.rb"
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/generators/pundit/policy/policy_generator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# frozen_string_literal: true

module Pundit
# @private
module Generators
# @private
class PolicyGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)

def create_policy
template "policy.rb", File.join("app/policies", class_path, "#{file_name}_policy.rb")
template "policy.rb.tt", File.join("app/policies", class_path, "#{file_name}_policy.rb")
end

hook_for :test_framework
Expand Down
4 changes: 3 additions & 1 deletion lib/generators/rspec/policy_generator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# frozen_string_literal: true

# @private
module Rspec
# @private
module Generators
class PolicyGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)

def create_policy_spec
template "policy_spec.rb", File.join("spec/policies", class_path, "#{file_name}_policy_spec.rb")
template "policy_spec.rb.tt", File.join("spec/policies", class_path, "#{file_name}_policy_spec.rb")
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/generators/test_unit/policy_generator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# frozen_string_literal: true

# @private
module TestUnit
# @private
module Generators
class PolicyGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)

def create_policy_test
template "policy_test.rb", File.join("test/policies", class_path, "#{file_name}_policy_test.rb")
template "policy_test.rb.tt", File.join("test/policies", class_path, "#{file_name}_policy_test.rb")
end
end
end
Expand Down

0 comments on commit d0b723b

Please sign in to comment.