Skip to content

Commit a378b49

Browse files
committed
fix: rename set_current_user to assign_current_user (RuboCop compliance)
1 parent 4518e7a commit a378b49

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.rubocop.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
AllCops:
22
TargetRubyVersion: 3.1
3+
NewCops: enable
4+
SuggestExtensions: false
5+
6+
plugins:
7+
- rubocop-minitest
8+
9+
Layout/LineLength:
10+
Max: 200
311

412
Style/StringLiterals:
513
EnforcedStyle: double_quotes
614

715
Style/StringLiteralsInInterpolation:
816
EnforcedStyle: double_quotes
17+
18+
# Relax some metrics for reasonable code
19+
Metrics/ClassLength:
20+
Max: 150
21+
22+
Metrics/MethodLength:
23+
Max: 30
24+
25+
Metrics/AbcSize:
26+
Max: 35
27+
28+
# Allow development dependencies in gemspec for gems
29+
Gemspec/DevelopmentDependencies:
30+
Enabled: false

lib/fast_mcp_jwt_auth/rack_transport_patch.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def authenticate_user_with_token(jwt_token)
7171
return unless token_valid?(decoded_token)
7272

7373
user = find_user_from_token(decoded_token)
74-
set_current_user(user) if user
74+
assign_current_user(user) if user
7575
end
7676

7777
def token_valid?(decoded_token)
@@ -88,7 +88,7 @@ def find_user_from_token(decoded_token)
8888
user
8989
end
9090

91-
def set_current_user(user)
91+
def assign_current_user(user)
9292
FastMcpJwtAuth.config.current_user_setter&.call(user)
9393
end
9494

test/rack_transport_patch_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ def teardown
1717

1818
def test_patch_is_applied
1919
create_configured_transport
20+
2021
assert_predicate FastMcpJwtAuth::RackTransportPatch, :patch_applied?
2122
end
2223

2324
def test_transport_has_patched_methods
2425
transport = create_configured_transport
26+
2527
assert_respond_to transport, :handle_mcp_request
2628
end
2729

@@ -51,6 +53,7 @@ def test_jwt_authentication_disabled_ignores_header
5153
# When disabled, patch is not applied at all
5254
FastMcpJwtAuth.configure { |c| c.enabled = false }
5355
FastMcpJwtAuth::RackTransportPatch.apply_patch!
56+
5457
refute_predicate FastMcpJwtAuth::RackTransportPatch, :patch_applied?
5558
end
5659

0 commit comments

Comments
 (0)