Skip to content

Commit 5e326a9

Browse files
davidstosiksds
authored andcommitted
Simplify error message
1 parent a8d87e2 commit 5e326a9

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

lib/overcommit/hook/pre_commit/file_size.rb

+1-21
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,12 @@ def error_message_for(file)
3636
:error,
3737
file,
3838
nil,
39-
error_text_for(file)
39+
"#{file} is #{file_size(file)} bytes"
4040
)
4141
end
4242

43-
def error_text_for(file)
44-
error_text_format % {
45-
path: relative_path_for(file),
46-
limit: size_limit_bytes,
47-
size: file_size(file)
48-
}
49-
end
50-
51-
def error_text_format
52-
'%<path>s is over the file size limit of %<limit>s bytes (is %<size>s bytes)'
53-
end
54-
5543
def file_size(file)
5644
File.size(file)
5745
end
58-
59-
def relative_path_for(file)
60-
Pathname.new(file).relative_path_from(repo_root_path)
61-
end
62-
63-
def repo_root_path
64-
@repo_root_path ||= Pathname.new(Overcommit::Utils.repo_root)
65-
end
6646
end
6747
end

0 commit comments

Comments
 (0)