Code quality tools (#147)
This commit is contained in:
parent
5966bd69ec
commit
d83c20c524
|
@ -6,7 +6,7 @@ version: 2
|
||||||
jobs:
|
jobs:
|
||||||
"ruby-2.3":
|
"ruby-2.3":
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/ruby:2.3.7
|
- image: hanami/ruby-2.3
|
||||||
working_directory: ~/hanami-utils
|
working_directory: ~/hanami-utils
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
@ -31,7 +31,7 @@ jobs:
|
||||||
./script/ci
|
./script/ci
|
||||||
"ruby-2.4":
|
"ruby-2.4":
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/ruby:2.4.4
|
- image: hanami/ruby-2.4
|
||||||
working_directory: ~/hanami-utils
|
working_directory: ~/hanami-utils
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
@ -56,7 +56,7 @@ jobs:
|
||||||
./script/ci
|
./script/ci
|
||||||
"ruby-2.5":
|
"ruby-2.5":
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/ruby:2.5.1
|
- image: hanami/ruby-2.5
|
||||||
working_directory: ~/hanami-utils
|
working_directory: ~/hanami-utils
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
@ -81,7 +81,7 @@ jobs:
|
||||||
./script/ci
|
./script/ci
|
||||||
"jruby-9.1":
|
"jruby-9.1":
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/jruby:9.1-jdk
|
- image: hanami/jruby-9.1
|
||||||
working_directory: ~/hanami-utils
|
working_directory: ~/hanami-utils
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
@ -106,7 +106,7 @@ jobs:
|
||||||
./script/ci
|
./script/ci
|
||||||
"jruby-9.2":
|
"jruby-9.2":
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/jruby:9.2.0.0
|
- image: hanami/jruby-9.2
|
||||||
working_directory: ~/hanami-utils
|
working_directory: ~/hanami-utils
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
3
Gemfile
3
Gemfile
|
@ -1,7 +1,7 @@
|
||||||
source 'http://rubygems.org'
|
source 'http://rubygems.org'
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
unless ENV['TRAVIS']
|
unless ENV['CI']
|
||||||
gem 'byebug', require: false, platforms: :mri
|
gem 'byebug', require: false, platforms: :mri
|
||||||
gem 'yard', require: false
|
gem 'yard', require: false
|
||||||
end
|
end
|
||||||
|
@ -10,4 +10,3 @@ gem 'hanami-utils', '~> 1.2', require: false, git: 'https://github.com/hanami/ut
|
||||||
|
|
||||||
gem 'hanami-devtools', require: false, git: 'https://github.com/hanami/devtools.git'
|
gem 'hanami-devtools', require: false, git: 'https://github.com/hanami/devtools.git'
|
||||||
gem 'i18n', '~> 0.7', require: false
|
gem 'i18n', '~> 0.7', require: false
|
||||||
gem 'coveralls', require: false
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -4,11 +4,11 @@ Validations mixin for Ruby objects
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
[![Gem Version](http://img.shields.io/gem/v/hanami-validations.svg)](https://badge.fury.io/rb/hanami-validations)
|
[![Gem Version](https://badge.fury.io/rb/hanami-validations.svg)](https://badge.fury.io/rb/hanami-validations)
|
||||||
[![Build Status](http://img.shields.io/travis/hanami/validations/master.svg)](https://travis-ci.org/hanami/validations?branch=master)
|
[![TravisCI](https://travis-ci.org/hanami/validations.svg?branch=master)](https://travis-ci.org/hanami/validations)
|
||||||
[![Coverage](http://img.shields.io/coveralls/hanami/validations/master.svg)](https://coveralls.io/r/hanami/validations)
|
[![CircleCI](https://circleci.com/gh/hanami/validations/tree/master.svg?style=svg)](https://circleci.com/gh/hanami/validations/tree/master)
|
||||||
[![Code Climate](http://img.shields.io/codeclimate/github/hanami/validations.svg)](https://codeclimate.com/github/hanami/validations)
|
[![Test Coverage](https://codecov.io/gh/hanami/validations/branch/master/graph/badge.svg)](https://codecov.io/gh/hanami/validations)
|
||||||
[![Dependencies](http://img.shields.io/gemnasium/hanami/validations.svg)](https://gemnasium.com/hanami/validations)
|
[![Depfu](https://badges.depfu.com/badges/a8545fb67cf32a2c75b6227bc0821027/overview.svg)](https://depfu.com/github/hanami/validations?project=Bundler)
|
||||||
[![Inline Docs](http://inch-ci.org/github/hanami/validations.svg)](http://inch-ci.org/github/hanami/validations)
|
[![Inline Docs](http://inch-ci.org/github/hanami/validations.svg)](http://inch-ci.org/github/hanami/validations)
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
6
Rakefile
6
Rakefile
|
@ -1,6 +1,7 @@
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'bundler/gem_tasks'
|
require 'bundler/gem_tasks'
|
||||||
require 'rspec/core/rake_task'
|
require 'rspec/core/rake_task'
|
||||||
|
require 'hanami/devtools/rake_tasks'
|
||||||
|
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
Rake::TestTask.new do |t|
|
Rake::TestTask.new do |t|
|
||||||
|
@ -15,11 +16,6 @@ namespace :spec do
|
||||||
|
|
||||||
task.pattern = file_list
|
task.pattern = file_list
|
||||||
end
|
end
|
||||||
|
|
||||||
task :coverage do
|
|
||||||
ENV['COVERAGE'] = 'true'
|
|
||||||
Rake::Task['spec:unit'].invoke
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
task default: 'spec:unit'
|
task default: 'spec:unit'
|
||||||
|
|
24
script/ci
24
script/ci
|
@ -2,12 +2,23 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
prepare_build() {
|
||||||
|
if [ -d coverage ]; then
|
||||||
|
rm -rf coverage
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
print_ruby_version() {
|
||||||
|
echo "Using $(ruby -v)"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
run_code_quality_checks() {
|
run_code_quality_checks() {
|
||||||
bundle exec rubocop .
|
bundle exec rubocop .
|
||||||
}
|
}
|
||||||
|
|
||||||
run_unit_tests() {
|
run_unit_tests() {
|
||||||
bundle exec rake spec:coverage
|
bundle exec rake spec:unit
|
||||||
}
|
}
|
||||||
|
|
||||||
run_isolation_tests() {
|
run_isolation_tests() {
|
||||||
|
@ -42,10 +53,17 @@ run_test() {
|
||||||
COVERAGE=true bundle exec rspec $test
|
COVERAGE=true bundle exec rspec $test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upload_code_coverage() {
|
||||||
|
bundle exec rake codecov:upload
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
run_code_quality_checks &&
|
prepare_build &&
|
||||||
|
print_ruby_version &&
|
||||||
|
run_code_quality_checks &&
|
||||||
run_unit_tests &&
|
run_unit_tests &&
|
||||||
run_isolation_tests
|
run_isolation_tests &&
|
||||||
|
upload_code_coverage
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
|
@ -1,36 +1,8 @@
|
||||||
if ENV['COVERALL']
|
$LOAD_PATH.unshift "lib"
|
||||||
require 'coveralls'
|
require "hanami/utils"
|
||||||
Coveralls.wear!
|
require "hanami/devtools/unit"
|
||||||
end
|
require "hanami/validations"
|
||||||
|
require "hanami/validations/form"
|
||||||
RSpec.configure do |config|
|
|
||||||
config.expect_with :rspec do |expectations|
|
|
||||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
||||||
end
|
|
||||||
|
|
||||||
config.mock_with :rspec do |mocks|
|
|
||||||
mocks.verify_partial_doubles = true
|
|
||||||
end
|
|
||||||
|
|
||||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
||||||
|
|
||||||
config.filter_run_when_matching :focus
|
|
||||||
config.disable_monkey_patching!
|
|
||||||
|
|
||||||
config.warnings = true
|
|
||||||
|
|
||||||
config.default_formatter = 'doc' if config.files_to_run.one?
|
|
||||||
|
|
||||||
config.profile_examples = 10
|
|
||||||
|
|
||||||
config.order = :random
|
|
||||||
Kernel.srand config.seed
|
|
||||||
end
|
|
||||||
|
|
||||||
$LOAD_PATH.unshift 'lib'
|
|
||||||
require 'hanami/utils'
|
|
||||||
require 'hanami/validations'
|
|
||||||
require 'hanami/validations/form'
|
|
||||||
|
|
||||||
Hanami::Utils.require!("spec/support")
|
Hanami::Utils.require!("spec/support")
|
||||||
Hanami::Utils.require!("spec/shared")
|
Hanami::Utils.require!("spec/shared")
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.expect_with :rspec do |expectations|
|
||||||
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||||
|
end
|
||||||
|
|
||||||
|
config.mock_with :rspec do |mocks|
|
||||||
|
mocks.verify_partial_doubles = true
|
||||||
|
end
|
||||||
|
|
||||||
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||||
|
|
||||||
|
config.filter_run_when_matching :focus
|
||||||
|
config.disable_monkey_patching!
|
||||||
|
|
||||||
|
config.warnings = true
|
||||||
|
|
||||||
|
config.default_formatter = "doc" if config.files_to_run.one?
|
||||||
|
|
||||||
|
config.profile_examples = 10
|
||||||
|
|
||||||
|
config.order = :random
|
||||||
|
Kernel.srand config.seed
|
||||||
|
end
|
Loading…
Reference in New Issue