GithubHelp home page GithubHelp logo

sublimelinter-ruby's Introduction

SublimeLinter-ruby

Build Status

This linter plugin for SublimeLinter provides an interface to linting via ruby -wc. It will be used with files that have the "Ruby" syntax.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before installing this plugin, ensure that ruby is installed on your system. On Mac OS X and Linux, ruby comes pre-installed. On Windows, follow the instructions on the Ruby site.

If you are using rvm or rbenv, ensure that they are loaded in your shell’s "profile" file.

Settings

sublimelinter-ruby's People

Contributors

aparajita avatar braver avatar gary-ash avatar groteworld avatar guilhermesimoes avatar jakitliang avatar jawshooah avatar mokkabonna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimelinter-ruby's Issues

php,js,css syntax mapping in linter

this is my code in user sublime setting.
but is not working.
"sublimelinter_executable_map": {
"css": "D:\Program Files\nodejs\node.exe",
"javascript": "D:\Program Files\nodejs\node.exe"
}

Support warnings

For example

ruby -wc test.rb
test.rb:1: warning: assigned but unused variable - x

is currently ignored.

Different ruby versions?

Hi,

When I run ruby -wc from the command line, everything seems ok,
but when using the new SublimeLinter-ruby (yay!), it seems to use an older version, because it doesn't recognize the new hash notation. e.g.:

 {test: false}

No installed linter matches the view

With the debug option set to true:

SublimeLinter: sublime_linter.py:340  No installed linter matches the view

and the linter doesn't lint.

ruby 2.7.0p0
latest SublimeLinter

Support new versions of ruby

Ruby 2.0 introduced first-class support for keyword arguments:

def foo(bar: 'default')
 puts bar
end

foo # => 'default'
foo(bar: 'baz') # => 'baz'

Ruby 2.0 blocks can also be defined with keyword arguments:

define_method(:foo) do |bar: 'default'|
 puts bar
end

foo # => 'default'
foo(bar: 'baz') # => 'baz'

Ruby 2.1 introduced required keyword arguments, which are defined with a trailing colon:

def foo(bar:)
 puts bar
end

foo # => ArgumentError: missing keyword: bar
foo(bar: 'baz') # => 'baz'

Ruby on Rails syntax mapping

Hello, I'm trying to get the ruby linter to work in ruby on rails projects, using the syntax_map settings.
Here is my full SublimeLinter settings file:

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
            "coffee": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "haml": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "json": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "ruby": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "scss": {
                "@disable": false,
                "args": [],
                "excludes": []
            }
        },
        "mark_style": "squiggly underline",
        "no_column_highlights_line": false,
        "paths": {
            "linux": [
                "/home/myuser/.rbenv/shims/"
            ],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "Ruby on Rails": "ruby",
            "php": "html"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

After reopening sublime text I still cannot get any linting in Ruby on Rails files.
Creating a new file with the Ruby syntax does work. I'm thinking this is not a bug and I may have missed a configuration setting somewhere?

Are there additional settings required for the new ERB support?

I recently received the upgrade with ERB support and I'm getting various odd warnings

<%= simple_form_for @user, :html => { :class => 'form-horizontal' } do |f| %>
  <%= f.input :first_name %>
  <%= f.input :last_name %>
  <%= f.input :email %>
  <div class="form-actions">
    <%= f.button :submit, :class => 'btn-primary' %>
    <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
                leads_path, :class => 'btn' %>
  </div>
<% end %>

"1. Unexpected $end"
"10. Unexpected keyword_end"

Or this line (which I realize could be a property @user.name but the error doesnt make sense

<td><%= "#{@user.first_name} #{@user.last_name}" %></td>

"Possibly useless use of a literal in void context"

Is there some additional settings required to use the ERB support? I'm on ruby 1.9.3-p484

Problem with UTF-8 characters

I have the following ruby code:

module ApplicationHelper
  # Page titles
  def base_page_title
    "My App"
  end

  def page_title(title)
    if title.present?
      "#{title}#{base_page_title}"
    else
      base_page_title
    end
  end
end

SublimeLinter-ruby complains about line 9:

      "#{title}#{base_page_title}"

This line contains an unicode character, an em dash ("—"), and SublimeLinter-ruby reports it as an error with the following message:

Error: unexpected end-of-input, expecting keyword_end

I think this is a problem with SublimeLinter-ruby (or maybe SublimeLinter in general). If I run the same code through ruby -wc app/helpers/application_helper.rb I get Syntax OK, and if I remove that unicode character and replace it with an ASCII character, SublimeLinter starts complaining.

Is there a way to work around this, or is it a bug that needs fixing? Thanks!

"Aborting lint. SublimeLinter needs a restart of Sublime"

I am using Sublime 3143, SublimeLinter 4.2.1 and SublimeLinter-ruby 1.0.17.
Each time I open a ruby file and type something the status bar says: "Aborting lint. SublimeLinter needs a restart of Sublime".

I have tried to add and remove the packages multiple times, but no luck.
I am aware, that this ticket does not contain sufficient information for debugging. Please let me know what else you need to reproduce the error.

How to silent undefined method errors?

Listing appears to be working correctly, however it lights up every method in a file as undefined if it has not been defined in the same file.

The example below highlights protect_from_forgery as undefined:

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
end

screen shot 2017-12-26 at 11 29 30 am

ruby: no Ruby script found in input (LoadError)

I'm sort of stumped by this error:

Packages/User/SublimeLinter.sublime-settings with encoding UTF-8 (atomic)
reloading Packages/User/SublimeLinter.sublime-settings
SublimeLinter: ruby activated: ['/Users/andrew/.rbenv/shims/ruby'] 
SublimeLinter: ruby: datagen.rake ['/Users/andrew/.rbenv/shims/ruby', '-wc'] 
SublimeLinter: ruby output:
ruby: no Ruby script found in input (LoadError) 
Writing file /Users/andrew/recurly-app/lib/tasks/datagen.rake with encoding UTF-8 (atomic)

It looks like it's finding the ruby executable correctly but I'm not sure why it's not getting any input.

Is it just the .rake extension? When i save a normal .rb file it seems happy:

SublimeLinter: ruby: add_on_factory.rb ['/Users/andrew/.rbenv/shims/ruby', '-wc'] 
SublimeLinter: ruby output:
Syntax OK 

And reports errors:

SublimeLinter: ruby: add_on_factory.rb ['/Users/andrew/.rbenv/shims/ruby', '-wc'] 
SublimeLinter: ruby output:
-:21: syntax error, unexpected end-of-input, expecting keyword_end 

Latest commits/version mis-diagnose erb files

Opened up sublime this morning and the .erb files are lit up. I see there's a shift from the (depreciated) syntax mappings to the selector and wonder if erb support was dropped inadvertently. Any thoughts?

screenshot 2018-05-22 11 41 15

screenshot 2018-05-22 11 41 25

Do not work but output on stderr

Do not work but output on stderr

SublimeLinter: WARNING: ruby output:
-:387: warning: assigned but unused variable - write_length
-:388: warning: assigned but unused variable - current_wait_send

This plugin is important for me, hope for help!!!

Please~~~ Thank you very much!

ERB Support

It looks like you can do this to provide ERB file support

erb -xT - <filename> | ruby -wc

Any chance of getting this added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.