diff --git a/CHANGELOG.md b/CHANGELOG.md index 59368630..158709c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ * [CHANGE] Disable VERBOSE warnings in test stubs (by [@fbuys][]) * [CHANGE] Add rexml dependency for Ruby 3.0.0+ support (by [@fbuys][]) * [BUGFIX] Raise error when the same branches are compared (by [@rishijain][]) +* [BUGFIX] Use overview.html as the fallback path when files does not exist during compare option (by [@rishijain][]) +>>>>>>> c55ca22 (fallback to overview.html when pages do not exist for compare option) # 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..c9bb4c9c 100644 --- a/lib/rubycritic/generators/html/view_helpers.rb +++ b/lib/rubycritic/generators/html/view_helpers.rb @@ -24,7 +24,10 @@ def smell_location_path(location) end def code_index_path(root_directory, file_name) - file_path("#{File.expand_path(root_directory)}/#{file_name}") + root_directory_path = File.expand_path(root_directory) + file_path = "#{root_directory_path}/#{file_name}" + file_path = "#{root_directory_path}/overview.html" unless File.exist?(file_path) + file_path(file_path) end private