Skip to content

Commit

Permalink
updated readme, added more docs, minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
casey kneale committed Apr 4, 2020
1 parent 2b74b5f commit 0ecd7be
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Sherlock"
uuid = "50c525cd-8faa-4dfa-b5e0-1fbe0ebc7ed3"
authors = ["Casey Kneale"]
version = "0.1.2"
version = "0.1.3"

[deps]
Blink = "ad839575-38b3-5650-b840-f874b8c74a25"
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@
[![Codecov](https://codecov.io/gh/caseykneale/Sherlock.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/caseykneale/Sherlock.jl)
[![Build Status](https://api.cirrus-ci.com/github/caseykneale/Sherlock.jl.svg)](https://cirrus-ci.com/github/caseykneale/Sherlock.jl)

### Overview
The goal for Sherlock is to make it easy to create design document charts, and interrogate packages from a "high level" either visually or programmatically (from the REPL, or whatever). The current state of the code is somewhere between "hot mess" and "early sunday morning hacking away". So, feel free to contribute, or clean things up, or whatever you want.
## Overview
The goal for Sherlock is to make it easy to create design document charts, and interrogate packages from a "high level" either visually or programmaticly (from the REPL, or whatever). This was started because someone wanted some design document things from another project. So, rather then go through that drudgery it seemed most appropriate to make a tool that let's people do this for everyone - easily.

This was started because someone wanted some design document things from another project. So, rather then go through that drudgery it seemed most appropriate to make a tool that let's people do this for everyone - easily.
### Whats displayed?
- Types, Abstract Types, Functions, Dynamically Typed items, and Undefined exports are all displayed.
- First order connections between these items are all visible and stored in a Graph structure backend.
- Second or higher order connectivity is not currently guaranteed. (IE: the relationship between `ConcreteType` and `AbstractType2` in the following example: `ConcreteType <: AbstractType1{AbstractType2}`, will not be displayed except maybe in the `TypeTree` plot ).
- Macros are also not displayed because these puppies dynamically generate code, that's just out of the scope of this project for now.
- Types which do not belong directly to an inspected Module are also not displayed. Think of how confusing that could be?

Right now there's only a little functionality to this package, but maybe it will grow to suit other needs later. You can use either a WebUI or the command line

## WebUI
There are 2 options for displaying the visualizations herein: the WebUI or the command line.

### WebUI
```Julia
using Sherlock
sherlock_UI()
```
![image](https://raw.githubusercontent.com/caseykneale/Sherlock.jl/master/images/webui.png)

## CLI/REPL
### CLI/REPL
```Julia
using LightGraphs, GraphRecipes, Plots
using Sherlock
Expand All @@ -40,4 +46,4 @@ sherlockplot(d)
magnify( d, :Detective )
```

That's about really all there is too this for now. Please file bug reports, make PR's and suggestions.
The current state of the code is somewhere between "hot mess" and "early Sunday morning hacking away". If anyone would like to contribute to making this package either more robust, more information rich, or more clean I'd really appreciate it!
6 changes: 6 additions & 0 deletions src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ function safeisabstract(m::Module, s::Symbol, t::Type)::Bool
return safeisfield( m, s, t ) && isabstracttype( getfield( m, s ) )
end

"""
ismacro(s::Symbol)
checks the first character of an input symbol to see if it contains a `@` or not.
"""
ismacro(s::Symbol) = first( string( s ) ) == '@'

"""
Expand Down
7 changes: 7 additions & 0 deletions src/Utilities.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""
nothing_is_val( x::Union{Nothing,Int}, val = Inf )
if `x` is a type nothing return the alternative, `val` param. Otherwise returns x.
Note: this is specifically used for `findfirst()` failures internally.
"""
nothing_is_val( x::Union{Nothing,Int}, val = Inf ) = isnothing(x) ? val : x

"""
Expand Down
7 changes: 3 additions & 4 deletions src/Visualizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,11 @@ function sherlock_UI()

graphdisplay = Observable{Any}( plot( [0.0],[0.0], color = :white, border = :none,
legend = false, axis = nothing, ticks = nothing,
title = "Please Inspect a Module that is Loaded into Scope...") );
title = "Please Inspect a Module that is Loaded into Scope. \n Inspection may require 30s for the first run.") );
mainwindow = vbox( topload, graphdisplay );
sherlock = Observable( Detective( Sherlock ) )

function make_graph( d, selected_module::Symbol,
types_to_fns, fns_to_fns )

function make_graph( d, selected_module::Symbol, types_to_fns, fns_to_fns )
try
if (types_to_fns || fns_to_fns)
d = Detective( getfield(Main, selected_module) )
Expand Down

0 comments on commit 0ecd7be

Please sign in to comment.