Skip to content

Fix rubocop violation (extra line added before model definition) #552

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

Closed
wants to merge 3 commits into from

Conversation

a14m
Copy link

@a14m a14m commented Apr 18, 2018

Remove the extra \n inserted before the class causing the diff to look something like

+# **`sprite_length`**        | `integer`          |
+#
+
+
 class Video < ApplicationRecord

causing rubocop to complain C: Layout/EmptyLines: Extra blank line detected.

solution: Remove the extra line so that the diff would look like:

+# **`sprite_length`**        | `integer`          |
+#
+
 class Video < ApplicationRecord

a14m and others added 3 commits April 18, 2018 19:30
Remove the extra `\n` inserted before the class causing the diff to look something like

```diff
+# **`sprite_length`**        | `integer`          |
+#
+
+
 class Video < ApplicationRecord
```
causing rubocop to complain `C: Layout/EmptyLines: Extra blank line detected.`
@kreintjes
Copy link

@a14m I just tried your fork and it works nicely if you don't have magic comments. However unfortunately, things go wrong when there are magic comments on top of the file (e.g. frozen_string_literal: true). It then changes this:

# frozen_string_literal: true

class Tag < ApplicationRecord

Into this:

# frozen_string_literal: true
# == Schema Information
#
# Table name: tags
#
#  id         :integer          not null, primary key
# ...
#


class Tag < ApplicationRecord

So it seems the annotations are inserted in the wrong place (directly after the magic comment, while they should be directly before the class). This results in two RuboCop violations:

  • "Layout/EmptyLineAfterMagicComment: Add an empty line after magic comments."
  • "Layout/EmptyLines: Extra blank line detected."

Any chance you could take a look at this? This might be fixed already in the original repo. Could you rebase your fork on the upstream?

@drwl drwl closed this in #757 Feb 17, 2020
drwl pushed a commit that referenced this pull request Feb 17, 2020
* Fix new lines after comments for rubocop compatability

Fix #552, #607
vfonic pushed a commit to vfonic/annotate_models that referenced this pull request May 8, 2020
* Fix new lines after comments for rubocop compatability

Fix ctran#552, ctran#607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants