File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,8 +86,29 @@ def self.generate_baseline
8686 puts "Done!"
8787 end
8888
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+
89109 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
91112
92113 changed_filenames = calculate_changed_filenames ( pattern )
93114
You can’t perform that action at this time.
0 commit comments