Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2025-10-23 14:07:22 UTC using RuboCop version 1.81.6.
# on 2026-02-25 14:23:54 UTC using RuboCop version 1.84.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 57
# Offense count: 60
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 73
Expand All @@ -22,7 +22,7 @@ Metrics/BlockLength:
Metrics/CyclomaticComplexity:
Max: 20

# Offense count: 71
# Offense count: 79
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 47
Expand All @@ -32,7 +32,7 @@ Metrics/MethodLength:
Metrics/ParameterLists:
Max: 7

# Offense count: 14
# Offense count: 15
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 23
Expand Down Expand Up @@ -71,7 +71,7 @@ Rails/ActionControllerTestCase:
- 'test/controllers/rooms_controller_test.rb'
- 'test/controllers/sites_controller_test.rb'

# Offense count: 16
# Offense count: 22
# Configuration parameters: Database.
# SupportedDatabases: mysql, postgresql
Rails/BulkChangeTable:
Expand All @@ -92,7 +92,7 @@ Rails/BulkChangeTable:
- 'db/migrate/20220523095022_add_address_to_sites.rb'
- 'db/migrate/20230418160353_add_missing_not_nullable_to_existing_tables.rb'

# Offense count: 20
# Offense count: 15
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers.
# Whitelist: find_by_sql, find_by_token_for
Expand All @@ -102,22 +102,16 @@ Rails/DynamicFindBy:
Exclude:
- 'app/controllers/connections_controller.rb'
- 'app/controllers/ports_controller.rb'
- 'app/controllers/rooms_controller.rb'
- 'app/controllers/servers_controller.rb'
- 'app/models/frame.rb'
- 'app/services/import_equipment_by_csv.rb'
- 'db/migrate/20180110152701_add_attributes_to_servers.rb'
- 'lib/tasks/update_pdu_lines.rake'

# Offense count: 6
# Offense count: 2
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/bay_type.rb'
- 'app/models/card.rb'
- 'app/models/composant.rb'
- 'app/models/port.rb'
- 'app/models/port_type.rb'
- 'app/models/server.rb'

# Offense count: 4
# Configuration parameters: IgnoreScopes.
Expand Down Expand Up @@ -186,13 +180,12 @@ Style/IfInsideElse:
- 'app/models/card.rb'
- 'app/models/pdu.rb'

# Offense count: 19
# Offense count: 16
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'app/controllers/connections_controller.rb'
- 'app/controllers/modeles_controller.rb'
- 'app/controllers/moves_controller.rb'
- 'app/helpers/servers_helper.rb'
- 'app/models/port.rb'
- 'app/models/server.rb'
Expand Down Expand Up @@ -225,9 +218,9 @@ Style/Next:
- 'lib/tasks/update_pdu_lines.rake'
- 'lib/tasks/update_position_by_name.rake'

# Offense count: 182
# Offense count: 183
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 207
Max: 192
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ GEM
orm_adapter (0.5.0)
pagy (9.3.3)
parallel (1.27.0)
parser (3.3.10.1)
parser (3.3.10.2)
ast (~> 2.4.1)
racc
passenger (6.1.1)
Expand All @@ -405,7 +405,7 @@ GEM
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.8.0)
prism (1.9.0)
psych (5.3.1)
date
stringio
Expand Down Expand Up @@ -521,15 +521,15 @@ GEM
rspec-support (~> 3.13)
rspec-support (3.13.6)
rubanok (0.5.1)
rubocop (1.82.1)
rubocop (1.84.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.48.0, < 2.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
Expand Down Expand Up @@ -872,15 +872,15 @@ CHECKSUMS
orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9
pagy (9.3.3) sha256=4831418eb4ec7cc5658ea57de559cc3a960286db36f98d4c1c65e19db0e2bb60
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
parser (3.3.10.2) sha256=6f60c84aa4bdcedb6d1a2434b738fe8a8136807b6adc8f7f53b97da9bc4e9357
passenger (6.1.1) sha256=620c3c2cebc3dc9904fd7a9b2a8a84dc7b3bb73f0b4ac1066ea0963ba884c486
pg (1.6.3-arm64-darwin) sha256=7240330b572e6355d7c75a7de535edb5dfcbd6295d9c7777df4d9dddfb8c0e5f
pg (1.6.3-x86_64-darwin) sha256=ee2e04a17c0627225054ffeb43e31a95be9d7e93abda2737ea3ce4a62f2729d6
pg (1.6.3-x86_64-linux) sha256=5d9e188c8f7a0295d162b7b88a768d8452a899977d44f3274d1946d67920ae8d
popper_js (2.11.8) sha256=f4b0be717fc0d50bdb3dbbc55788525a9e0e8f640b76c9971fc34ee609eadbd2
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
prism (1.8.0) sha256=84453a16ef5530ea62c5f03ec16b52a459575ad4e7b9c2b360fd8ce2c39c1254
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
public_suffix (7.0.2) sha256=9114090c8e4e7135c1fd0e7acfea33afaab38101884320c65aaa0ffb8e26a857
puma (7.1.0) sha256=e45c10cb124f224d448c98db653a75499794edbecadc440ad616cf50f2fd49dd
Expand Down Expand Up @@ -919,7 +919,7 @@ CHECKSUMS
rspec-rails (8.0.2) sha256=113139a53f5d068d4f48d1c29ad5f982013ed9b0daa69d7f7b266eda5d433ace
rspec-support (3.13.6) sha256=2e8de3702427eab064c9352fe74488cc12a1bfae887ad8b91cba480ec9f8afb2
rubanok (0.5.1) sha256=4c496d0fe2510c47a084c556018bfd95d388e7553b741ec9138b7139c801f3ec
rubocop (1.82.1) sha256=09f1a6a654a960eda767aebea33e47603080f8e9c9a3f019bf9b94c9cab5e273
rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-capybara (2.22.1) sha256=ced88caef23efea53f46e098ff352f8fc1068c649606ca75cb74650970f51c0c
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/moves_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def execute
def load_server
authorize!

@server = Server.includes(cards: [card_type: :port_type], ports: [connection: :cable]).find(params[:server_id])
@server = Server.includes(cards: [{ card_type: :port_type }], ports: [{ connection: :cable }]).find(params[:server_id])
@moved_connections = MovedConnection.per_servers([@server])
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/visualization/bays_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def set_bay
{ modele: %i[category composants],
cards: [
:composant,
{ ports: [connection: [cable: :connections]],
{ ports: [{ connection: [{ cable: :connections }] }],
card_type: [:port_type] },
] },
],
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/visualization/frames_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def network

def set_frame
authorize! @frame = Frame.includes(
bay: [islet: :room],
bay: [{ islet: :room }],
servers: [
:gestion, :cluster,
{ modele: %i[category composants],
cards: [
:composant,
{ ports: [connection: [cable: :connections]],
{ ports: [{ connection: [{ cable: :connections }] }],
card_type: :port_type },
] },
],
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/visualization/islets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def set_islet
{ modele: %i[category composants],
cards: [
:composant,
{ ports: [connection: [cable: :connections]],
{ ports: [{ connection: [{ cable: :connections }] }],
card_type: [:port_type] },
] },
],
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/visualization/rooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def index
.preload(servers: [
:gestion,
:cluster,
{ modele: :category, card_types: :port_type, cards: [:composant, { ports: [connection: :cable] }] },
{ modele: :category, card_types: :port_type, cards: [:composant, { ports: [{ connection: :cable }] }] },
])
.includes(bay: [:frames, { islet: :room }])
.order("rooms.position asc, islets.name asc, bays.position asc, frames.position asc")
Expand Down Expand Up @@ -72,7 +72,7 @@ def set_room
{ modele: %i[category composants],
cards: [
:composant,
{ ports: [connection: [cable: :connections]],
{ ports: [{ connection: [{ cable: :connections }] }],
card_type: [:port_type] },
] },
],
Expand Down Expand Up @@ -102,7 +102,7 @@ def set_servers_per_frames
def set_sites
@sites = authorized_scope(Site.all)
.joins(:rooms)
.includes(rooms: [bays: [:bay_type]])
.includes(rooms: [{ bays: [:bay_type] }])
.order(:position)
.distinct
end
Expand Down
10 changes: 6 additions & 4 deletions app/models/port.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ def self.to_csv(frames)
used_port_present = false
server.cards.each do |card|
card.ports.each do |port|
if port&.cable_name && card.composant.name.present?
used_port_present = true
csv << (frame_server_info + ["#{card.composant.name}#{card.composant.name.include?("SL") ? "/#{port.position}" : port.position} - #{port.network_conf(server.frame.switch_slot)}"])
end
next unless port&.cable_name && card.composant.name.present?

used_port_present = true
card = "#{card.composant.name}#{card.composant.name.include?("SL") ? "/#{port.position}" : port.position} - #{port.network_conf(server.frame.switch_slot)}"

csv << (frame_server_info + [card])
end
end
# Print one time the server if no port used
Expand Down
Loading