Git Product home page Git Product logo

society's Introduction

Society

Society analyzes and presents social graphs of relationships between classes in a Ruby or Rails project. It displays relationships that are either explicitly declared (e.g. in an ActiveRecord relation) or defined by calls between classes (e.g. in the source of ClassA there is a call to ClassB).

Please note that Society requires Ruby 2.1 or later.

Sample output

Network graph

Network graph

Heatmap

Heatmap

Installation

Add this line to your application's Gemfile:

gem 'society'

And then execute:

$ bundle

Or install it yourself as:

$ gem install society

Usage

From your terminal:

$ society from path/to/models [more/paths/if/applicable]

and then open doc/society/index.htm or doc/society/society.csv in your browser.

For more complex applications, society also supports file globbing:

society from ../path/to/models/*user*

The default format is HTML and CSV; you can skip the HTML interface and just get the JSON by passing --format json

Note that all JSON data is timestamped (regardless of output format) to store snapshots of your project over time.

Recognition

Society was inspired by an original idea by Kerri Miller (@kerrizor).

Contributing

Please note that this project is released with a [Contributor Code of Conduct] (http://contributor-covenant.org/version/1/0/0/). By participating in this project you agree to abide by its terms.

  1. Fork it ( https://github.com/CoralineAda/society/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

society's People

Contributors

bnd5k avatar coralineada avatar geeksam avatar jenseng avatar juanitofatas avatar kerrizor avatar mziwisky avatar parndt avatar simonista avatar wuest 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

society's Issues

Does not intelligently track namespaced/nested classes.

Given a class ProfileBioHeaderBuilder::Builder that makes use of a class ProfileBioHeaderBuilder::Builder::Button, but uses a relative name for the reference to that class, as

      button = Button.build_native(edit_path) if current_user.name == user_name

both classes are listed in the graphs produced by society, but there is no relationship shown between them (and thus no relationships at all to Button). This catastrophically degrades the usefulness of the graphs.

Syntax error in edge.rb

Hello
I am getting an error when using the gem:

*snip*

society-1.2.0/lib/society/edge.rb:14: syntax error, unexpected ',' (SyntaxError)
    def initialize(to:, weight: 1)

*snip*

This does look like a syntax error?

Thanks!

Navigation

As I look through screen caps from my society dive into my app from yesterday, I realize that I'm missing the ability to navigate "up" and "down" the depndency graph.

That is, I'm looking at a particular class for its dependencies. Then, I realize that, gee, I really wish I knew which classes dependended on this class that depend on my class; I want to "climb" one up the network graph. In this case, I happen to be thinking "I wonder which HTTP endpoint is calling this service object/mediator". And I can't easily.

Feels like it may be a useful addition to "focus mode". Let me "refocus" around another class that's in the current focus.

JS control to filter objects on the graph

I would love for someone to submit a PR that accomplishes this. I am envisioning a type-ahead text box or a dropdown of all classes that, when a single class is selected, narrows the scope of the graph down to that class and its relations.

I have talked to @theotherzach about implementing this, so have at it, Zach! :)

Network graph should use a color-blindness-friendly palette

Red/green, currently used to indicate inbound/outbound dependencies, is the most common form of color blindness, but there are color combinations that can be distinguished by people with all variants. Blue/yellow seems to be the highest-contrast option.

Here's a palette: http://www.somersault1824.com/wp-content/uploads/2015/02/color-blindness-palette.png
Source: http://www.somersault1824.com/tips-for-designing-scientific-figures-for-color-blind-readers/

Cluster results by "degree" of dependency

So, when I run society from . on my Rails app I get this graph:

screencapture-file-users-uh-work-riskmethods-doc-society-index-htm-1466770712816

That is of course not ideal. ๐Ÿ˜ Of course this is one of those monolith apps where everything depends on everything. What I'm interested in seeing if there are clusters of classes that depend on each other a lot (i.e. A depends on B, B depends on C, A depends also on C, etc.) but don't depend a lot on classes from other clusters. The hope is that this could help visualise what changes to do to really separate one cluster of classes from the rest of the system. One idea for this would be to visualise it like this:

img_2148

In that examples the classes A, B, C, and D depend a lot on each other. And classes X, Y, and Z do as well. But both clusters don't depend that much on each other.

I can already see two issues with this:

  1. It will still be somewhat useless with the number of classes from my original example
  2. The usefulness of the clustering may depend a lot on the actual graph of dependencies so it may be necessary to tune the parameters for each use case

So I'm basically looking for an interactive version of graphviz neato for my Ruby class dependencies, I guess. If this is the best way to represent this data I have no idea.

X degrees of dependencies "down"/"up"

Having the option to visualize dependencies of dependencies by X many degrees.

Currently, Society defaults to 1. We could make this an input in the UI, fill in the default value, and make it user configurable.

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.