Skip to content

query builder: "warning: too many arguments for format string" #255

@erikj

Description

@erikj

Performing a client query w/ Ruby warnings enabled and no params passed results in a warning from ruby re: an empty hash as right-hand argument to %:

vendor/ruby/2.7.0/gems/influxdb-0.8.1/lib/influxdb/query/builder.rb:12: warning: too many arguments for format string

Triggering this warning in plain-old ruby:

$ irb -w
irb(main):001:0> "foo" % {}
(irb):1: warning: too many arguments for format string
=> "foo"

Adding a params.empty? check to InfluxDB::Query::Builder#build() seems to address the warning:

params.empty? ? query : query % params

The warning is not a bug per se, but when running code w/ many queries and warnings enabled, such as in a test suite, it can result in diminished signal to noise that obscures warnings from application code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions