Created
September 9, 2021 14:16
-
-
Save colindensem/8e9b64994bafc00d41cb99cef0d5c51d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
RSpec.describe "Check we pass codeclimate" do | |
before do | |
current_sha = "master..HEAD" | |
@files = `git diff-tree --no-commit-id --name-only -r #{current_sha}` | |
@files.tr!("\n", " ") | |
ignore_files(@files) | |
end | |
it "passes CodeClimate on modified files" do | |
if @files.empty? | |
puts "CodeClimate not performed. No files changed." | |
else | |
puts "Running Codeclimate for changed files: #{@files}" | |
result = system "codeclimate analyze #{@files}" | |
expect(result).to be(true) | |
end | |
end | |
def ignore_files(files) | |
files.slice!("db/schema.rb") | |
files | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment