Skip to content

Commit bdc8e9c

Browse files
committed
fix: rubocop autocorrect linter issues
1 parent 0cb2903 commit bdc8e9c

5 files changed

Lines changed: 62 additions & 52 deletions

File tree

.brakeman.ignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"ignored_warnings": [
3+
{
4+
"warning_type": "Mass Assignment",
5+
"warning_code": 105,
6+
"fingerprint": "a53e36aea1309fb0af3b08b9d5403838087ed98264a2a158a98adde5f6d496d3",
7+
"check_name": "PermitAttributes",
8+
"message": "Potentially dangerous key allowed for mass assignment",
9+
"file": "app/modules/meta_intelligence/controllers/builds_controller.rb",
10+
"line": 128,
11+
"note": "Explicit permit list — items/runes/item_build_order are game data arrays, not auth/role fields"
12+
},
313
{
414
"warning_type": "Mass Assignment",
515
"warning_code": 105,

app/modules/competitive/controllers/pro_matches_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ def sync_from_scraper
163163
render json: {
164164
message: 'Scraper sync started in background',
165165
data: {
166-
job_id: job.job_id,
167-
league: league,
166+
job_id: job.job_id,
167+
league: league,
168168
our_team: our_team,
169-
limit: limit
169+
limit: limit
170170
}
171171
}, status: :accepted
172172
rescue ActionController::ParameterMissing => e
@@ -204,8 +204,8 @@ def sync_from_leaguepedia
204204
message: 'Leaguepedia pipeline triggered on scraper',
205205
data: {
206206
tournament: tournament,
207-
our_team: our_team,
208-
scraper: result,
207+
our_team: our_team,
208+
scraper: result,
209209
note: 'Pipeline runs in background. Call sync-from-scraper after it completes to import data into Rails.'
210210
}
211211
}, status: :accepted

app/modules/competitive/services/scraper_importer_service.rb

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ module Services
1616
class ScraperImporterService
1717
# Leaguepedia role values mapped to our internal lowercase convention
1818
ROLE_MAP = {
19-
'Top' => 'top',
20-
'Jungle' => 'jungle',
21-
'Mid' => 'mid',
22-
'Bot' => 'adc',
19+
'Top' => 'top',
20+
'Jungle' => 'jungle',
21+
'Mid' => 'mid',
22+
'Bot' => 'adc',
2323
'Support' => 'support'
2424
}.freeze
2525

2626
# Derive broad tournament region from league slug
2727
LEAGUE_REGION = {
28-
'CBLOL' => 'BR',
29-
'LCS' => 'NA',
30-
'LEC' => 'EUW',
31-
'LCK' => 'KR',
32-
'LPL' => 'CN',
33-
'LLA' => 'LATAM',
34-
'PCS' => 'SEA',
35-
'VCS' => 'VCS',
36-
'TCL' => 'TR',
37-
'LJL' => 'JP',
38-
'CBLOL_A' => 'BR'
28+
'CBLOL' => 'BR',
29+
'LCS' => 'NA',
30+
'LEC' => 'EUW',
31+
'LCK' => 'KR',
32+
'LPL' => 'CN',
33+
'LLA' => 'LATAM',
34+
'PCS' => 'SEA',
35+
'VCS' => 'VCS',
36+
'TCL' => 'TR',
37+
'LJL' => 'JP',
38+
'CBLOL_A' => 'BR'
3939
}.freeze
4040

4141
def initialize(organization)
@@ -111,23 +111,23 @@ def build_attributes(match, ext_id, our_team)
111111
our_resolved, opp_resolved = resolve_teams(team1_name, team2_name, win_team, our_team)
112112

113113
{
114-
organization: @organization,
115-
tournament_name: league,
116-
tournament_stage: match['stage'],
117-
tournament_region: LEAGUE_REGION[league],
118-
external_match_id: ext_id,
119-
match_date: parse_date(match['start_time']),
120-
game_number: match['game_number'],
121-
patch_version: match['patch'],
122-
vod_url: build_vod_url(match['vod_youtube_id']),
123-
our_team_name: our_resolved,
114+
organization: @organization,
115+
tournament_name: league,
116+
tournament_stage: match['stage'],
117+
tournament_region: LEAGUE_REGION[league],
118+
external_match_id: ext_id,
119+
match_date: parse_date(match['start_time']),
120+
game_number: match['game_number'],
121+
patch_version: match['patch'],
122+
vod_url: build_vod_url(match['vod_youtube_id']),
123+
our_team_name: our_resolved,
124124
opponent_team_name: opp_resolved,
125-
victory: determine_victory(our_resolved, win_team),
125+
victory: determine_victory(our_resolved, win_team),
126126
# In Leaguepedia/LoL Esports convention, team1 is always blue side.
127-
side: derive_side(our_resolved, team1_name),
128-
our_picks: build_picks(match['participants'], our_resolved),
129-
opponent_picks: build_picks(match['participants'], opp_resolved),
130-
game_stats: build_game_stats(match, team1_name, team2_name)
127+
side: derive_side(our_resolved, team1_name),
128+
our_picks: build_picks(match['participants'], our_resolved),
129+
opponent_picks: build_picks(match['participants'], opp_resolved),
130+
game_stats: build_game_stats(match, team1_name, team2_name)
131131
}
132132
end
133133

@@ -174,13 +174,13 @@ def build_picks(participants, team_name)
174174
.select { |p| teams_match?(p['team_name'].to_s, team_name) }
175175
.map do |p|
176176
{
177-
'champion' => p['champion_name'],
178-
'role' => normalize_role(p['role']),
177+
'champion' => p['champion_name'],
178+
'role' => normalize_role(p['role']),
179179
'summoner_name' => p['summoner_name'],
180-
'kills' => p['kills'],
181-
'deaths' => p['deaths'],
182-
'assists' => p['assists'],
183-
'win' => p['win']
180+
'kills' => p['kills'],
181+
'deaths' => p['deaths'],
182+
'assists' => p['assists'],
183+
'win' => p['win']
184184
}.compact
185185
end
186186
end
@@ -194,15 +194,15 @@ def normalize_role(role)
194194
# so that side can be retroactively derived (team1 = blue side convention).
195195
def build_game_stats(match, team1_name = nil, team2_name = nil)
196196
{
197-
'source' => 'prostaff_scraper',
198-
'enrichment_source' => match['enrichment_source'],
199-
'leaguepedia_page' => match['leaguepedia_page'],
200-
'gamelength' => match['gamelength'],
197+
'source' => 'prostaff_scraper',
198+
'enrichment_source' => match['enrichment_source'],
199+
'leaguepedia_page' => match['leaguepedia_page'],
200+
'gamelength' => match['gamelength'],
201201
'game_duration_seconds' => match['game_duration_seconds'],
202-
'win_team' => match['win_team'],
203-
'team1_name' => team1_name.presence || match.dig('team1', 'name'),
204-
'team2_name' => team2_name.presence || match.dig('team2', 'name'),
205-
'participants' => match['participants'] || []
202+
'win_team' => match['win_team'],
203+
'team1_name' => team1_name.presence || match.dig('team1', 'name'),
204+
'team2_name' => team2_name.presence || match.dig('team2', 'name'),
205+
'participants' => match['participants'] || []
206206
}.compact
207207
end
208208

app/services/pro_staff_scraper_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def fetch_matches(league:, limit: 50, skip: 0)
4646
cached = Rails.cache.read(cache_key)
4747
return cached if cached
4848

49-
response = get("/api/v1/matches", { league: league, limit: limit, skip: skip })
49+
response = get('/api/v1/matches', { league: league, limit: limit, skip: skip })
5050
result = parse_json(response)
5151
Rails.cache.write(cache_key, result, expires_in: CACHE_TTL_MATCHES)
5252
result

config/initializers/lograge.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
{
1313
request_id: event.payload[:headers]&.[]('X-Request-Id'),
1414
user_agent: event.payload[:headers]&.[]('User-Agent'),
15-
remote_ip: event.payload[:headers]&.[]('REMOTE_ADDR'),
16-
params: event.payload[:params]
15+
remote_ip: event.payload[:headers]&.[]('REMOTE_ADDR'),
16+
params: event.payload[:params]
1717
&.except('controller', 'action', 'format', '_method', 'authenticity_token')
1818
}.compact
1919
end

0 commit comments

Comments
 (0)