Skip to content

codica2/clean-code-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Linters configuration

Why we use linters?

Lint is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. So we don't need to spend time for code syntax checking, linters can do it for us.

Linters libraries

Rubocop

Rubocop is a Ruby static code analyzer and formatter, based on the Ruby community style guide.

RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various configuration options.

Installation

gem install rubocop

If you'd rather install RuboCop using bundler, don't require it in your Gemfile:

gem 'rubocop', require: false

Rubocop config example

Es Lint

ES-lint is a fully pluggable tool for identifying and reporting on patterns in JavaScript

Installation

If you want to include ESLint as part of your project's build system, we recommend installing it locally. You can do so using npm:

npm install eslint --save-dev

You should then set up a configuration file:

$ ./node_modules/.bin/eslint --init

After that, you can run ESLint on any file or directory like this:

./node_modules/.bin/eslint yourfile.js

SCSS-lint

SCSS-lint is a configurable tool for writing clean and consistent SCSS

Installation

Add to your Gemfile:

gem 'scss_lint'

After that, you can run SCSS-lint on any file or directory like this:

scss-lint app/assets/stylesheets/

or

scss-lint app/assets/stylesheets/**/*.css.scss

SCSS-lint config example

Slim-lint

Slim-lint is a configurable tool for analyzing Slim templates

Installation

Add to your Gemfile:

gem 'slim_lint'

Run slim-lint from the command line by passing in a directory (or multiple directories) to recursively scan:

slim-lint app/views/

Slim-lint config example

Overcommit

Overcommit is a fully configurable and extendable Git hook manager.

Installation

Overcommit is installed via RubyGems. It is strongly recommended that your environment supports running gem install without requiring sudo privileges. Using a Ruby version manager like rbenv or rvm can help here.

gem install overcommit

You can then run the overcommit command to install hooks into repositories.

mkdir important-project
cd important-project
git init
overcommit --install

Overcommit config example

License

Copyright © 2015-2019 Codica. It is released under the MIT License.

About Codica

Codica logo

We love open source software! See our other projects or hire us to design, develop, and grow your product.

About

How we configure linters for Ruby on Rails projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published