Skip to content

Commit

Permalink
fallback to overview.html when pages do not exist for compare option (w…
Browse files Browse the repository at this point in the history
  • Loading branch information
rishijain authored Oct 18, 2023
1 parent 2f7e4be commit 92a20aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [CHANGE] Add rexml dependency for Ruby 3.0.0+ support (by [@fbuys][])
* [BUGFIX] Raise error when the same branches are compared (by [@rishijain][])
* [BUGFIX] Churn score was always 0 when rubycritic was executed from a sub-directory (by [@rishijain][])
* [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)

Expand Down
5 changes: 4 additions & 1 deletion lib/rubycritic/generators/html/view_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
index_path = "#{root_directory_path}/#{file_name}"
index_path = "#{root_directory_path}/overview.html" unless File.exist?(index_path)
file_path(index_path)
end

private
Expand Down

0 comments on commit 92a20aa

Please sign in to comment.