Skip to content

Commit 735e59b

Browse files
committed
Wire up standard for formatting profiling while leaving the rest of the project on rubocop
This allows us to experiment with standard without fully committing to it for the full library yet.
1 parent 2505c2d commit 735e59b

6 files changed

+317
-2
lines changed

.rubocop.yml

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ AllCops:
2424
- 'spec/**/**/interesting_backtrace_helper.rb' # This file needs quite a few bizarre code patterns by design
2525
- 'vendor/bundle/**/*'
2626
- 'spec/datadog/tracing/contrib/grpc/support/gen/**/*.rb' # Skip protoc autogenerated code
27+
# Profiling has migrated to standard and is not managed by rubocop:
28+
- 'lib/datadog/profiling*'
29+
- 'lib/datadog/profiling/**/*'
30+
- 'spec/datadog/profiling*'
31+
- 'spec/datadog/profiling/**/*'
32+
- 'ext/**/*' # Profiling has migrated to standard and is not managed by rubocop
2733
NewCops: disable # Don't allow new cops to be enabled implicitly.
2834
SuggestExtensions: false # Stop pushing suggestions constantly.
2935

.standard.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# For available configuration options, see:
2+
# https://github.com/testdouble/standard
3+
ruby_version: 2.5

.standard_todo.yml

