Skip to content

Commit

Permalink
Merge pull request #9 from roseliux/install-rubocop
Browse files Browse the repository at this point in the history
Install rubocop
  • Loading branch information
VictorSNA authored Oct 20, 2021
2 parents 2df9422 + f170cb3 commit 6d832d8
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
AllCops:
Exclude:
- 'heartcheck-newrelic.gemspec'

Style/Documentation:
Enabled: false

Naming/RescuedExceptionsVariableName:
Enabled: false
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

Expand Down
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'heartcheck/newrelic'
Expand Down
13 changes: 7 additions & 6 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)

require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

load Gem.bin_path("rspec-core", "rspec")
load Gem.bin_path('rspec-core', 'rspec')
1 change: 1 addition & 0 deletions heartcheck-newrelic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'

spec.required_ruby_version = '>= 2.3'
end
4 changes: 3 additions & 1 deletion lib/heartcheck/checks/newrelic.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# frozen_string_literal: true

module Heartcheck
module Checks
class Newrelic < Base
def validate
NewRelic::Agent.increment_metric('Custom/NewRelicMonitoring')
rescue => e
rescue StandardError => e
append_error('could not report to New Relic server.')
append_error(e.message)
end
Expand Down
2 changes: 2 additions & 0 deletions lib/heartcheck/newrelic.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'newrelic_rpm'
require 'heartcheck'
require 'heartcheck/checks/newrelic'
4 changes: 3 additions & 1 deletion lib/heartcheck/newrelic/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

module Heartcheck
module Newrelic
VERSION = '0.2.0'.freeze
VERSION = '0.2.0'
end
end
2 changes: 2 additions & 0 deletions spec/heartcheck/checks/newrelic_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

RSpec.describe Heartcheck::Checks::Newrelic do
describe '#validate' do
it 'does not record an error when everything is fine' do
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'heartcheck/newrelic'

RSpec.configure do |config|
Expand Down

0 comments on commit 6d832d8

Please sign in to comment.