Class: RailsDoctor::Checks::RailsChecks
- Inherits:
-
Object
- Object
- RailsDoctor::Checks::RailsChecks
- Defined in:
- lib/rails_doctor/checks/rails_checks.rb
Constant Summary collapse
- NAME =
"rails_checks"- RESTFUL_ACTIONS =
%w[index show new create edit update destroy].freeze
- SINGULAR_RESTFUL_ACTIONS =
%w[show new create edit update destroy].freeze
- DEVISE_INHERITED_ACTIONS =
{ "Devise::ConfirmationsController" => %w[new create show], "Devise::OmniauthCallbacksController" => %w[failure passthru], "Devise::PasswordsController" => %w[new create edit update], "Devise::RegistrationsController" => %w[cancel create destroy edit new update], "Devise::SessionsController" => %w[create destroy new], "Devise::UnlocksController" => %w[new create show] }.freeze
- FALLBACK_IRREGULAR_PLURALS =
{ "person" => "people" }.freeze
Instance Attribute Summary collapse
-
#changed_files ⇒ Object
readonly
Returns the value of attribute changed_files.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(project:, config:, runner:, profile:, changed_files: []) ⇒ RailsChecks
constructor
A new instance of RailsChecks.
- #install_guidance ⇒ Object
- #name ⇒ Object
- #run ⇒ Object
- #unavailable_reason ⇒ Object
Constructor Details
#initialize(project:, config:, runner:, profile:, changed_files: []) ⇒ RailsChecks
Returns a new instance of RailsChecks.
29 30 31 32 33 34 35 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 29 def initialize(project:, config:, runner:, profile:, changed_files: []) @project = project @config = config @runner = runner @profile = profile @changed_files = changed_files end |
Instance Attribute Details
#changed_files ⇒ Object (readonly)
Returns the value of attribute changed_files.
27 28 29 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 27 def changed_files @changed_files end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
27 28 29 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 27 def config @config end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
27 28 29 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 27 def profile @profile end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
27 28 29 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 27 def project @project end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
27 28 29 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 27 def runner @runner end |
Instance Method Details
#available? ⇒ Boolean
41 42 43 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 41 def available? project.rails_app? end |
#install_guidance ⇒ Object
49 50 51 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 49 def install_guidance "Run Rails Doctor from the root of a Rails 7.1+ application." end |
#name ⇒ Object
37 38 39 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 37 def name NAME end |
#run ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 53 def run findings = [] findings.concat(missing_foreign_key_indexes) findings.concat(missing_unique_indexes) findings.concat(route_action_view_findings) findings.concat(large_artifact_findings) findings.concat(todo_density_findings) findings.concat(missing_test_counterparts) findings.concat(coverage_gap_findings) { tool_run: ToolRun.new( name: name, available: true, skipped: false, exit_status: 0, metadata: { checks: %w[indexes uniqueness routes views size todos tests coverage-gaps] } ), findings: findings } end |
#unavailable_reason ⇒ Object
45 46 47 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 45 def unavailable_reason "This does not look like a Rails app." end |