From 05b560e6c4511e42c67df22eec7abb18abe656b7 Mon Sep 17 00:00:00 2001 From: rishijain Date: Mon, 16 Oct 2023 19:04:12 +0700 Subject: [PATCH] fallback to overview.html when pages do not exist for compare option --- CHANGELOG.md | 1 + lib/rubycritic/generators/html/view_helpers.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 529eb58d..df14db49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * [CHANGE] Fix test warning related to `cucumber_opts` declaration (by [@faisal][]) * [BUGFIX] Stop using long-deprecated MiniTest module name, removed in 5.19.0 (by [@faisal][]) * [CHANGE] Disable VERBOSE warnings in test stubs (by [@fbuys][]) +* [BUGFIX] Use overview.html as the fallback path when files does not exist during compare option (by [@rishijain][]) # v4.8.1 / 2023-05-17 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.8.0...v4.8.1) diff --git a/lib/rubycritic/generators/html/view_helpers.rb b/lib/rubycritic/generators/html/view_helpers.rb index afbc48b1..30b7cfb2 100644 --- a/lib/rubycritic/generators/html/view_helpers.rb +++ b/lib/rubycritic/generators/html/view_helpers.rb @@ -24,7 +24,9 @@ def smell_location_path(location) end def code_index_path(root_directory, file_name) - file_path("#{File.expand_path(root_directory)}/#{file_name}") + file_path = "#{File.expand_path(root_directory)}/#{file_name}" + file_path = file_path('overview.html') unless File.exist?(file_path) + file_path(file_path) end private