Skip to content

Lexer#lex warns even when no options are passed in #1186

Closed
@mojavelinux

Description

Starting in 3.4.1, the following Rouge code generates a warning in verbose mode about the use of opts with Lexer.lex:

old_verbose, $VERBOSE = $VERBOSE, nil
require 'rouge'
$VERBOSE = old_verbose

source = 'puts "Hello, World!"'
formatter = Rouge::Formatters::HTML.new
lexer = Rouge::Lexer.find 'ruby'
formatter.format(lexer.lex(source))

The following message is printed when invoked using ruby -w:

The use of opts with Lexer.lex is deprecated
The use of opts with Lexer.lex is deprecated

The problem is that Rouge itself is passing the options, not the user. See https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/lexer.rb#L426-L429.

This warning did not occur in 3.4.0, so it has to do with this change: 6835352

Metadata

Assignees

No one assigned

    Labels

    bugfix-requestA request for a bugfix to be developed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions