This repository was archived by the owner on Feb 19, 2020. It is now read-only.
File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,19 @@ def self.logger_to_stdout
21
21
end
22
22
23
23
def self . logger_to_file
24
- log_filename = self . temp_dir + 'codacy-coverage_' + Date . today . to_s + '.log'
25
- log_file = File . open ( log_filename , 'a' )
24
+ log_file_path = self . temp_dir + self . log_file_name
25
+ log_file = File . open ( log_file_path , 'a' )
26
26
Logger . new ( log_file )
27
27
end
28
28
29
+ def self . log_file_name
30
+ today = Date . today
31
+ # rails overrides to_s method of Date class
32
+ # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/date/conversions.rb#L52
33
+ timestamp = today . respond_to? ( :to_default_s ) ? today . to_default_s : today . to_s
34
+ 'codacy-coverage_' + timestamp + '.log'
35
+ end
36
+
29
37
def self . temp_dir
30
38
directory_name = Dir . tmpdir + "/codacy-coverage/"
31
39
Dir . mkdir ( directory_name ) unless File . exists? ( directory_name )
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ def self.commit_id
13
13
commit
14
14
end
15
15
16
+ def self . work_dir
17
+ work_dir = ENV [ 'WORK_DIR' ] || git_dir
18
+ work_dir
19
+ end
20
+
16
21
def self . git_commit
17
22
git ( "log -1 --pretty=format:'%H'" )
18
23
end
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module Codacy
2
2
module Parser
3
3
4
4
def self . parse_file ( simplecov_result )
5
- project_dir = Codacy ::Git . git_dir
5
+ project_dir = Codacy ::Git . work_dir
6
6
7
7
logger . info ( "Parsing simplecov result to Codacy format..." )
8
8
logger . debug ( simplecov_result . original_result )
@@ -36,4 +36,4 @@ def self.logger
36
36
Codacy ::Configuration . logger
37
37
end
38
38
end
39
- end
39
+ end
You can’t perform that action at this time.
0 commit comments