Socket
Book a DemoInstallSign in
Socket

un_used_methods

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

un_used_methods

0.1.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

UnUsedMethods Gem

Gem Version

The un_used_methods gem is designed to help you identify and clean up unused methods in your Ruby on Rails application. In a large codebase, it can be challenging to track which methods are actively used and which are obsolete. The un_used_methods gem scans your application's codebase and identifies methods that are defined but not used anywhere else in your project. This helps you spot and remove unnecessary code, improving maintainability and performance.

Features

  • Scans for method definitions across various directories (models, controllers, helpers, views, and more).
  • Checks for method usage in code files and view templates.
  • Reports methods that are defined but not used in the project.

Installation

Add this line to your application's Gemfile:

gem 'un_used_methods'

Then run:

bundle install

Usage

To use the gem, run the following command:

bundle exec un_used_methods find_unused

This command will analyze your codebase and print out any unused methods it finds. The gem scans through Ruby files, HTML/ERB templates, and other relevant file types to ensure comprehensive coverage.

Example Output

Method 'test' called in file: app/models/test.rb
Method 'another_method' not called anywhere in the project

Unused Methods found in your model, controller and helper directories:
app/models/test.rb: another_method

Configuration

The gem uses default settings to scan common directories and file types. If you need to customize the directories or file types to scan, you can modify the gem's configuration within the codebase.

Development

To contribute to the development of this gem:

  • Fork the repository.
  • Create a new branch (git checkout -b feature/your-feature).
  • Commit your changes (git commit -am 'Add some feature').
  • Push to the branch (git push origin feature/your-feature).
  • Create a new Pull Request.
  • Write RSpec test cases for the features you added.

License

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

Acknowledgements

This gem leverages concepts from static code analysis and method usage detection to enhance code quality.

FAQs

Package last updated on 22 Aug 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.