Skip to content

Commit f3bcace

Browse files
committed
Modernise codebase and dependencies
* Aruba is not used in the test suite, so remove that and its heap of dependencies. This results in a much smaller image. * Use modern YAML 1.2 syntax for Docker Compose specification. * Use our standard development/production Dockerfile split and install necessary packages to build C extensions. Modern RuboCop requires prism which is a native C extension, so we can't skip this any more. * Two minor syntax changes to appease the new version of RuboCop. * Update Gem dependencies for security issues.
1 parent 101d5d3 commit f3bcace

6 files changed

Lines changed: 389 additions & 79 deletions

File tree

.rubocop.yml

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,320 @@ Style/Lambda:
9090
# Unclear why it's a good idea to give parameters semantically meaningless names
9191
Style/SingleLineBlockParams:
9292
Enabled: false
93+
94+
Gemspec/AddRuntimeDependency: # new in 1.65
95+
Enabled: true
96+
Gemspec/AttributeAssignment: # new in 1.77
97+
Enabled: true
98+
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
99+
Enabled: true
100+
Gemspec/DevelopmentDependencies: # new in 1.44
101+
Enabled: true
102+
Gemspec/RequireMFA: # new in 1.23
103+
Enabled: true
104+
Layout/EmptyLinesAfterModuleInclusion: # new in 1.79
105+
Enabled: true
106+
Layout/LineContinuationLeadingSpace: # new in 1.31
107+
Enabled: true
108+
Layout/LineContinuationSpacing: # new in 1.31
109+
Enabled: true
110+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
111+
Enabled: true
112+
Layout/SpaceBeforeBrackets: # new in 1.7
113+
Enabled: true
114+
Lint/AmbiguousAssignment: # new in 1.7
115+
Enabled: true
116+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
117+
Enabled: true
118+
Lint/AmbiguousRange: # new in 1.19
119+
Enabled: true
120+
Lint/ArrayLiteralInRegexp: # new in 1.71
121+
Enabled: true
122+
Lint/ConstantOverwrittenInRescue: # new in 1.31
123+
Enabled: true
124+
Lint/ConstantReassignment: # new in 1.70
125+
Enabled: true
126+
Lint/CopDirectiveSyntax: # new in 1.72
127+
Enabled: true
128+
Lint/DataDefineOverride: # new in 1.85
129+
Enabled: true
130+
Lint/DeprecatedConstants: # new in 1.8
131+
Enabled: true
132+
Lint/DuplicateBranch: # new in 1.3
133+
Enabled: true
134+
Lint/DuplicateMagicComment: # new in 1.37
135+
Enabled: true
136+
Lint/DuplicateMatchPattern: # new in 1.50
137+
Enabled: true
138+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
139+
Enabled: true
140+
Lint/DuplicateSetElement: # new in 1.67
141+
Enabled: true
142+
Lint/EmptyBlock: # new in 1.1
143+
Enabled: true
144+
Lint/EmptyClass: # new in 1.3
145+
Enabled: true
146+
Lint/EmptyInPattern: # new in 1.16
147+
Enabled: true
148+
Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
149+
Enabled: true
150+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
151+
Enabled: true
152+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
153+
Enabled: true
154+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
155+
Enabled: true
156+
Lint/LiteralAssignmentInCondition: # new in 1.58
157+
Enabled: true
158+
Lint/MixedCaseRange: # new in 1.53
159+
Enabled: true
160+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
161+
Enabled: true
162+
Lint/NonAtomicFileOperation: # new in 1.31
163+
Enabled: true
164+
Lint/NumberedParameterAssignment: # new in 1.9
165+
Enabled: true
166+
Lint/NumericOperationWithConstantResult: # new in 1.69
167+
Enabled: true
168+
Lint/OrAssignmentToConstant: # new in 1.9
169+
Enabled: true
170+
Lint/RedundantDirGlobSort: # new in 1.8
171+
Enabled: true
172+
Lint/RedundantRegexpQuantifiers: # new in 1.53
173+
Enabled: true
174+
Lint/RedundantTypeConversion: # new in 1.72
175+
Enabled: true
176+
Lint/RefinementImportMethods: # new in 1.27
177+
Enabled: true
178+
Lint/RequireRangeParentheses: # new in 1.32
179+
Enabled: true
180+
Lint/RequireRelativeSelfPath: # new in 1.22
181+
Enabled: true
182+
Lint/SharedMutableDefault: # new in 1.70
183+
Enabled: true
184+
Lint/SuppressedExceptionInNumberConversion: # new in 1.72
185+
Enabled: true
186+
Lint/SymbolConversion: # new in 1.9
187+
Enabled: true
188+
Lint/ToEnumArguments: # new in 1.1
189+
Enabled: true
190+
Lint/TripleQuotes: # new in 1.9
191+
Enabled: true
192+
Lint/UnescapedBracketInRegexp: # new in 1.68
193+
Enabled: true
194+
Lint/UnexpectedBlockArity: # new in 1.5
195+
Enabled: true
196+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
197+
Enabled: true
198+
Lint/UnreachablePatternBranch: # new in 1.85
199+
Enabled: true
200+
Lint/UselessConstantScoping: # new in 1.72
201+
Enabled: true
202+
Lint/UselessDefaultValueArgument: # new in 1.76
203+
Enabled: true
204+
Lint/UselessDefined: # new in 1.69
205+
Enabled: true
206+
Lint/UselessNumericOperation: # new in 1.66
207+
Enabled: true
208+
Lint/UselessOr: # new in 1.76
209+
Enabled: true
210+
Lint/UselessRescue: # new in 1.43
211+
Enabled: true
212+
Lint/UselessRuby2Keywords: # new in 1.23
213+
Enabled: true
214+
Metrics/CollectionLiteralLength: # new in 1.47
215+
Enabled: true
216+
Naming/BlockForwarding: # new in 1.24
217+
Enabled: true
218+
Naming/PredicateMethod: # new in 1.76
219+
Enabled: true
220+
Security/CompoundHash: # new in 1.28
221+
Enabled: true
222+
Security/IoMethods: # new in 1.22
223+
Enabled: true
224+
Style/AmbiguousEndlessMethodDefinition: # new in 1.68
225+
Enabled: true
226+
Style/ArgumentsForwarding: # new in 1.1
227+
Enabled: true
228+
Style/ArrayIntersect: # new in 1.40
229+
Enabled: true
230+
Style/ArrayIntersectWithSingleElement: # new in 1.81
231+
Enabled: true
232+
Style/BitwisePredicate: # new in 1.68
233+
Enabled: true
234+
Style/CollectionCompact: # new in 1.2
235+
Enabled: true
236+
Style/CollectionQuerying: # new in 1.77
237+
Enabled: true
238+
Style/CombinableDefined: # new in 1.68
239+
Enabled: true
240+
Style/ComparableBetween: # new in 1.74
241+
Enabled: true
242+
Style/ComparableClamp: # new in 1.44
243+
Enabled: true
244+
Style/ConcatArrayLiterals: # new in 1.41
245+
Enabled: true
246+
Style/DataInheritance: # new in 1.49
247+
Enabled: true
248+
Style/DigChain: # new in 1.69
249+
Enabled: true
250+
Style/DirEmpty: # new in 1.48
251+
Enabled: true
252+
Style/DocumentDynamicEvalDefinition: # new in 1.1
253+
Enabled: true
254+
Style/EmptyClassDefinition: # new in 1.84
255+
Enabled: true
256+
Style/EmptyHeredoc: # new in 1.32
257+
Enabled: true
258+
Style/EmptyStringInsideInterpolation: # new in 1.76
259+
Enabled: true
260+
Style/EndlessMethod: # new in 1.8
261+
Enabled: true
262+
Style/EnvHome: # new in 1.29
263+
Enabled: true
264+
Style/ExactRegexpMatch: # new in 1.51
265+
Enabled: true
266+
Style/FetchEnvVar: # new in 1.28
267+
Enabled: true
268+
Style/FileEmpty: # new in 1.48
269+
Enabled: true
270+
Style/FileNull: # new in 1.69
271+
Enabled: true
272+
Style/FileOpen: # new in 1.85
273+
Enabled: true
274+
Style/FileRead: # new in 1.24
275+
Enabled: true
276+
Style/FileTouch: # new in 1.69
277+
Enabled: true
278+
Style/FileWrite: # new in 1.24
279+
Enabled: true
280+
Style/HashConversion: # new in 1.10
281+
Enabled: true
282+
Style/HashExcept: # new in 1.7
283+
Enabled: true
284+
Style/HashFetchChain: # new in 1.75
285+
Enabled: true
286+
Style/HashSlice: # new in 1.71
287+
Enabled: true
288+
Style/IfWithBooleanLiteralBranches: # new in 1.9
289+
Enabled: true
290+
Style/InPatternThen: # new in 1.16
291+
Enabled: true
292+
Style/ItAssignment: # new in 1.70
293+
Enabled: true
294+
Style/ItBlockParameter: # new in 1.75
295+
Enabled: true
296+
Style/KeywordArgumentsMerging: # new in 1.68
297+
Enabled: true
298+
Style/MagicCommentFormat: # new in 1.35
299+
Enabled: true
300+
Style/MapCompactWithConditionalBlock: # new in 1.30
301+
Enabled: true
302+
Style/MapIntoArray: # new in 1.63
303+
Enabled: true
304+
Style/MapJoin: # new in 1.85
305+
Enabled: true
306+
Style/MapToHash: # new in 1.24
307+
Enabled: true
308+
Style/MapToSet: # new in 1.42
309+
Enabled: true
310+
Style/MinMaxComparison: # new in 1.42
311+
Enabled: true
312+
Style/ModuleMemberExistenceCheck: # new in 1.82
313+
Enabled: true
314+
Style/MultilineInPatternThen: # new in 1.16
315+
Enabled: true
316+
Style/NegatedIfElseCondition: # new in 1.2
317+
Enabled: true
318+
Style/NegativeArrayIndex: # new in 1.84
319+
Enabled: true
320+
Style/NestedFileDirname: # new in 1.26
321+
Enabled: true
322+
Style/NilLambda: # new in 1.3
323+
Enabled: true
324+
Style/NumberedParameters: # new in 1.22
325+
Enabled: true
326+
Style/NumberedParametersLimit: # new in 1.22
327+
Enabled: true
328+
Style/ObjectThen: # new in 1.28
329+
Enabled: true
330+
Style/OneClassPerFile: # new in 1.85
331+
Enabled: true
332+
Style/OpenStructUse: # new in 1.23
333+
Enabled: true
334+
Style/OperatorMethodCall: # new in 1.37
335+
Enabled: true
336+
Style/PartitionInsteadOfDoubleSelect: # new in 1.85
337+
Enabled: true
338+
Style/PredicateWithKind: # new in 1.85
339+
Enabled: true
340+
Style/QuotedSymbols: # new in 1.16
341+
Enabled: true
342+
Style/ReduceToHash: # new in 1.85
343+
Enabled: true
344+
Style/RedundantArgument: # new in 1.4
345+
Enabled: true
346+
Style/RedundantArrayConstructor: # new in 1.52
347+
Enabled: true
348+
Style/RedundantArrayFlatten: # new in 1.76
349+
Enabled: true
350+
Style/RedundantConstantBase: # new in 1.40
351+
Enabled: true
352+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
353+
Enabled: true
354+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
355+
Enabled: true
356+
Style/RedundantEach: # new in 1.38
357+
Enabled: true
358+
Style/RedundantFilterChain: # new in 1.52
359+
Enabled: true
360+
Style/RedundantFormat: # new in 1.72
361+
Enabled: true
362+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
363+
Enabled: true
364+
Style/RedundantInitialize: # new in 1.27
365+
Enabled: true
366+
Style/RedundantInterpolationUnfreeze: # new in 1.66
367+
Enabled: true
368+
Style/RedundantLineContinuation: # new in 1.49
369+
Enabled: true
370+
Style/RedundantMinMaxBy: # new in 1.85
371+
Enabled: true
372+
Style/RedundantRegexpArgument: # new in 1.53
373+
Enabled: true
374+
Style/RedundantRegexpConstructor: # new in 1.52
375+
Enabled: true
376+
Style/RedundantSelfAssignmentBranch: # new in 1.19
377+
Enabled: true
378+
Style/RedundantStringEscape: # new in 1.37
379+
Enabled: true
380+
Style/RedundantStructKeywordInit: # new in 1.85
381+
Enabled: true
382+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
383+
Enabled: true
384+
Style/ReverseFind: # new in 1.84
385+
Enabled: true
386+
Style/SafeNavigationChainLength: # new in 1.68
387+
Enabled: true
388+
Style/SelectByKind: # new in 1.85
389+
Enabled: true
390+
Style/SelectByRange: # new in 1.85
391+
Enabled: true
392+
Style/SelectByRegexp: # new in 1.22
393+
Enabled: true
394+
Style/SendWithLiteralMethodName: # new in 1.64
395+
Enabled: true
396+
Style/SingleLineDoEndBlock: # new in 1.57
397+
Enabled: true
398+
Style/StringChars: # new in 1.12
399+
Enabled: true
400+
Style/SuperArguments: # new in 1.64
401+
Enabled: true
402+
Style/SuperWithArgsParentheses: # new in 1.58
403+
Enabled: true
404+
Style/SwapValues: # new in 1.1
405+
Enabled: true
406+
Style/TallyMethod: # new in 1.85
407+
Enabled: true
408+
Style/YAMLFileRead: # new in 1.53
409+
Enabled: true

