Giter Club home page Giter Club logo

scythe's Introduction

Scythe

DESCRIPTION:

Scythe is a light-weight tool for detecting dead and infrequently used code in production.

Scythe defines a set of functions (probes) that you can call from your application. When they are executed they record the time and date they were called.

A command line utility shows you how long it has been since each probe was called. You can use this information to make an informed decision about whether to attempt to delete code or do further analysis.

FEATURES/PROBLEMS:

  • Currently supports Java, Python 3.x and Ruby

SYNOPSIS:

To use Scythe, place calls in your code of the following form

scythe_probe("probe_name")

probe_name should be a unique string consisting of alphanumerics and underscores. When this call is made in your code the time and date of the call will be recorded. Code for probes in all supported languages is in the probe directory.

Scythe becomes aware of these probes when you call it at the console with the gather option (-g) and a directory path:

scythe -g .

Scythe will recursively iterate over all source files in the specified directory and record the addition of any probe calls. Ideally, scythe -g should be run as part of your build.

To see how long it has been since individual probes have been called run scythe with the -s option. Scythe will produce a list of all probes along with the number of days since they’ve been called.

By default, -s produces its report in days. You can use hours and secs as options as well to get more precise output:

scythe -s secs

If you want to delete a probe, pass its name to Scythe with the -d option:

scythe -d <probe_name>

Scythe returns an error code of 0 on success and 1 on all other errors.

PROBE CALLS:

For simplicity of implementation only two forms are supported for probe calls: the name scythe_probe followed by an identifier ([A-Za-z0-9_]+) in double quotes, or scythe_probe followed by an open paren, identifier in double quotes, and a close paren.

This pattern works for all of the languages Scythe currently supports. Handling single quote strings and other string forms for languages that support them would complicate processing.

FUTURE DIRECTIONS:

  • Support for other languages (Javascript, C, C# etc)

  • Record number of calls and stack traces

  • statsd support

INSTALL

No bundler or gems. Clone the repository:

git clone https://github.com/michaelfeathers/scythe.git

Add scythe/lib to your path

export PATH=$PATH:<directory where scythe is installed>/scythe/lib

Set an environment variable named SCYTHE_PROBE_DIR to a location where the scythe probe history information will reside. This environment variable will be used by the scythe_probe calls.

export SCYTHE_PROBE_DIR=<your probe directory>

Run scythe -h to see command line options

REQUIREMENTS:

  • Ruby >= 2.3.0

  • OPTIONAL: Python 3.x to use the python probe

  • OPTIONAL: Java 7+ to use the Java probe

LICENSE:

(The MIT License)

Copyright © 2016 Michael Feathers

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

scythe's People

Contributors

delitescere avatar helloiamjonas avatar michaelfeathers avatar practicingruby avatar thbrunzendorf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scythe's Issues

.NET version?

I'd be keen to put a C# version of this out. Would you prefer I did it as a completely separate implementation, or part of this scythe repo?

admin flag

when someone is admin, it musnt flag else they get banned for no reason.

Not working in Sinatra apps

I am trying scythe in sinatra app, i am able to see probes created in my directory but report is not changing even the call went through the method. Please let me know if there is a way to solve this issue.

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.