mirror of
https://github.com/ms-ati/docile
synced 2023-03-27 23:21:52 -04:00
25114d0c1d
This should finally allow us to adopt code style lints, as well as others such as performance linting, and have them enforced by the Github Actions continuous integration (CI) jobs. For now, I'm choosing to depend on the 'panolint' gem from Panorama Education, which is my current workplace, as I'd like to adopt and stay consistent with the setting used there. Changes * Move development and test dependencies from gemspec to Gemfile * Add dependency on 'panolint' gem * Add .rubocop.yml * Fix all existing issues * Run rubocop in github actions CI
30 lines
991 B
Ruby
30 lines
991 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Code coverage (via SimpleCov)
|
|
require "simplecov"
|
|
|
|
SimpleCov.start do
|
|
add_filter "/spec/" # exclude test code
|
|
add_filter "/vendor/" # exclude gems which are cached in CI
|
|
end
|
|
|
|
# On CI we publish coverage to codecov.io
|
|
# To use the codecov action, we need to generate XML based coverage report
|
|
if ENV["CI"] == "true"
|
|
begin
|
|
require "simplecov-cobertura"
|
|
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
|
rescue LoadError
|
|
warn "simplecov-cobertura gem not found - not generating XML for codecov.io"
|
|
end
|
|
end
|
|
|
|
# Due to circular dependency (SimpleCov depends on Docile), remove docile and
|
|
# then require the docile gem again below.
|
|
Object.send(:remove_const, :Docile)
|
|
$LOADED_FEATURES.reject! { |f| f.include?("/lib/docile") }
|
|
|
|
# Require Docile again, now with coverage enabled
|
|
lib_dir = File.join(File.dirname(File.dirname(__FILE__)), "lib")
|
|
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
|
|
require "docile"
|