This commit is contained in:
Roberto Alsina 2024-06-28 20:57:58 -03:00
parent 897b2dd59e
commit 1a5e8549f0
2 changed files with 90 additions and 4 deletions

86
.ameba.yml Normal file
View File

@ -0,0 +1,86 @@
# This configuration file was generated by `ameba --gen-config`
# on 2024-06-28 23:57:47 UTC using Ameba version 1.6.1.
# The point is for the user to remove these configuration records
# one by one as the reported problems are removed from the code base.
# Problems found: 2
# Run `ameba --only Layout/TrailingBlankLines` for details
Layout/TrailingBlankLines:
Description: Disallows trailing blank lines
Excluded:
- tmp/d1808c39-8dff-4267-9bec-6961ec16c41f/function.cr
- tmp/26456ab0-43e4-44fb-8b6f-986880ff5a41/function.cr
Enabled: true
Severity: Convention
# Problems found: 2
# Run `ameba --only Lint/Formatting` for details
Lint/Formatting:
Description: Reports not formatted sources
FailOnError: false
Excluded:
- tmp/d1808c39-8dff-4267-9bec-6961ec16c41f/function.cr
- tmp/26456ab0-43e4-44fb-8b6f-986880ff5a41/function.cr
Enabled: true
Severity: Warning
# Problems found: 13
# Run `ameba --only Documentation/DocumentationAdmonition` for details
Documentation/DocumentationAdmonition:
Description: Reports documentation admonitions
Timezone: UTC
Excluded:
- src/faaso.cr
- spec/faaso_spec.cr
Admonitions:
- TODO
- FIXME
- BUG
Enabled: true
Severity: Warning
# Problems found: 1
# Run `ameba --only Lint/DebugCalls` for details
Lint/DebugCalls:
Description: Disallows debug-related calls
Excluded:
- src/faaso.cr
MethodNames:
- p
- p!
- pp
- pp!
Enabled: true
Severity: Warning
# Problems found: 3
# Run `ameba --only Naming/BlockParameterName` for details
Naming/BlockParameterName:
Description: Disallows non-descriptive block parameter names
MinNameLength: 3
AllowNamesEndingInNumbers: true
Excluded:
- src/faaso.cr
AllowedNames:
- _
- e
- i
- j
- k
- v
- x
- y
- ex
- io
- ws
- op
- tx
- id
- ip
- k1
- k2
- v1
- v2
ForbiddenNames: []
Enabled: true
Severity: Convention

View File

@ -64,9 +64,9 @@ module Faaso
containers = docker_api.containers.list(all: true)
pp! containers
# If it's running, do nothing
if (containers.any? { |c|
if containers.any? { |c|
c.@image == tag && c.@state == "running"
})
}
puts "#{arg} is already running"
return 0
end
@ -75,7 +75,7 @@ module Faaso
paused = containers.select { |c|
c.@image == tag && c.@state == "paused"
}
if (paused.size > 0)
if paused.size > 0
puts "Resuming existing paused container"
docker_api.containers.unpause(paused[0].@id)
return 0
@ -87,7 +87,7 @@ module Faaso
}
puts "Starting function #{arg}"
if (existing.size > 0)
if existing.size > 0
puts "Restarting existing exited container"
docker_api.containers.start(existing[0].@id)
return 0