Skip to content

Commit 2fa465a

Browse files
tancnlezenspider
andauthored
Fix private class unused variable warnings (#2031)
* Fix warnings about private_class_method usage * Unused variable warnings Most of these should just be removed instead of underscored... but I want eyeballs on this first. Some aren't being used the way they think they're being used. * Remove unused variable warnings in GDScript * Remove unused variables * Remove parentheses after method name warnings * Remove regexp ambiguity warnings --------- Co-authored-by: Ryan Davis <[email protected]>
1 parent 4a52324 commit 2fa465a

File tree

11 files changed

+9
-21
lines changed

11 files changed

+9
-21
lines changed

lib/rouge/cli.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ def run
347347
formatter.format(lexer.lex(input), &method(:print))
348348
end
349349

350-
private_class_method
351-
def self.parse_cgi(str)
350+
private_class_method def self.parse_cgi(str)
352351
pairs = CGI.parse(str).map { |k, v| [k.to_sym, v.first] }
353352
Hash[pairs]
354353
end
@@ -511,8 +510,7 @@ def run
511510
end
512511

513512

514-
private_class_method
515-
def self.normalize_syntax(argv)
513+
private_class_method def self.normalize_syntax(argv)
516514
out = []
517515
argv.each do |arg|
518516
case arg

lib/rouge/lexers/gdscript.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class GDScript < RegexLexer
1212
mimetypes 'text/x-gdscript', 'application/x-gdscript'
1313

1414
def self.keywords
15-
@keywords = %w(
15+
@keywords ||= %w(
1616
and in not or as breakpoint class class_name extends is func setget
1717
signal tool const enum export onready static var break continue
1818
if elif else for pass return match while remote master puppet
@@ -22,13 +22,13 @@ def self.keywords
2222

2323
# Reserved for future implementation
2424
def self.keywords_reserved
25-
@keywords_reserved = %w(
25+
@keywords_reserved ||= %w(
2626
do switch case
2727
).join('|')
2828
end
2929

3030
def self.builtins
31-
builtins = %w(
31+
@builtins ||= %w(
3232
Color8 ColorN abs acos asin assert atan atan2 bytes2var ceil char
3333
clamp convert cos cosh db2linear decimals dectime deg2rad dict2inst
3434
ease exp floor fmod fposmod funcref hash inst2dict instance_from_id
@@ -41,7 +41,7 @@ def self.builtins
4141
end
4242

4343
def self.builtins_type
44-
@builtins_type = %w(
44+
@builtins_type ||= %w(
4545
bool int float String Vector2 Rect2 Transform2D Vector3 AABB
4646
Plane Quat Basis Transform Color RID Object NodePath Dictionary
4747
Array PoolByteArray PoolIntArray PoolRealArray PoolStringArray

lib/rouge/lexers/meson.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def self.builtin_functions
3838
end
3939

4040
identifier = /[[:alpha:]_][[:alnum:]_]*/
41-
dotted_identifier = /[[:alpha:]_.][[:alnum:]_.]*/
4241

4342
def current_string
4443
@current_string ||= StringRegister.new

lib/rouge/lexers/objective_c/common.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
module Rouge
55
module Lexers
66
module ObjectiveCCommon
7-
id = /[a-z$_][a-z0-9$_]*/i
8-
97
def at_keywords
108
@at_keywords ||= %w(
119
selector private protected public encode synchronized try

lib/rouge/lexers/openedge.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ class OpenEdge < RegexLexer
1212
title 'OpenEdge ABL'
1313
desc 'The OpenEdge ABL programming language'
1414

15-
# optional comment or whitespace
16-
ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
1715
id = /[a-zA-Z_&{}!][a-zA-Z0-9_\-&!}]*/
1816

1917
def self.keywords

lib/rouge/lexers/syzlang.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def self.keywords_type
2727

2828
comment = /#.*$/
2929
inline_spaces = /[ \t]+/
30-
eol_spaces = /[\n\r]+/
3130
spaces = /\s+/
3231

3332
state :inline_break do

lib/rouge/lexers/ttcn3.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ def self.types
4646
)
4747
end
4848

49-
# optional comment or whitespace
50-
ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
5149
id = /[a-zA-Z_]\w*/
5250
digit = /\d_+\d|\d/
5351
bin_digit = /[01]_+[01]|[01]/

lib/rouge/tex_theme_renderer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def token_name(tok)
109109
end
110110

111111
def render_blank(tok, &b)
112-
out = "\\expandafter\\def#{token_name(tok)}#1{#1}"
112+
"\\expandafter\\def#{token_name(tok)}#1{#1}"
113113
end
114114

115115
def render_style(tok, style, &b)

spec/guesser_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
it 'sequentially filters' do
4848
custom = Class.new(Rouge::Guesser) {
4949
define_method(:filter) { |lexers|
50-
passed_lexers = lexers
51-
5250
[Rouge::Lexers::Javascript, Rouge::Lexers::Prolog]
5351
}
5452
}.new

tasks/builtins/lasso.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module Rouge
4646
keywords
4747
end
4848

49-
def render_output (keywords, &b)
49+
def render_output(keywords, &b)
5050
return enum_for(:render_output, keywords).to_a.join("\n") unless b
5151

5252
yield "# -*- coding: utf-8 -*- #"

0 commit comments

Comments
 (0)