Skip to content

Cop to catch unescaped ] in RegExp #11514

@sambostock

Description

@sambostock

Is your feature request related to a problem? Please describe.

Ruby emits a warning for the following:

ruby -c -e '/abc]123/'
-e:1: warning: regular expression has ']' without escape: /abc]123/
Syntax OK

Describe the solution you'd like

It would be nice if Rubocop could catch this statically, as that integrates better into CI.

Describe alternatives you've considered

Tools like Deprecation Toolkit can be configured to catch warnings, but in the case of Deprecation Toolkit, it will only do so while running tests, whereas we encountered a case where the file had already been read by then.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy