• Stars
    star
    440
  • Rank 95,649 (Top 2 %)
  • Language
    Ruby
  • Created over 12 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Static analysis Lint-type tool to improve your OO Ruby code

pelusa - /pe 'lu sa/ Build Status Dependency Status

A Ruby Lint to improve your OO skills

Pelusa is a static analysis tool and framework to inspect your code style and notify you about possible red flags or missing best practices.

Above all pelusa doesn't run your code -- it just analyzes it syntactically to gain superficial insights about it, and raise red flags when needed.

Pelusa needs Rubinius to run, due to how easy it is to work with a Ruby AST with it, but it doesn't mean that your Ruby code must run on Rubinius. Since it's a static analysis tool, pelusa doesn't care what your code runs on, it just looks at it and tells you stuff.

Here's a sample of pelusa linting on its own code base:

Why Pelusa?

Pelusa happens to be Spanish for the word "Lint". Yeah, I couldn't believe it either.

Installation and usage

rvm use rbx
gem install pelusa

To run pelusa, you must run Rubinius in 1.9 mode. To do this, export this environment variable:

export RBXOPT=-X19

Then go to a directory where you have some Ruby code, and type this:

pelusa path/to/some_file.rb

Or just run all the Ruby files (**/*.rb) without arguments:

pelusa

Configuration

You can use per-project configurations as per which lints to use and their configurations. Just put a .pelusa.yml file the root directory of your project, like this:

sources: lib/**/*.rb
lints:
  InstanceVariables:
    limit: 5
  LineRestriction:
    limit: 80
    exclude:
      - SomeClass
  Properties:
    enabled: false

This allows you to disable lints, configure their variables, and exclude some classes from being analyzed by certain lints.

About the default set of Lints

This project was born as an inspiration from one of our Monday Talks about Object Oriented Nirvana by @oriolgual. After reading this blog post he prepared his talk and I (@txustice) found it interesting, so I explored the possibility of programmatically linting these practices on a Ruby project. This doesn't mean that any of us thinks these are the true and only practices of Object Orientation, it's just a set of constraints that are fun to follow to achieve a mindset shift in the long run.

Anyway, you are always free to implement your own lints, or the ones that suit your team the best.

Pelusa as a static analysis framework

With Pelusa, writing your own lints becomes very easy. Check out some of the default lints under the lib/pelusa/lint/ directory.

At some point it will be user-extendable by default, but for now you are better off forking the project and adding your own lints as you need them in your team (or removing some default ones you don't like).

Special mentions

The beautiful UTF-8 flowers before each lint ran are taken from Testosterone, a project by @masylum. They're really beautiful, thanks!!!

Contributing

You can easily contribute to Pelusa. Its codebase is simple and extensively documented.

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add specs for it. This is important so we don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull.
  • Send me a pull request. Bonus points for topic branches.

License

MIT License. Copyright 2011 Codegram Technologies

More Repositories

1

spinach

Spinach is a BDD framework on top of Gherkin.
Ruby
578
star
2

date_validator

A simple, ORM agnostic, Ruby >=2.2 compatible date validator for Rails, based on ActiveModel.
Ruby
493
star
3

rack-webconsole

Rack-based interactive console (Γ  la Rails console) for your web application's front-end
Ruby
251
star
4

vim-codereview

GItHub Pull Request-based Code Reviews
Ruby
240
star
5

futuroscope

Yet another Futures implementation in Ruby
Ruby
210
star
6

hyperclient

HyperClient is a Ruby Hypermedia API client.
Ruby
152
star
7

resort

Positionless model sorting for Rails
Ruby
103
star
8

spinach-rails

Spinach-rails is a compatibility layer on top of Spinach to provide rails support.
Ruby
62
star
9

vimfiles

Codegram vimfiles
Vim Script
44
star
10

ember-forms

Easy forms for ember.js
JavaScript
37
star
11

gherkin-ruby

gherkin-ruby is a Gherkin parser in pure Ruby using Parslet.
Ruby
33
star
12

markdownizer

Render any text as markdown, with code highlighting and all!
Ruby
30
star
13

colorblind

Extend your ActiveSupport logger with trendy colorschemes from the 90's!
Ruby
27
star
14

live-rust

Rust
27
star
15

haml-jekyll-extension

Jekyll extension to easly use HAML instead of plain HTML
Ruby
21
star
16

jamstack-cfp

Run your call for papers using JAMStack + GitHub Actions
Vue
20
star
17

simple_currency

A really simple currency converter using XavierMedia API. Compatible with Ruby 1.8, 1.9, JRuby 1.5.3 and Rubinius 1.1
Ruby
17
star
18

calbert

Catalan ALBERT (A Lite BERT for self-supervised learning of language representations)
Python
15
star
19

colorant

A small utility to get the colors of an image.
Ruby
15
star
20

bankr

A bank accoount data gathering gem
Ruby
14
star
21

sass-images

Sass extensions to deal with images
Ruby
14
star
22

cheezburger

BDD for lolcats!
Ruby
13
star
23

guard-spinach

Guard-spinach is a guard plugin for spinach
Ruby
13
star
24

dialog-example

Repository with Angular project to show how we use Dialogs and Templates at Empresaula
TypeScript
11
star
25

rpg

RPG game to learn Ruby.
Ruby
9
star
26

dotfiles

Dotfiles used by Codegram team!
Emacs Lisp
8
star
27

spinach-rails-demo

Ruby
8
star
28

vim-todo

Easy peasy TODO list manager for VIM!
Vim Script
8
star
29

acts_as_decimal

Rails 3 plugin to store decimal numbers in the database as integers.
Ruby
7
star
30

pinky

[EXPERIMENTAL] Composable promises for Elixir.
Elixir
7
star
31

useful-github-workflows

Useful GitHub Workflows we use at Codegram
6
star
32

trace

Trace Ruby method calls inside a block of code
Ruby
6
star
33

urania.ex

Efficient and elegant data access for Elixir
Elixir
6
star
34

robinhood

Robin hood leverages celluloid actors to distribute long-lived processes across multiple servers using redis as a locking mechanism.
Ruby
6
star
35

timetable

Timetable is a tool to organize structured content (sections of a workshop, or due tasks), schedule it along time and let you know about current and next sections/tasks.
Ruby
6
star
36

tasca-spinach-demo

Simple todo application as a Spinach demo
Ruby
5
star
37

hypermodel

Rails Responder to generate an automagic JSON HAL representation for your models
Ruby
5
star
38

lastfm

A rather minimal Last.fm client for Ruby.
Ruby
5
star
39

talks

Monday Talks at Codegram
JavaScript
5
star
40

spex

Validate your Elixir values against value-based schemas
Elixir
5
star
41

status-notify-slack

A simple docker image to check if an application status is 200 OK
Shell
3
star
42

hey-mate

A Slack bot to recognize and reward your team's work πŸ§‰
Elixir
3
star
43

vim-haml2slim

A small VIm plugin that helps you convert your Haml views to Slim
Vim Script
3
star
44

phoenix_starter

Elixir
3
star
45

heroku-nginx-proxy

Herouk application that runs a proxy
HTML
3
star
46

dm-machinist

dm-machinist is a datamapper adapter for machinist 2.0
Ruby
3
star
47

course_scraper

A course scraper that gets all the vocational training courses in Catalonia and Spain.
Ruby
2
star
48

full_stack_bot

Full Stack Fest's amazing bot.
Elixir
2
star
49

spinach-sinatra-demo

Spinach working with sinatra
Ruby
2
star
50

deepspain

Deep Spain is a language model fine-tuned on the Spanish state's official bulletin documents
Python
2
star
51

webservice-clj

Example webservice in Clojure for a talk.
Clojure
2
star
52

decidim-barcelona-graphql-api

Simple GraphQL API for decidim.barcelona using Absinthe
Elixir
2
star
53

decidim-deploy-heroku

Opinionated Rails generator for `decidim` apps.
Ruby
2
star
54

decidim-monitor

A tool to monitor instances of decidim.
Elixir
2
star
55

serve-template

Ruby
2
star
56

spinach_helpers

Support helpers to include in Spinach
2
star
57

faye-websockets-heroku-test

Websockets test (a realtime auction app).
JavaScript
2
star
58

codegram.github.io

Codegram Blog
Clojure
2
star
59

gram

Gram is an internal administration tool for Codegram
Ruby
1
star
60

decidim-staging

Demo application to try Codegram's unreleased features of Decidim
HTML
1
star
61

rubocop-decidim

Rubocop custom cops for decidim/decidim
Ruby
1
star
62

spinach-presentation

Showoff presentation for Spinach
1
star
63

button_form

button_form replaces all <input type="submit"/> tags with <button/> in your forms
Ruby
1
star
64

sonic-client

Sonic Client for Elixir
Elixir
1
star
65

serverless-ruby-circleci

A CircleCI orb to build and deploy serverless ruby apps
1
star
66

nuxt-starter

JavaScript
1
star
67

full-stack-fest-sponsor-handbook

Full Stack Fest's sponsor handbook
CSS
1
star
68

wasm-tree

HTML
1
star
69

codeborg

A Hubot for Codegram
CoffeeScript
1
star
70

docker-images

A collection of useful docker images for development
Shell
1
star
71

elixir_starter

Elixir
1
star
72

rails-templates

Ruby
1
star
73

vim-numberlock

Map your numbers to their corresponding Shift+Number symbol for faster typing.
Vim Script
1
star
74

autility

Download utility invoices from some of the popular utility vendors in Spain (Endesa, Vodafone).
Ruby
1
star
75

decidim-electionguard

Python
1
star
76

globalize2_home_page_redirect-radiant-extension

self explanatory
Ruby
1
star
77

awesome-mixins

Awesome compass mixins
1
star
78

hackershout

Shout your hackerness to the world!
Ruby
1
star
79

sass-compass-exercises

Exercises for the sass-compass workshop
Ruby
1
star
80

confs-client

Client for Codegram Conferences
Ruby
1
star