Skip to content

Instantly share code, notes, and snippets.

@colindensem
Created September 9, 2021 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colindensem/8e9b64994bafc00d41cb99cef0d5c51d to your computer and use it in GitHub Desktop.
Save colindensem/8e9b64994bafc00d41cb99cef0d5c51d to your computer and use it in GitHub Desktop.
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