+296
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
# Auto generated files with errors to ignore.
2+
# Remove from this list as you refactor files.
3+
---
4+
ignore:
5+
- lib/datadog/profiling/collectors/code_provenance.rb:
6+
- Style/StringLiterals
7+
- Style/TrailingCommaInArguments
8+
- Layout/SpaceInsideHashLiteralBraces
9+
- lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb:
10+
- Style/StringLiterals
11+
- Style/TrailingCommaInArguments
12+
- Style/SafeNavigation
13+
- Layout/EmptyLinesAroundBlockBody
14+
- Layout/TrailingWhitespace
15+
- Style/RedundantBegin
16+
- Layout/IndentationWidth
17+
- Layout/RescueEnsureAlignment
18+
- lib/datadog/profiling/collectors/idle_sampling_helper.rb:
19+
- Style/SafeNavigation
20+
- Layout/EmptyLinesAroundBlockBody
21+
- Layout/TrailingWhitespace
22+
- Style/RedundantBegin
23+
- Layout/IndentationWidth
24+
- Style/StringLiterals
25+
- Layout/RescueEnsureAlignment
26+
- lib/datadog/profiling/collectors/info.rb:
27+
- Style/StringLiterals
28+
- Style/TrailingCommaInHashLiteral
29+
- lib/datadog/profiling/collectors/thread_context.rb:
30+
- Style/TrailingCommaInArguments
31+
- Style/SafeNavigation
32+
- lib/datadog/profiling/component.rb:
33+
- Layout/SpaceInsideHashLiteralBraces
34+
- Style/StringLiterals
35+
- Style/TrailingCommaInArguments
36+
- Style/TrailingCommaInHashLiteral
37+
- Layout/LineContinuationSpacing
38+
- Style/StringLiteralsInInterpolation
39+
- lib/datadog/profiling/crashtracker.rb:
40+
- Style/StringLiterals
41+
- Layout/EmptyLinesAroundMethodBody
42+
- Layout/TrailingWhitespace
43+
- Style/RedundantBegin
44+
- Layout/IndentationWidth
45+
- Layout/RescueEnsureAlignment
46+
- Style/TrailingCommaInArguments
47+
- lib/datadog/profiling/exporter.rb:
48+
- Style/StringLiterals
49+
- Style/TrailingCommaInHashLiteral
50+
- Style/TrailingCommaInArguments
51+
- lib/datadog/profiling/ext.rb:
52+
- Style/StringLiterals
53+
- lib/datadog/profiling/ext/dir_monkey_patches.rb:
54+
- Style/StringLiterals
55+
- lib/datadog/profiling/ext/forking.rb:
56+
- Style/TrailingCommaInArrayLiteral
57+
- Layout/IndentationWidth
58+
- Layout/EndAlignment
59+
- Style/StringLiterals
60+
- lib/datadog/profiling/flush.rb:
61+
- Style/StringLiterals
62+
- lib/datadog/profiling/http_transport.rb:
63+
- Style/StringLiterals
64+
- Style/StringLiteralsInInterpolation
65+
- Layout/ArrayAlignment
66+
- Style/TrailingCommaInArguments
67+
- lib/datadog/profiling/load_native_extension.rb:
68+
- Style/StringLiterals
69+
- Style/StringLiteralsInInterpolation
70+
- lib/datadog/profiling/preload.rb:
71+
- Style/StringLiterals
72+
- lib/datadog/profiling/profiler.rb:
73+
- Style/SafeNavigation
74+
- Style/StringLiterals
75+
- lib/datadog/profiling/scheduler.rb:
76+
- Style/StringLiterals
77+
- Layout/EmptyLinesAroundMethodBody
78+
- Layout/TrailingWhitespace
79+
- Style/RedundantBegin
80+
- Layout/CommentIndentation
81+
- Layout/IndentationWidth
82+
- Layout/RescueEnsureAlignment
83+
- Style/RescueStandardError
84+
- lib/datadog/profiling/stack_recorder.rb:
85+
- Style/TrailingCommaInArguments
86+
- lib/datadog/profiling/tag_builder.rb:
87+
- Style/StringLiterals
88+
- Style/TrailingCommaInHashLiteral
89+
- lib/datadog/profiling/tasks/exec.rb:
90+
- Style/StringLiterals
91+
- Style/StringLiteralsInInterpolation
92+
- lib/datadog/profiling/tasks/setup.rb:
93+
- Style/StringLiterals
94+
- Layout/EmptyLinesAroundBlockBody
95+
- Layout/TrailingWhitespace
96+
- Style/RedundantBegin
97+
- Layout/IndentationWidth
98+
- Layout/RescueEnsureAlignment
99+
- Layout/CommentIndentation
100+
- Style/RescueStandardError
101+
- lib/datadog/profiling.rb:
102+
- Style/StringLiterals
103+
- Style/SafeNavigation
104+
- Style/RescueStandardError
105+
- Layout/EmptyLinesAroundMethodBody
106+
- Layout/TrailingWhitespace
107+
- Style/RedundantBegin
108+
- Layout/IndentationWidth
109+
- Layout/RescueEnsureAlignment
110+
- spec/datadog/profiling/collectors/code_provenance_spec.rb:
111+
- Style/StringLiterals
112+
- Style/TrailingCommaInArguments
113+
- spec/datadog/profiling/collectors/cpu_and_wall_time_worker_spec.rb:
114+
- Style/StringLiterals
115+
- Layout/SpaceInsideHashLiteralBraces
116+
- Style/TrailingCommaInArguments
117+
- Style/QuotedSymbols
118+
- Style/HashSyntax
119+
- Performance/UnfreezeString
120+
- Style/RedundantParentheses
121+
- Style/TrailingCommaInHashLiteral
122+
- Layout/CommentIndentation
123+
- Layout/TrailingWhitespace
124+
- Style/RedundantBegin
125+
- Layout/IndentationWidth
126+
- Layout/RescueEnsureAlignment
127+
- Layout/EmptyLinesAroundBlockBody
128+
- spec/datadog/profiling/collectors/discrete_dynamic_sampler_spec.rb:
129+
- Style/StringLiterals
130+
- Style/TrailingCommaInHashLiteral
131+
- spec/datadog/profiling/collectors/dynamic_sampling_rate_spec.rb:
132+
- Style/StringLiterals
133+
- spec/datadog/profiling/collectors/idle_sampling_helper_spec.rb:
134+
- Style/StringLiterals
135+
- spec/datadog/profiling/collectors/info_spec.rb:
136+
- Style/StringLiterals
137+
- Style/TrailingCommaInArguments
138+
- Style/TrailingCommaInHashLiteral
139+
- Layout/SpaceInsideHashLiteralBraces
140+
- Layout/ArrayAlignment
141+
- spec/datadog/profiling/collectors/interesting_backtrace_helper.rb:
142+
- Style/GlobalVars
143+
- Style/MissingRespondToMissing
144+
- Lint/UselessTimes
145+
- Style/EvalWithLocation
146+
- spec/datadog/profiling/collectors/stack_spec.rb:
147+
- Style/StringLiterals
148+
- Layout/SpaceInsideHashLiteralBraces
149+
- Style/TrailingCommaInArrayLiteral
150+
- Style/TernaryParentheses
151+
- Style/TrailingCommaInArguments
152+
- spec/datadog/profiling/collectors/thread_context_spec.rb:
153+
- Style/StringLiterals
154+
- Style/TrailingCommaInArguments
155+
- Style/QuotedSymbols
156+
- Style/HashSyntax
157+
- Layout/EmptyLinesAroundMethodBody
158+
- Layout/TrailingWhitespace
159+
- Style/RedundantBegin
160+
- Layout/IndentationWidth
161+
- Layout/RescueEnsureAlignment
162+
- Layout/ExtraSpacing
163+
- Layout/SpaceInsideHashLiteralBraces
164+
- Style/TrailingCommaInArrayLiteral
165+
- spec/datadog/profiling/component_spec.rb:
166+
- Style/StringLiterals
167+
- Layout/SpaceInsideHashLiteralBraces
168+
- Style/TrailingCommaInArguments
169+
- Style/TrailingCommaInHashLiteral
170+
- spec/datadog/profiling/crashtracker_spec.rb:
171+
- Style/StringLiterals
172+
- Layout/SpaceInsideHashLiteralBraces
173+
- Style/TrailingCommaInHashLiteral
174+
- Style/TrailingCommaInArguments
175+
- Style/QuotedSymbols
176+
- spec/datadog/profiling/exporter_spec.rb:
177+
- Style/StringLiterals
178+
- Layout/SpaceInsideHashLiteralBraces
179+
- Style/TrailingCommaInHashLiteral
180+
- Style/TrailingCommaInArguments
181+
- spec/datadog/profiling/ext/dir_monkey_patches_spec.rb:
182+
- Style/StringLiterals
183+
- Style/FileWrite
184+
- Layout/EmptyLinesAroundBlockBody
185+
- Layout/TrailingWhitespace
186+
- Style/RedundantBegin
187+
- Layout/IndentationWidth
188+
- Layout/RescueEnsureAlignment
189+
- Layout/CommentIndentation
190+
- spec/datadog/profiling/ext/forking_spec.rb:
191+
- Style/StringLiterals
192+
- Performance/StringIdentifierArgument
193+
- Style/SafeNavigation
194+
- Layout/TrailingWhitespace
195+
- Layout/MultilineBlockLayout
196+
- Style/EmptyMethod
197+
- Style/SingleLineMethods
198+
- Layout/IndentationWidth
199+
- Layout/BlockEndNewline
200+
- Layout/DefEndAlignment
201+
- Layout/BlockAlignment
202+
- spec/datadog/profiling/flush_spec.rb:
203+
- Style/StringLiterals
204+
- Layout/SpaceInsideHashLiteralBraces
205+
- Style/TrailingCommaInHashLiteral
206+
- Style/TrailingCommaInArguments
207+
- spec/datadog/profiling/http_transport_spec.rb:
208+
- Style/StringLiterals
209+
- Style/TrailingCommaInArguments
210+
- Layout/SpaceInsideHashLiteralBraces
211+
- Layout/ExtraSpacing
212+
- Style/TrailingCommaInHashLiteral
213+
- Layout/EmptyLinesAroundBlockBody
214+
- Layout/TrailingWhitespace
215+
- Style/RedundantBegin
216+
- Layout/IndentationWidth
217+
- Layout/RescueEnsureAlignment
218+
- Layout/CommentIndentation
219+
- spec/datadog/profiling/load_native_extension_spec.rb:
220+
- Style/StringLiterals
221+
- spec/datadog/profiling/native_extension_helpers_spec.rb:
222+
- Style/StringLiterals
223+
- Style/StringLiteralsInInterpolation
224+
- Style/SafeNavigation
225+
- spec/datadog/profiling/native_extension_spec.rb:
226+
- Style/StringLiterals
227+
- Style/HashSyntax
228+
- spec/datadog/profiling/pprof/pprof_pb.rb:
229+
- Style/StringLiterals
230+
- spec/datadog/profiling/preload_spec.rb:
231+
- Style/StringLiterals
232+
- spec/datadog/profiling/profiler_spec.rb:
233+
- Style/StringLiterals
234+
- spec/datadog/profiling/scheduler_spec.rb:
235+
- Style/StringLiterals
236+
- Style/TrailingCommaInArguments
237+
- Layout/ExtraSpacing
238+
- Layout/SpaceInsideHashLiteralBraces
239+
- spec/datadog/profiling/spec_helper.rb:
240+
- Style/StringLiterals
241+
- Style/TernaryParentheses
242+
- Style/TrailingCommaInArguments
243+
- Style/QuotedSymbols
244+
- spec/datadog/profiling/stack_recorder_spec.rb:
245+
- Style/StringLiterals
246+
- Style/TrailingCommaInArguments
247+
- Style/TrailingCommaInHashLiteral
248+
- Style/HashSyntax
249+
- Layout/SpaceInsideHashLiteralBraces
250+
- Style/QuotedSymbols
251+
- Layout/ArrayAlignment
252+
- Layout/EmptyLinesAroundBlockBody
253+
- Layout/TrailingWhitespace
254+
- Style/RedundantBegin
255+
- Layout/IndentationWidth
256+
- Layout/RescueEnsureAlignment
257+
- Style/TrailingCommaInArrayLiteral
258+
- spec/datadog/profiling/tag_builder_spec.rb:
259+
- Style/StringLiterals
260+
- Style/TrailingCommaInArguments
261+
- Layout/SpaceInsideHashLiteralBraces
262+
- spec/datadog/profiling/tasks/exec_spec.rb:
263+
- Style/StringLiterals
264+
- spec/datadog/profiling/tasks/help_spec.rb:
265+
- Style/StringLiterals
266+
- spec/datadog/profiling/tasks/setup_spec.rb:
267+
- Style/StringLiterals
268+
- spec/datadog/profiling/validate_benchmarks_spec.rb:
269+
- Style/StringLiterals
270+
- Style/TrailingCommaInArrayLiteral
271+
- spec/datadog/profiling_spec.rb:
272+
- Style/StringLiterals
273+
- Layout/EmptyLinesAroundBlockBody
274+
- Layout/TrailingWhitespace
275+
- Style/RedundantBegin
276+
- Layout/IndentationWidth
277+
- Layout/RescueEnsureAlignment
278+
- ext/datadog_profiling_loader/extconf.rb:
279+
- Style/StringLiterals
280+
- ext/datadog_profiling_native_extension/extconf.rb:
281+
- Style/StringLiterals
282+
- Style/RescueModifier
283+
- Style/TrailingCommaInArguments
284+
- Style/StringLiteralsInInterpolation
285+
- Style/TrailingCommaInArrayLiteral
286+
- ext/datadog_profiling_native_extension/native_extension_helpers.rb:
287+
- Style/StringLiterals
288+
- Style/TrailingCommaInArrayLiteral
289+
- Layout/SpaceInsideHashLiteralBraces
290+
- Style/TrailingCommaInArguments
291+
- Layout/EmptyLinesAroundMethodBody
292+
- Layout/TrailingWhitespace
293+
- Style/RedundantBegin
294+
- Layout/IndentationWidth
295+
- Layout/RescueEnsureAlignment
296+
- Style/StringLiteralsInInterpolation

