rubosquad 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rubosquad.rb +15 -15
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea0148cd8d05e66b5990557a84a80ff89fa053929e4bbec510aafbc12007e9ff
|
|
4
|
+
data.tar.gz: fd638cb0a18a6a1b0dc77495b38c9b55dadee1045fbba4f79a6ea74b4c59bb62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7878218fff87254f16cd8e6c54613301ca65c5ccf39cffd0b420cb0bb6eb7411a3bdf0991436acb634b353e3f2aa86726f9e1176ffc537b97b02e946b5dc7b2
|
|
7
|
+
data.tar.gz: d89bd634df027b5ce0cc35d9e91e3349d5ef936d15cb9883eb500ba8fda11faeee33f0de7c7e4504bb8f0d7bd21ad37de58078ce94c5b4a76fcfbb48033ad6a0
|
data/lib/rubosquad.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Rubosquad
|
|
|
20
20
|
base_branch = detect_base_branch
|
|
21
21
|
|
|
22
22
|
unless base_branch
|
|
23
|
-
|
|
23
|
+
puts 'Error: Could not find main or master branch.'
|
|
24
24
|
exit 1
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ module Rubosquad
|
|
|
28
28
|
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
|
29
29
|
|
|
30
30
|
if current_branch == base_branch
|
|
31
|
-
|
|
31
|
+
puts "Warning: You are on the #{base_branch} branch. Comparing working directory changes."
|
|
32
32
|
# Compare working directory + staged changes against HEAD
|
|
33
33
|
changed_files = `git diff --name-only HEAD`.split("\n")
|
|
34
34
|
changed_files += `git diff --name-only --cached`.split("\n")
|
|
@@ -42,7 +42,7 @@ module Rubosquad
|
|
|
42
42
|
changed_files = changed_files.select { |file| File.exist?(file) }
|
|
43
43
|
|
|
44
44
|
if changed_files.empty?
|
|
45
|
-
|
|
45
|
+
puts 'No Ruby files have changed.'
|
|
46
46
|
exit 0
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -52,9 +52,9 @@ module Rubosquad
|
|
|
52
52
|
"#{current_branch} vs #{base_branch}"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
puts "\nRunning Rubocop on changed files (#{comparison_info}):"
|
|
56
56
|
changed_files.each { |file| puts " - #{file}" }
|
|
57
|
-
|
|
57
|
+
puts
|
|
58
58
|
|
|
59
59
|
# Check for available RuboCop extensions that can actually be loaded
|
|
60
60
|
extensions = %w[rubocop-factory_bot rubocop-rails rubocop-rspec rubocop-rspec_rails]
|
|
@@ -74,8 +74,8 @@ module Rubosquad
|
|
|
74
74
|
|
|
75
75
|
stdout, stderr, status = Open3.capture3(command)
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
puts "\nRubocop Output:"
|
|
78
|
+
puts '==Error type: Legend: C = Convention, W = Warning, E = Error, F = Fatal=='
|
|
79
79
|
|
|
80
80
|
# Process and colorize output
|
|
81
81
|
processed_output = ''
|
|
@@ -102,26 +102,26 @@ module Rubosquad
|
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
puts processed_output
|
|
106
106
|
|
|
107
107
|
if status.success?
|
|
108
|
-
|
|
108
|
+
puts "\nRubocop auto-corrections complete."
|
|
109
109
|
else
|
|
110
|
-
|
|
110
|
+
puts "\nRubocop completed with offenses:"
|
|
111
111
|
|
|
112
112
|
offenses = stdout.scan(/(\d+) offense.* detected/)
|
|
113
113
|
total_offenses = offenses.flatten.map(&:to_i).sum
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
puts "Files inspected: #{stdout[/(\d+) files? inspected/, 1] || 'Unknown'}"
|
|
116
|
+
puts "Total offenses detected: #{total_offenses}"
|
|
117
117
|
|
|
118
118
|
unless stderr.strip.empty?
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
puts "\nStandard error:"
|
|
120
|
+
puts stderr
|
|
121
121
|
end
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
puts "\nRuboCop extensions used: #{available_extensions.join(', ')}"
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
# Detect the base branch to compare against
|