Skip to content

Multiline copyright comments not working #7189

@Sharparam

Description

@Sharparam

In my code, I'd like to enforce a copyright comment at the top of files similar to:

# Copyright {YEAR} by {AUTHOR}.
#
# Several lines
# of license details
# following the copyright.

The Style/Copyright inspector seemed right for this, but it does not seem to work properly when giving it a multiline comment for the Notice key.


Expected behavior

Rubocop should work with multiline copyright comments.

Actual behavior

Rubocop claims the copyright comment is invalid.

Steps to reproduce the problem

  1. Get the example code from https://gist.github.com/Sharparam/65e57759b365f3a08e7bd03ce37328c6
  2. Run the test.sh script.
  3. Observe how the tests work for single-line comments, but not for multi-line comments.
  4. Additionally, observe the "infinite loop" detected by Rubocop due to attempting to "fix" the file indefinitely if it's told to autocorrect.

RuboCop version

$ rubocop -V
0.72.0 (using Parser 2.6.3.0, running on ruby 2.6.3 x86_64-linux)

I'm on WSL Ubuntu 18.04, if it matters:

$ uname -a
Linux Sharparam-PC 4.4.0-18362-Microsoft #1-Microsoft Mon Mar 18 12:02:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requeststaleIssues that haven't been active in a while

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions