File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,29 @@ def self.generate_baseline
86
86
puts "Done!"
87
87
end
88
88
89
+ def self . setup_baseline_for_branch
90
+ main_branch = CodeclimateDiff . configuration [ "main_branch_name" ] || "main"
91
+
92
+ project_repo = `basename $(pwd)` . strip
93
+
94
+ puts "Creating a temp worktree to generate the baseline..."
95
+ system ( "git worktree add ../temp-codeclimate #{ main_branch } " )
96
+
97
+ Dir . chdir ( "../temp-codeclimate" ) do
98
+ # Execute shell command in the '../temp-codeclimate' directory
99
+ generate_baseline
100
+
101
+ puts "Copying the baseline to #{ project_repo } ..."
102
+ system ( "cp codeclimate_diff_baseline.json ../#{ project_repo } " )
103
+ end
104
+
105
+ puts ( "Removing the temp worktree..." )
106
+ system ( "git worktree remove ../temp-codeclimate" )
107
+ end
108
+
89
109
def self . run_diff_on_branch ( pattern , always_analyze_all_files : false , show_preexisting : true )
90
- CodeclimateWrapper . new . pull_latest_image
110
+ # CodeclimateWrapper.new.pull_latest_image
111
+ setup_baseline_for_branch
91
112
92
113
changed_filenames = calculate_changed_filenames ( pattern )
93
114
You can’t perform that action at this time.
0 commit comments