All Projects → julianrubisch → Attractor

julianrubisch / Attractor

Licence: mit
code complexity metrics visualization and exploration tool for ruby and javascript

Programming Languages

javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language
es6
455 projects

Projects that are alternatives of or similar to Attractor

Phpqa
Docker image that provides static analysis tools for PHP
Stars: ✭ 853 (+571.65%)
Mutual labels:  code-quality
Hippo
PHP standards checker.
Stars: ✭ 82 (-35.43%)
Mutual labels:  code-quality
Pkgnet
R package for analyzing other R packages via graph representations of their dependencies
Stars: ✭ 107 (-15.75%)
Mutual labels:  code-quality
Typewiz
Automatically discover and add missing types in your TypeScript code
Stars: ✭ 1,026 (+707.87%)
Mutual labels:  code-quality
Cross Platform Node Guide
📗 How to write cross-platform Node.js code
Stars: ✭ 1,161 (+814.17%)
Mutual labels:  code-quality
Test Each
🤖 Repeat tests. Repeat tests. Repeat tests.
Stars: ✭ 89 (-29.92%)
Mutual labels:  code-quality
Feflow
🚀 A command line tool aims to improve front-end engineer workflow and standard, powered by TypeScript.
Stars: ✭ 942 (+641.73%)
Mutual labels:  code-quality
Editorconfig Checker
A tool to verify that your files are in harmony with your .editorconfig
Stars: ✭ 119 (-6.3%)
Mutual labels:  code-quality
Prettier action
GitHub action for running prettier on your projects pull requests
Stars: ✭ 77 (-39.37%)
Mutual labels:  code-quality
Wemake Python Styleguide
The strictest and most opinionated python linter ever!
Stars: ✭ 1,714 (+1249.61%)
Mutual labels:  code-quality
Duplo
Duplicates finder for various source code formats.
Stars: ✭ 51 (-59.84%)
Mutual labels:  code-quality
Static Analysis
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
Stars: ✭ 9,310 (+7230.71%)
Mutual labels:  code-quality
Pscodehealth
PowerShell module gathering PowerShell code quality and maintainability metrics
Stars: ✭ 104 (-18.11%)
Mutual labels:  code-quality
Unused
Deprecated; see https://github.com/unused-code/unused
Stars: ✭ 879 (+592.13%)
Mutual labels:  code-quality
Goreadme
Generate readme file from Go doc. Now available with Github actions!
Stars: ✭ 113 (-11.02%)
Mutual labels:  code-quality
Ruby warning filter
Verbose Ruby mode without the noise
Stars: ✭ 9 (-92.91%)
Mutual labels:  code-quality
Typo3scan
Scans TYPO3 extensions for usage of deprecated and or changed code
Stars: ✭ 83 (-34.65%)
Mutual labels:  code-quality
Js Cpa
Code pattern analysis for JS
Stars: ✭ 120 (-5.51%)
Mutual labels:  code-quality
Coveralls Ruby
Coveralls for Ruby
Stars: ✭ 115 (-9.45%)
Mutual labels:  code-quality
Platform
Code Climate Engineering Data Platform
Stars: ✭ 104 (-18.11%)
Mutual labels:  code-quality

Logo

Attractor

A code complexity metrics visualization and exploration tool for Ruby and JavaScript


Build Status Ruby Tests Action Status Forks Stargazers Issues MIT License Twitter follow

All Contributors

Become a Patron!

attractor_v0 6 1

Table of Contents

Introduction

Many authors (Michael Feathers, Sandi Metz) have shown that an evaluation of churn vs complexity of files in software projects provide a valuable metric towards code quality. This is another take on the matter, for ruby code, using the churn and flog projects.

Here's an article on medium explaining the approach in greater detail.

Installation

Attractor's installation is standard for a Ruby gem:

gem install attractor

You'll also want to install some plugins to go along with the main gem:

gem install attractor-ruby # https://github.com/julianrubisch/attractor-ruby
gem install attractor-javascript # https://github.com/julianrubisch/attractor-javascript

You will most likely want to install Attractor using Bundler:

gem 'attractor'
gem 'attractor-ruby'
gem 'attractor-javascript'

And then execute:

bundle

Usage

To create a HTML report in attractor_output/index.html:

attractor report

If you'd like to specify a directory, use the file prefix option:

attractor report --file_prefix app/models

Or shorter:

attractor report -p app/models

Check JavaScript:

attractor report -p app/javascript -t js

Watch for file changes:

attractor report -p app/models --watch

Serve at http://localhost:7890:

attractor serve -p app/models

Enable rack-livereload:

attractor serve -p app/models --watch

Make sure you prefix these commands with bundle exec if you are using Bundler.

Live Reloading

If you have guard-livereload (or a similar service) running on your project, you can leverage the hot reloading functionality by specifying --watch|-w. Attractor will then live-reload the browser window when a file watched by guard-livereload changes.

CI Usage

To use this CLI in a CI environment, use the --ci option, which will suppress automatic opening of a browser window.

Github Action

There is a dedicated Github Action that will compile Attractor's output.

You can quickly integrate it into your action's workflow by grabbing it on the Marketplace.

Gitlab Example

The simplest use case is to store the attractor_output directory as an artifact.

attractor:
  stage: your-stage-label
  image: ruby:latest
  script:
    - gem install attractor
    - attractor report --ci
  artifacts:
    when: on_success
    paths:
      - attractor_output

CLI Commands and Options

Print a simple output to console:

attractor calc
  --file_prefix|-p app/models
  --type|-t rb|js
  --watch|-w
  --start_ago|-s  (e.g. 5y, 3m, 7w)
  --minimum_churn|-c (minimum times a file must have changed to be processed)

Generate a full report

attractor report
  --file_prefix|-p app/models
  --type|-t rb|js
  --watch|-w
  --no-open-browser|--ci
  --start_ago|-s  (e.g. 5y, 3m, 7w)
  --minimum_churn|-c (minimum times a file must have changed to be processed)

Serve the output on http://localhost:7890

attractor serve
  --file_prefix|-p app/models
  --watch|-w
  --no-open-browser|--ci
  --start_ago|-s  (e.g. 5y, 3m, 7w)
  --minimum_churn|-c (minimum times a file must have changed to be processed)

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To run all tests, run bin/test. You can run the specs by themselves with bundle exec rspec, and the cucumber features with bundle exec cucumber.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub.

Logo Attribution

Black Hole by Eynav Raphael from the Noun Project

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Julian Rubisch

💻 📖

Olivier

🚧

Andrew Mason

💻 👀 📖

Ernesto Tagwerker

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].