Appraisals

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ REMOVED_GEMS = {
1616
:check => [
1717
'rbs',
1818
'steep',
19+
'standard',
1920
],
2021
:dev => [
2122
'ruby-lsp',

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ group :check do
8282
gem 'rbs', '~> 3.2.0', require: false
8383
gem 'steep', '~> 1.6.0', require: false
8484
end
85+
gem 'standard'
8586
end
8687

8788
group :dev do

Rakefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,16 @@ namespace :native_dev do
415415
CLEAN.concat(NATIVE_CLEAN)
416416
end
417417

418+
task :standard_profiling do
419+
sh 'standardrb lib/datadog/profiling* spec/datadog/profiling* ext/' if Gem.loaded_specs.key? 'standard'
420+
end
421+
422+
task :standard_profiling_autofix do
423+
sh 'standardrb --fix lib/datadog/profiling* spec/datadog/profiling* ext/' if Gem.loaded_specs.key? 'standard'
424+
end
425+
418426
desc 'Runs rubocop + main test suite'
419-
task default: ['rubocop', 'typecheck', 'spec:main']
427+
task default: ['rubocop', 'standard_profiling', 'typecheck', 'spec:main']
420428

421429
desc 'Runs the default task in parallel'
422-
multitask fastdefault: ['rubocop', 'typecheck', 'spec:main']
430+
multitask fastdefault: ['rubocop', 'standard_profiling', 'typecheck', 'spec:main']

0 commit comments

Comments
 (0)