New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dead_code_terminator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dead_code_terminator

  • 0.5.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

DeadCodeTerminator

ci gem codecov

This acts like webpack's DefinePlugin with minification pass. It allows to eliminate dead code statically, which can be required by regulations.

value = if ENV['FLAG']
  :then_branch
else
  value2 = unless ENV['PRODUCTION']
    :then_branch
  else
    ENV['RUNTIME'] ? :else1 : :else2
  end
end
# returns a valid ruby code string back with statically evaluated conditions
DeadCodeTerminator.strip(string, env: { "PRODUCTION" => true, "FLAG" => false })
value = 


  value2 = 


    ENV['RUNTIME'] ? :else1 : :else2

Note: it keeps precise code locations (including whitespaces and line-breaks). So if you have hotfix patches from upstream - they'll be applied without conflicts.

Other example can be found in specs

TODO

  • builtin file tree processing

License

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

FAQs

Package last updated on 31 May 2021

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