From dc50bac1988bd7dfdf41c1ebc2ffcc25d9a7c5c0 Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Wed, 26 Feb 2025 15:29:31 -0500 Subject: [PATCH 1/8] Add ignored files to GHA steep summary. --- tasks/steep.rake | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tasks/steep.rake b/tasks/steep.rake index 1b3a6937208..113ad8bd6f0 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -64,6 +64,34 @@ namespace :steep do $stdout.write('|') $stdout.write("\n") end + + # append ignored files from Steepfile + steepfile_path = 'Steepfile' + ignored_files = [] + + if File.exist?(steepfile_path) + File.readlines(steepfile_path).each do |line| + if line.strip.start_with?('ignore') + ignored_files << line.strip.sub('/^ignore /', '') + end + end + end + + ignored_files.each do |file| + $stdout.write('|') + $stdout.write('|') + $stdout.write(file) + $stdout.write('|') + $stdout.write('ignored') + $stdout.write('|') + $stdout.write('|') + $stdout.write('0') + $stdout.write('|') + $stdout.write('|') + $stdout.write('0') + $stdout.write('|') + $stdout.write("\n") + end else sh "steep stats --format=#{format}" end From 857fb0bac926bdf2835fcc37cc28635504cf82e5 Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Wed, 26 Feb 2025 16:06:28 -0500 Subject: [PATCH 2/8] Adjust string parsing. --- tasks/steep.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index 113ad8bd6f0..f6ad45d9f4f 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -72,13 +72,15 @@ namespace :steep do if File.exist?(steepfile_path) File.readlines(steepfile_path).each do |line| if line.strip.start_with?('ignore') - ignored_files << line.strip.sub('/^ignore /', '') + file = line.strip.match(/^ignore\s+'([^']+)'/) + ignored_files << file[1] end end end ignored_files.each do |file| $stdout.write('|') + $stdout.write('datadog') $stdout.write('|') $stdout.write(file) $stdout.write('|') From b8a27be6a645bc6d57b4ca41b806aa3f8cf78ce2 Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Wed, 26 Feb 2025 16:13:02 -0500 Subject: [PATCH 3/8] Add comments. --- tasks/steep.rake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index f6ad45d9f4f..440d6e24f19 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -65,7 +65,7 @@ namespace :steep do $stdout.write("\n") end - # append ignored files from Steepfile + # Append ignored files from Steepfile to the end of the steep/typecheck summary steepfile_path = 'Steepfile' ignored_files = [] @@ -80,17 +80,17 @@ namespace :steep do ignored_files.each do |file| $stdout.write('|') - $stdout.write('datadog') + $stdout.write('datadog') # header: Target $stdout.write('|') - $stdout.write(file) + $stdout.write(file) # header: File $stdout.write('|') - $stdout.write('ignored') + $stdout.write('ignored') # header: Status $stdout.write('|') $stdout.write('|') - $stdout.write('0') + $stdout.write('0') # header: Untyped calls $stdout.write('|') $stdout.write('|') - $stdout.write('0') + $stdout.write('0') # header: Typed % $stdout.write('|') $stdout.write("\n") end From 6a036ee41b42257f7164024d060b5cab29ce4dbe Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Wed, 26 Feb 2025 16:31:14 -0500 Subject: [PATCH 4/8] Condense lines. --- tasks/steep.rake | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index 440d6e24f19..6db81e7b48b 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -73,26 +73,13 @@ namespace :steep do File.readlines(steepfile_path).each do |line| if line.strip.start_with?('ignore') file = line.strip.match(/^ignore\s+'([^']+)'/) - ignored_files << file[1] + ignored_files << file[1] if file end end end ignored_files.each do |file| - $stdout.write('|') - $stdout.write('datadog') # header: Target - $stdout.write('|') - $stdout.write(file) # header: File - $stdout.write('|') - $stdout.write('ignored') # header: Status - $stdout.write('|') - $stdout.write('|') - $stdout.write('0') # header: Untyped calls - $stdout.write('|') - $stdout.write('|') - $stdout.write('0') # header: Typed % - $stdout.write('|') - $stdout.write("\n") + $stdout.write("|N/A|#{file}|ignored|N/A|N/A|N/A|N/A|\n") end else sh "steep stats --format=#{format}" From 5f1c4fa8a5c85e5184061fc941b3fbbb1b0cbc6b Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Thu, 27 Feb 2025 12:04:09 -0500 Subject: [PATCH 5/8] Improve file processing. --- tasks/steep.rake | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index 6db81e7b48b..e5ecee2eeec 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -67,20 +67,10 @@ namespace :steep do # Append ignored files from Steepfile to the end of the steep/typecheck summary steepfile_path = 'Steepfile' - ignored_files = [] - - if File.exist?(steepfile_path) - File.readlines(steepfile_path).each do |line| - if line.strip.start_with?('ignore') - file = line.strip.match(/^ignore\s+'([^']+)'/) - ignored_files << file[1] if file - end - end - end - - ignored_files.each do |file| - $stdout.write("|N/A|#{file}|ignored|N/A|N/A|N/A|N/A|\n") - end + File + .foreach(steepfile_path) + .with_object([]) { |line, ignored_files| line =~ /^\s*ignore\s+(["'])(.*?(?:\\?.)*?)\1/ && ignored_files << $2 } + .each { |file| $stdout.write("|N/A|#{file}|ignored|N/A|N/A|N/A|N/A|\n") } else sh "steep stats --format=#{format}" end From 5b926932396a2155b5cdb2ae14b0e8b4826527f3 Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Fri, 28 Feb 2025 08:01:37 -0500 Subject: [PATCH 6/8] Change column values. --- tasks/steep.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index e5ecee2eeec..0dae85f3d6f 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -70,7 +70,7 @@ namespace :steep do File .foreach(steepfile_path) .with_object([]) { |line, ignored_files| line =~ /^\s*ignore\s+(["'])(.*?(?:\\?.)*?)\1/ && ignored_files << $2 } - .each { |file| $stdout.write("|N/A|#{file}|ignored|N/A|N/A|N/A|N/A|\n") } + .each { |file| $stdout.write("|datadog|#{file}|ignored|N/A|N/A|N/A|0|\n") } else sh "steep stats --format=#{format}" end From 65fa00d57b5fe14dc3b2bb1aff857cae5ec0f31f Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Fri, 28 Feb 2025 08:03:17 -0500 Subject: [PATCH 7/8] Remove steepfile_path var. --- tasks/steep.rake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index 0dae85f3d6f..473d91b8890 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -66,9 +66,8 @@ namespace :steep do end # Append ignored files from Steepfile to the end of the steep/typecheck summary - steepfile_path = 'Steepfile' File - .foreach(steepfile_path) + .foreach('Steepfile') .with_object([]) { |line, ignored_files| line =~ /^\s*ignore\s+(["'])(.*?(?:\\?.)*?)\1/ && ignored_files << $2 } .each { |file| $stdout.write("|datadog|#{file}|ignored|N/A|N/A|N/A|0|\n") } else From 0b2918670bfc3584022cae7ae9789bdc4398ffa6 Mon Sep 17 00:00:00 2001 From: Sarah Chen Date: Fri, 28 Feb 2025 11:32:38 -0500 Subject: [PATCH 8/8] Add warning for missing ignored files instead of appending them to the summary. --- tasks/steep.rake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/steep.rake b/tasks/steep.rake index 473d91b8890..eea986d56ac 100644 --- a/tasks/steep.rake +++ b/tasks/steep.rake @@ -69,7 +69,13 @@ namespace :steep do File .foreach('Steepfile') .with_object([]) { |line, ignored_files| line =~ /^\s*ignore\s+(["'])(.*?(?:\\?.)*?)\1/ && ignored_files << $2 } - .each { |file| $stdout.write("|datadog|#{file}|ignored|N/A|N/A|N/A|0|\n") } + .each do |file| + if File.exist?(file) + $stdout.write("|datadog|#{file}|ignored|N/A|N/A|N/A|0|\n") + else + warn "Ignored file '#{file}' does not exist. Please remove it from the Steepfile." + end + end else sh "steep stats --format=#{format}" end