Skip to content

presidentbeef/ruby-lsp-brakeman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Brakeman for Ruby LSP

This library enables running Brakeman via Ruby LSP.

The library is in early but working stages. It has only been tested with VS Code so far.

Installation

Add ruby-lsp-brakeman to your Gemfile:

gem 'ruby-lsp-brakeman', require: false

Bundle install and restart the Ruby LSP server/extension to enable.

In Action

Initialization output should look like this:

Starting Brakeman in Ruby LSP/VS Code

Display of inline warnings on hover:

Display of Brakeman warning

Display after clicking "View Problem":

Display of Brakeman warning

Warnings are listed as "problems" in VS Code's panel:

Listing of Brakeman warnings

When files are saved, Brakeman will rescan the files and update any impacted warnings. Note that scans are asynchronous and only one scan will run at a time. If multiple files are changed while a scan is running, they will be queued and then rescanned all together when the current scan finishes.

Queuing, scanning, reported changes

Limitations

  • Column numbers are not available right now, so the entire line is always reported
  • Brakeman's rescanning capabilities are currently being overhauled. They work but may be a little slow (but still faster than a full scan)
  • Large applications may require way too much memory for incremental scans to be useful
  • Warnings may not clear if Ruby LSP crashes
  • VS Code does not seem to support CodeDescription which can link to more information
  • No tests yet, so buyer beware

License

The gem is available as open source under the terms of the MIT License.