Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable codeclimate and refactor rubocop config #66

Merged
merged 4 commits into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,18 @@ jobs:
curl -H "Content-type:application/octet-stream" --data-binary @solr_hyrax_config.zip "http://localhost:8985/solr/admin/configs?action=UPLOAD&name=hyrax"
curl -H 'Content-type: application/json' http://localhost:8985/api/collections/ -d '{create: {name: hydra-test, config: hyrax, numShards: 1}}'

- run:
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build

- run:
name: Run rspec
command: |
mkdir /tmp/test-results
bundle exec rake spec
COVERAGE=true bundle exec rake spec
./cc-test-reporter after-build -t simplecov --exit-code $?

- run:
name: Clean dependencies
Expand Down
32 changes: 32 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
prepare:
fetch:
- url: "https://raw.githubusercontent.com/samvera-labs/bixby/master/bixby_default.yml"
path: "bixby_default.yml"
- url: "https://raw.githubusercontent.com/samvera-labs/bixby/master/bixby_rails_enabled.yml"
path: "bixby_rails_enabled.yml"
- url: "https://raw.githubusercontent.com/samvera-labs/bixby/master/bixby_rspec_enabled.yml"
path: "bixby_rspec_enabled.yml"
engines:
brakeman:
enabled: true
duplication:
enabled: false
rubocop:
enabled: true
channel: rubocop-0-50
config:
file: .rubocop.cc.yml
ratings:
paths:
- Gemfile.lock
- "**.erb"
- "**.rb"
- "**.js"
- "**.es6"
- "**.coffee"
- "**.rake"
- "**.scss"
exclude_paths:
- config/
- vendor/
7 changes: 7 additions & 0 deletions .rubocop.cc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inherit_from:
- bixby_default.yml
- .rubocop.exceptions.yml

AllCops:
TargetRubyVersion: 2.3
DisplayCopNames: true
23 changes: 23 additions & 0 deletions .rubocop.exceptions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Naming/FileName:
Exclude:
- 'Gemfile'
- 'hyrax-batch_ingest.gemspec'

Bundler/DuplicatedGem:
Exclude:
- 'Gemfile'

RSpec/ExampleLength:
Exclude:
- 'spec/lib/hyrax/batch_ingest/routing/batch_item_routes_spec.rb'

Metrics/BlockLength:
Exclude:
- 'spec/**/*_spec.rb'

RSpec/DescribeClass:
Exclude:
- 'spec/services/batch_runner_spec.rb'

Style/RaiseArgs:
Enabled: false
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
inherit_gem:
bixby: bixby_default.yml

inherit_from:
- .rubocop.exceptions.yml

AllCops:
TargetRubyVersion: 2.3
DisplayCopNames: true
Expand Down
15 changes: 10 additions & 5 deletions hyrax-batch_ingest.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ Gem::Specification.new do |s|

s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]

s.add_dependency "rails", "~> 5.1.6"
s.add_dependency "hyrax", "~> 2.2"
s.add_dependency 'rails', '~> 5.1.6'
s.add_dependency 'hyrax', '~> 2.2'

s.add_development_dependency 'bixby'
s.add_development_dependency 'capybara'
s.add_development_dependency 'codeclimate-test-reporter'
s.add_development_dependency 'coffee-rails'
s.add_development_dependency "factory_bot_rails", "~> 4.11"
s.add_development_dependency 'factory_bot_rails', '~> 4.11'
s.add_development_dependency 'fcrepo_wrapper'
s.add_development_dependency "sqlite3"
s.add_development_dependency "rspec-rails", "~> 3.8"
s.add_development_dependency 'rspec-rails', '~> 3.8'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'solr_wrapper'
s.add_development_dependency 'sqlite3'

# Pinned dependencies
s.add_development_dependency 'sass', '=3.6.0'
end
11 changes: 11 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'

if ENV['COVERAGE']
require 'simplecov'
require 'codeclimate-test-reporter'

SimpleCov.start('rails') do
add_filter '/spec'
end
SimpleCov.command_name 'spec'
end

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../.internal_test_app/config/environment', __FILE__)
# Prevent database truncation if the environment is production
Expand Down