Skip to content

Do not delete leading empty lines #833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

thinca
Copy link

@thinca thinca commented Sep 6, 2020

Source code may have magic comments.

# frozen_string_literal: true

# == Schema Information
#
# Table name: foo
#
#  id                  :integer         not null, primary key
#  created_at          :datetime
#  updated_at          :datetime
#

class Foo < ActiveRecord::Base
end

In this case, the blank line before the annotation should not be erased by annotate --delete.

Expected:

# frozen_string_literal: true

class Foo < ActiveRecord::Base
end

But actual:

# frozen_string_literal: true
class Foo < ActiveRecord::Base
end

This change fixes it.

Source code may have magic comments.

```
# frozen_string_literal: true

# == Schema Information
#
# Table name: foo
#
#  id                  :integer         not null, primary key
#  created_at          :datetime
#  updated_at          :datetime
#

class Foo < ActiveRecord::Base
end
```

In this case, the blank line before the annotation should not be erased
by `annotate --delete`.

Expected:
```
# frozen_string_literal: true

class Foo < ActiveRecord::Base
end
```

But actual:
```
# frozen_string_literal: true
class Foo < ActiveRecord::Base
end
```

This change fixes it.
@thinca thinca force-pushed the do-not-delete-leading-empty-lines-if-annotation-at-top branch from 546a6a6 to e530e17 Compare September 6, 2020 13:29
@ctran ctran added this to the v3.2.0 milestone Mar 24, 2021
@ctran ctran modified the milestones: v3.2.0, v3.2.1 Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants