Skip to content
Draft
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
19 changes: 10 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 999 --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 0.93.1.
# using RuboCop version 1.9.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -57,22 +57,18 @@ Lint/UselessAssignment:
- 'spec/lib/openc_bot/incrementers/common_spec.rb'
- 'spec/schemas/company-schema_spec.rb'

# Configuration parameters: IgnoredMethods.
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 33

# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 13

# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 27

# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 6

# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 14
Expand All @@ -87,8 +83,9 @@ Naming/FileName:
Exclude:
- 'spec/schemas/company-schema_spec.rb'

# Configuration parameters: EnforcedStyle.
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
Naming/VariableNumber:
Exclude:
- 'spec/schemas/company-schema_spec.rb'
Expand Down Expand Up @@ -131,7 +128,8 @@ RSpec/ExpectInHook:
Exclude:
- 'spec/lib/openc_bot/helpers/register_methods_spec.rb'

# Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'lib/openc_bot/templates/spec/bot_spec.rb'
Expand Down Expand Up @@ -186,6 +184,7 @@ Security/Open:
- 'lib/openc_bot/helpers/alpha_search.rb'

# Configuration parameters: AllowedChars.
# AllowedChars: ©
Style/AsciiComments:
Exclude:
- 'lib/openc_bot/templates/lib/company_fetcher_bot.rb'
Expand Down Expand Up @@ -220,6 +219,7 @@ Style/Documentation:
- 'lib/openc_bot/templates/lib/bot.rb'
- 'lib/openc_bot/templates/lib/company_fetcher_bot.rb'

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: allowed_in_returns, forbidden
Style/DoubleNegation:
Expand All @@ -236,6 +236,7 @@ Style/GuardClause:
Exclude:
- 'lib/openc_bot/helpers/register_methods.rb'

# Cop supports --auto-correct.
# Configuration parameters: AllowIfModifier.
Style/IfInsideElse:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ before_install:
- gem i rubygems-update -v '<3' && update_rubygems
- gem install bundler -v 1.17.3
- rm Gemfile.lock
- bundle _1.17.3_ install
before_script:
- bin/rubocop
- bin/rubocop --auto-gen-config --exclude-limit 999 --no-offense-counts --no-auto-gen-timestamp >/dev/null || true; git --no-pager diff --exit-code
132 changes: 68 additions & 64 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,111 +8,115 @@ GIT
PATH
remote: .
specs:
openc_bot (0.0.82)
activesupport (~> 4.1)
backports (~> 3.11)
httpclient (~> 2.8)
json (~> 2.1)
json-schema (~> 2.8)
mail (~> 2.0)
nokogiri (~> 1.8)
rake (~> 12.3)
resque (~> 2.0)
retriable (~> 2.1)
scraperwiki (= 3.0.2)
sqlite_magic (= 0.0.6)
statsd-instrument (~> 1.7)
tzinfo (~> 1.2)
openc_bot (0.0.83)
activesupport
backports
httpclient
json
json-schema
mail
nokogiri (~> 1.11.1)
rake
resque
retriable
scraperwiki
sqlite_magic
statsd-instrument
tzinfo

GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
activesupport (6.1.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.1)
backports (3.18.2)
byebug (10.0.2)
ast (2.4.2)
backports (3.20.2)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
crack (0.4.4)
concurrent-ruby (1.1.8)
crack (0.4.5)
rexml
diff-lcs (1.4.4)
hashdiff (1.0.1)
httpclient (2.8.3)
i18n (0.9.5)
i18n (1.8.8)
concurrent-ruby (~> 1.0)
json (2.3.1)
json (2.5.1)
json-schema (2.8.1)
addressable (>= 2.4)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (1.0.0)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.2)
mini_portile2 (2.5.0)
minitest (5.14.3)
mono_logger (1.1.0)
multi_json (1.15.0)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
parallel (1.20.1)
parser (2.7.2.0)
parser (3.0.0.0)
ast (~> 2.4.1)
pry (0.13.1)
pry (0.14.0)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
racc (1.5.2)
rack (2.2.3)
rack-protection (2.1.0)
rack
rainbow (3.0.0)
rake (12.3.3)
rake (13.0.3)
redis (4.2.5)
redis-namespace (1.8.0)
redis-namespace (1.8.1)
redis (>= 3.0.4)
regexp_parser (2.0.0)
regexp_parser (2.0.3)
resque (2.0.0)
mono_logger (~> 1.0)
multi_json (~> 1.0)
redis-namespace (~> 1.6)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
retriable (2.1.0)
retriable (3.1.2)
rexml (3.2.4)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (0.93.1)
rspec-support (3.10.2)
rubocop (1.9.1)
parallel (~> 1.10)
parser (>= 2.7.1.5)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 0.6.0)
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.3.0)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-rspec (1.44.1)
rubocop (~> 0.87)
rubocop-ast (>= 0.7.1)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
rubocop-rspec (2.2.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.4)
scraperwiki (3.0.2)
httpclient
sqlite_magic
Expand All @@ -122,31 +126,31 @@ GEM
rack-protection (= 2.1.0)
tilt (~> 2.0)
sqlite3 (1.4.2)
statsd-instrument (1.7.2)
thread_safe (0.3.6)
statsd-instrument (3.0.2)
tilt (2.0.10)
tzinfo (1.2.8)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
vegas (0.1.11)
rack (>= 1.0.0)
webmock (1.24.6)
webmock (3.11.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
hashdiff (>= 0.4.0, < 2.0.0)
zeitwerk (2.4.2)

PLATFORMS
ruby

DEPENDENCIES
byebug (~> 10.0)
byebug
openc_bot!
pry
rspec (~> 3.8)
rubocop (~> 0.93.1)
rubocop-rspec (~> 1.30)
rspec
rubocop
rubocop-rspec
sqlite_magic!
webmock (~> 1.20)
webmock

BUNDLED WITH
1.17.3
3 changes: 2 additions & 1 deletion lib/monkey_patches/mechanize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Mechanize::HTTP::Agent
# be retried once, but I am going to let it retry a few times
# (MAX_RESET_RETRIES), just in case.
#
# rubocop:disable Metrics/ParameterLists
def fetch_with_retry(
uri,
method = :get,
Expand Down Expand Up @@ -47,7 +48,7 @@ def fetch_with_retry(
retry
end
end

# rubocop:enable Metrics/ParameterLists
# Alias so #fetch actually uses our new #fetch_with_retry to wrap the
# old one aliased as #fetch_without_retry.
alias fetch_without_retry fetch
Expand Down
11 changes: 7 additions & 4 deletions lib/openc_bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@

module OpencBot
class OpencBotError < StandardError; end

class DatabaseError < OpencBotError; end

class InvalidDataError < OpencBotError; end

class NotFoundError < OpencBotError; end

include ScraperWiki
Expand Down Expand Up @@ -81,10 +84,10 @@ def self.extended(_obj)

def statsd_namespace
@statsd_namespace ||= begin
bot_env = ENV.fetch("FETCHER_BOT_ENV", "development").to_sym
StatsD.mode = bot_env
StatsD.server = "sys1:8125"
StatsD.logger = Logger.new("/dev/null") if bot_env != :production
bot_env = ENV.fetch("FETCHER_BOT_ENV", "development").to_s
ENV["STATSD_ENV"] = bot_env
ENV["STATSD_ADDR"] = "sys1:8125"
StatsD.logger = Logger.new("/dev/null") if bot_env != "production"

if respond_to?(:inferred_jurisdiction_code) && inferred_jurisdiction_code
"fetcher_bot.#{bot_env}.#{inferred_jurisdiction_code}"
Expand Down
2 changes: 2 additions & 0 deletions lib/openc_bot/templates/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

require "rspec/autorun"

# rubocop:disable Lint/EmptyBlock
RSpec.configure do |config|
end
# rubocop:enable Lint/EmptyBlock

# Utility method to allow sample html pages, csv files, json or whatever.
# Expects the files to be stored in a 'dummy_responses' folder in the spec directory
Expand Down
2 changes: 1 addition & 1 deletion lib/openc_bot/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module OpencBot
VERSION = "0.0.82"
VERSION = "0.0.83"
end
Loading