Dockerfile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#FROM debian:bullseye-slim
2-
FROM ruby:3.0
2+
FROM ruby:3.3-slim AS base
33
USER root
44

55
RUN apt-get update
@@ -10,13 +10,34 @@ RUN groupadd -g 40054 alma && \
1010
mkdir -p /opt/app && \
1111
chown -R alma:alma /opt/app
1212

13-
# Run everything else as the alma user
1413
WORKDIR /opt/app
1514

16-
COPY --chown=alma Gemfile* ./
17-
RUN bundle install --system
18-
COPY --chown=alma . .
15+
FROM base AS development
1916

17+
USER root
18+
19+
# Install system packages needed to build gems with C extensions.
20+
RUN apt-get install -y --no-install-recommends \
21+
g++ \
22+
git \
23+
make
24+
25+
USER alma
26+
27+
RUN gem install bundler --version 4.0.9
28+
COPY --chown=alma:alma Gemfile* ./
29+
RUN bundle install
30+
COPY --chown=alma:alma . .
31+
32+
FROM base AS production
33+
34+
# Copy the built codebase from the dev stage
35+
COPY --from=development --chown=alma /opt/app /opt/app
36+
COPY --from=development --chown=alma /usr/local/bundle /usr/local/bundle
37+
38+
# Ensure the bundle is installed and the Gemfile.lock is synced.
39+
RUN bundle config set frozen 'true'
40+
RUN bundle install --local
2041
USER alma
2142
ENTRYPOINT ["/opt/app/bin/gobi"]
2243
#CMD ["help"]

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
source 'https://rubygems.org'
22

3-
gem 'aruba'
43
gem 'date'
54
gem 'getoptlong'
65
gem 'mail'
@@ -9,6 +8,6 @@ gem 'nokogiri'
98
gem 'rake'
109
gem 'rspec'
1110
gem 'rspec_junit_formatter'
12-
gem 'rubocop', '~> 1.26.0', require: false
11+
gem 'rubocop', '~> 1.85.0', require: false
1312
gem 'rubocop-checkstyle_formatter', require: false
1413
gem 'thor', '~> 1.1'

0 commit comments

Comments
 (0)