Giter Site home page Giter Site logo

nova-rubocop's Introduction

RuboCop Extension for Nova

Provides integration with RuboCop to lint your Ruby source files.

Features

  • Automatically invokes RuboCop and reports on issues found within your Ruby source files.

nova-rubocop's People

Contributors

dependabot[bot] avatar evanleck avatar jbeker avatar jsmecham avatar toadle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nova-rubocop's Issues

Config files ignored?

The script uses
RuboCop[21:51:48.314000] Found RuboCop 0.80.0 (Bundled)

but it marks offenses that:

  • are due to cops disabled in .rubocop.yml
  • are due to cops disabled in .rybocop_todo.yml

bundle exec rubocop ignores those offenses.

Support legacy Rubocop

Thanks for fixing bundler :)

However, the extension still doesn't work for me:

RuboCop[19:37:35.502000] Found RuboCop 0.51.0 (Bundled)

RuboCop[19:37:37.847000] invalid option: --no-display-cop-names
/Users/msapka/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rubocop-0.51.0/lib/rubocop/options.rb:19:in `parse'
/Users/msapka/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rubocop-0.51.0/lib/rubocop/cli.rb:27:in `run'
/Users/msapka/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rubocop-0.51.0/bin/rubocop:13:in `block in <top (required)>'
/Users/msapka/.rbenv/versions/2.3.8/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
/Users/msapka/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/rubocop-0.51.0/bin/rubocop:12:in `<top (required)>'
/Users/msapka/.rbenv/versions/2.3.8/bin/rubocop:22:in `load'
/Users/msapka/.rbenv/versions/2.3.8/bin/rubocop:22:in `<main>'

I'm 99% sure that this means Rubocop we are using is too old for this fancy option.

Unrecognized cop error

I am able to run bundle exec rubocop in my project without issues, but in Nova, I keep getting "Error: unrecognized cop or department" errors. I am on Rails 7, Ruby 3.1.4, and these are the rubocop gems I have included:

group :development, :test do
  gem 'rubocop'
  gem 'rubocop-performance'
  gem 'rubocop-rails'
  gem 'rubocop-rspec'

Format on save

An option to auto-format a file on save is what I really want from this extension. Is anyone working on this already, or should I get started on it?

For implementation, I'm okay with this being the default setting, but it does make sense for it to be toggle-able.

RuboCop Not Found

I’m seeing an error that says:

RuboCop Not Found
The "rubocop" command could not be found in your environment.

Screen Shot 2020-09-18 at 8 03 42 PM

Relevant details:

  • I’m using rbenv. The project is using Bundler. Rubocop is in the project’s Gemfile. Rubocop is not installed globally.
  • When I open a new Local Terminal, both rubocop and bundle exec rubocop work.
  • Nova’s Extension Console doesn’t log anything (I’m not sure if it should be).
  • I just installed Nova and am using default settings AFAIK. For example, I have “Automatically request environment from login shell” checked in the Tools tab in Preferences.

I read the Help guide for the extension. I wish I could have debugged it further on my end before creating this issue, but I’m not sure exactly what the best next steps to take are.

❤️ Thank you so much for making this extension! ❤️

Seems to be not respecting ignored paths

First, thank you so much for writing this and if I can help test, I am happy to.

I am seeing errors reported for files that should be excluded in the .rubocop.yml file. I ran into this before with other tools and I believe the solution was to add the --force-exclusion when running rubocop.

Might that be an option? Or even the default?

RuboCop Errors Are Not Debuggable Due to Lack of Console Output

Well, it was working for awhile but it suddenly stopped. In the extensions console, I see this:

RuboCop[10:15:45.408000] Found RuboCop 0.80.1 (Global)
RuboCop[10:15:45.415000] env: rubocop: No such file or directory

... and that's it - nothing is showing in the editor even when I make a known error.

I've been using RuboCop long enough to know that sometimes it breaks with all the different versions of Ruby, etc... But this info above is not enough to debug.

I can't tell which Ruby it's using (I use RVM) or why it's failing. When I run from the command line, RuboCop works fine, is in the Gemfile, installed, etc...

Is it possible for the extension to do what other extensions in editors like Sublime do and print out all of the details about what they are running so that errors are debuggable?

Extension encountered an uncaught exception

Hey there,

my situation is the following:

  1. I have rubocop installed globally and running rubocop --format=json works in my project-root.
  2. I have a Gemfile in my project-root containing rubocop, but running bundle exec rubocop will not work because the project is run using docker.

I get the following exception when trying to use the extension:

RuboCop[13:03:34.174000] SyntaxError: JSON Parse error: Unrecognized token '#'

RuboCop[13:03:34.174000] Extension encountered an uncaught exception:
/Users/tim/Library/Application Support/Nova/Extensions/Mecham.RuboCop/Scripts/main.dist.js (Line 282, Column 0)
TypeError: undefined is not an object (evaluating 'offenses.map')
    file:///Users/tim/Library/Application%20Support/Nova/Extensions/Mecham.RuboCop/Scripts/main.dist.js:282:42
    handleOutput@file:///Users/tim/Library/Application%20Support/Nova/Extensions/Mecham.RuboCop/Scripts/main.dist.js:211:37
    file:///Users/tim/Library/Application%20Support/Nova/Extensions/Mecham.RuboCop/Scripts/main.dist.js:170:76

Anything I can do to resolve this?

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.