Skip to content

Coding Standard

Philip Li edited this page Apr 17, 2023 · 2 revisions

We use shellcheck and rubocop to promise the basic consistency and quality of shell and ruby codes respectively. It is valuable to go through the docs to check out some good practices, and try.

Basic

$ cd path/to/lkp-tests
$ sudo -E gem install bundler
$ bundle install

Shellcheck

Getting started

$ sudo apt-get install shellcheck
$ shellcheck path/to/file
$ rake shellcheck # check all necessary files of the repo with warning or error severity

Reference

Rubocop

Getting started

$ rake rubocop
$ rake rubocop file="lib/**/*.rb" # check all rb files under lib
$ rake rubocop file=pattern/of/files # match arbitrary pattern

Reference

RSpec Test

Getting started

$ rake spec # check all unit tests status
$ rake spec spec=yaml # check spec/yaml_spec.rb status

Reference

Clone this wiki locally