Skip to content

Commit 4dea5a3

Browse files
committed
[GR-45620] Apply rubocop-truffleruby to lib/truffle as well
PullRequest: truffleruby/3781
2 parents 6c93b4c + 9320476 commit 4dea5a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+258
-165
lines changed

.rubocop.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ AllCops:
1212
Exclude:
1313
- 'lib/truffle/date/format.rb' # crashes Rubocop in VariableForce
1414
- 'lib/truffle/date/delta/parser.rb' # generated code
15+
- 'lib/truffle/pathname.rb' # from upstream and should be upstreamed
1516
- 'lib/truffle/socket/mri.rb' # taken from MRI
1617
- 'lib/truffle/ffi/**/*.rb' # taken from FFI gem
1718
- 'src/main/ruby/truffleruby/core/truffle/ffi/pointer_extra.rb' # taken from FFI gem
@@ -400,23 +401,27 @@ Layout/SpaceAroundEqualsInParameterDefault:
400401
# Supports --auto-correct
401402
TruffleRuby/ReplaceWithPrimitiveNil:
402403
Enabled: true
403-
Include: # inspect *only* this directory
404+
Include: # inspect *only* these files
405+
- lib/truffle/**/*.rb
404406
- src/main/ruby/**/*.rb
405407

406408
# Supports --auto-correct
407409
TruffleRuby/ReplaceWithPrimitiveObjectClass:
408410
Enabled: true
409-
Include: # inspect *only* this directory
411+
Include: # inspect *only* these files
412+
- lib/truffle/**/*.rb
410413
- src/main/ruby/**/*.rb
411414

412415
# Supports --auto-correct
413416
TruffleRuby/ReplaceWithPrimitiveObjectEqual:
414417
Enabled: true
415-
Include: # inspect *only* this directory
418+
Include: # inspect *only* these files
419+
- lib/truffle/**/*.rb
416420
- src/main/ruby/**/*.rb
417421

418422
# Supports --auto-correct
419423
TruffleRuby/ReplaceWithPrimitiveObjectKindOf:
420424
Enabled: true
421-
Include: # inspect *only* this directory
425+
Include: # inspect *only* these files
426+
- lib/truffle/**/*.rb
422427
- src/main/ruby/**/*.rb

lib/cext/ABI_check.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5
1+
6

lib/truffle/continuation.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# truffleruby_primitives: true
2+
13
# Copyright (c) 2017, 2023 Oracle and/or its affiliates. All rights reserved. This
24
# code is released under a tri EPL/GPL/LGPL license. You can use it,
35
# redistribute it and/or modify it under the terms of the:

lib/truffle/coverage.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# truffleruby_primitives: true
2+
13
# Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved. This
24
# code is released under a tri EPL/GPL/LGPL license. You can use it,
35
# redistribute it and/or modify it under the terms of the:

lib/truffle/digest.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ def new
8383
end
8484

8585
def block_length
86-
raise RuntimeError, "#{self.class.name} does not implement block_length()"
86+
raise RuntimeError, "#{Primitive.class(self).name} does not implement block_length()"
8787
end
8888

8989
def update(message)
90-
raise RuntimeError, "#{self.class.name} does not implement update()"
90+
raise RuntimeError, "#{Primitive.class(self).name} does not implement update()"
9191
end
9292
alias_method :<<, :update
9393

9494
def reset
95-
raise RuntimeError, "#{self.class.name} does not implement reset()"
95+
raise RuntimeError, "#{Primitive.class(self).name} does not implement reset()"
9696
end
9797

9898
def digest(message = NO_MESSAGE)
@@ -150,7 +150,7 @@ def ==(other)
150150
end
151151

152152
def inspect
153-
"#<#{self.class.name}: #{hexdigest}>"
153+
"#<#{Primitive.class(self).name}: #{hexdigest}>"
154154
end
155155
end
156156

lib/truffle/digest/bubblebabble.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# truffleruby_primitives: true
2+
13
# Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved. This
24
# code is released under a tri EPL/GPL/LGPL license. You can use it,
35
# redistribute it and/or modify it under the terms of the:

lib/truffle/fcntl.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# truffleruby_primitives: true
2+
13
# Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved. This
24
# code is released under a tri EPL/GPL/LGPL license. You can use it,
35
# redistribute it and/or modify it under the terms of the:

lib/truffle/ffi.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# truffleruby_primitives: true
2+
13
# Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. This
24
# code is released under a tri EPL/GPL/LGPL license. You can use it,
35
# redistribute it and/or modify it under the terms of the:

lib/truffle/objspace.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def self.count_nodes_method(method, nodes)
1414

1515
until node_stack.empty?
1616
node = node_stack.pop
17-
next if node.nil?
17+
next if Primitive.nil?(node)
1818

1919
name = node.first
2020
children = node.drop(1)

lib/truffle/pathname.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# truffleruby_primitives: true
2-
#
2+
33
# = pathname.rb
44
#
55
# Object-Oriented Pathname Class

0 commit comments

Comments
 (0)