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"
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.
10 11 12 13 14 15 16 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 10 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.
8 9 10 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 8 def changed_files @changed_files end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 8 def config @config end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
8 9 10 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 8 def profile @profile end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 8 def project @project end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
8 9 10 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 8 def runner @runner end |
Instance Method Details
#available? ⇒ Boolean
22 23 24 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 22 def available? project.rails_app? end |
#install_guidance ⇒ Object
30 31 32 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 30 def install_guidance "Run Rails Doctor from the root of a Rails 7.1+ application." end |
#name ⇒ Object
18 19 20 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 18 def name NAME end |
#run ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 34 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
26 27 28 |
# File 'lib/rails_doctor/checks/rails_checks.rb', line 26 def unavailable_reason "This does not look like a Rails app." end |