Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mire

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mire

  • 0.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Build
Status Code
Climate

mire [ˈmɪʀɛ]

mire analyzes a Ruby project and helps you to find dependencies, call stacks and unused methods. It parses Ruby and Haml files and collects all method definitions and invocations.

Installation

Add this line to your application's Gemfile:

gem 'mire'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mire

Usage

First you need to analyze the code and create a .mire_analysis.yml file.

bundle exec mire -a

A Ruby code like

class Foo
  def bar
    buz
  end
end

will lead to this .mire_analysis.yml file.

:bar:
  :definitions:
  - :class: Foo
    :method: :bar
    :file: foo.rb
    :line: 2
  :invocations: []
:buz:
  :definition: []
  :invocations:
  - :class: Foo
    :method: :bar
    :file: foo.rb
    :line: 3

After this the .mire_analysis.yml file can be used to find unused methods for example.

bundle exec mire -u

Checking for unused methods
foo.rb:2 Foo.bar

This result can only be taken as a hint for unused methods. For example ERB files are not being analysed yet. Also dynamic method definitions or invocations are not considered. So mire can't find every usage of a method.

Configuration

mire can be configured with a .mire.yml file in your project folder. With mire -i a initial configuration file is created.

You can configure which files or folders should be excluded while analyzing the code or when displaying the unused methods.

excluded_files:
  - vendor/**/*

output:
  unused:
    excluded_files:
      - db/migrate/**/*
      - spec/**/*
      - script/**/*
      - lib/**/*

Dependencies

Why is HAML-Lint needed?

HAML-Lint did a great job to write a Ruby code extractor for Haml files. mire is using this extractor.

TODO

The current implementation of mire is really basic. It needs to become more robust and the parsed file types (e.g. .erb) needs to be extended.

Contributing

  1. Fork it ( https://github.com/xing/mire/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Authors

Nils Gemeinhardt and Marcus Lankenau

Copyright (c) 2015 XING EVENTS GmbH

Released under the MIT license. For full details see LICENSE included in this distribution.

FAQs

Package last updated on 10 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc