Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Linter applies on text.html.ruby #26

Closed
project0 opened this issue Aug 10, 2015 · 7 comments · Fixed by #37
Closed

Linter applies on text.html.ruby #26

project0 opened this issue Aug 10, 2015 · 7 comments · Fixed by #37
Labels

Comments

@project0
Copy link
Contributor

for some reason, the plugin tries to lint HTML Ruby ERB files.

@MartinodF
Copy link

Same here. The ruby parts of an "HTML (Ruby - ERB)" file (those between <% and %>) are detected as 'source.ruby` and I'm guessing that triggers the plugin to lint the entire file.

linter-ruby

Atom 1.0.7
linter 1.4.3
linter-ruby 1.0.2
ruby 2.2.2p95 on Arch Linux

@project0
Copy link
Contributor Author

editor = atom.workspace.getActiveTextEditor()
editor.scopeDescriptorForBufferPosition(editor.getCursorBufferPosition()).scopes
["text.html.erb", "meta.embedded.line.erb", "source.ruby", "keyword.control.ruby"]

grammar is detect as source.ruby. I guess the problem is related to language-ruby plugin.
Btw. i fixed that by installing the plugin "language-ruby-on-rails"

@philipgiuliani
Copy link

Could you port this also to https://github.com/AtomLinter/linter-rubocop ? We have the same problem there for .html.erb files :(

@Arcanemagus
Copy link
Member

@philipgiuliani The "fix" in #37 just adds a configuration option to disable certain file extensions.

The proper fix for this would be for whatever package is providing your Ruby language support to properly mark the Ruby code in these files as source.embedded.ruby instead of source.ruby. Once that is fixed these linters will stop triggering on the embedded code (unless they mark themselves as supporting it).

I would imagine your problem lies in this file, which would be why installing language-ruby-on-rails might fix it (as it might have an overriding specification?).

@emilyaviva
Copy link

Installing language-ruby-on-rails does not fix the problem. The "fix" in #37, as @Arcanemagus pointed out above, doesn't actually address the problem. I don't want to ignore .html.erb files; on the contrary, they're the ones I want to lint!
screen shot 2015-11-05 at 12 40 53 am

@Arcanemagus
Copy link
Member

@emilyaviva I'm not quite sure what you mean there... this linter simply runs ruby -w -c on the file and reports the results. From what I understand at least .erb files need to be ran through erb, not ruby.

The whole issue here is that the language-ruby package is mistakenly showing the embedded Ruby code in the .erb files as source.ruby instead of source.embedded.ruby, so this linter thinks that ruby -wc would know how to handle it and attempts to run it on the file.

@emilyaviva
Copy link

No, you're right, I had misapprehended how this works. Pay me no heed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants