-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from jamesstonehill/add-rubocop
Add Rubocop
- Loading branch information
Showing
24 changed files
with
202 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
inherit_from: .rubocop_todo.yml | ||
|
||
AllCops: | ||
TargetRubyVersion: 2.3 | ||
Exclude: | ||
- 'vendor/**/*' | ||
- 'rails_*/**/*' | ||
|
||
Style/StringLiterals: | ||
EnforcedStyle: double_quotes | ||
|
||
Metrics/LineLength: | ||
Max: 100 | ||
|
||
Style/MethodCallWithoutArgsParentheses: | ||
Enabled: false | ||
|
||
Style/TrailingCommaInArrayLiteral: | ||
EnforcedStyleForMultiline: comma | ||
|
||
Style/TrailingCommaInHashLiteral: | ||
EnforcedStyleForMultiline: comma | ||
|
||
Metrics/BlockLength: | ||
Exclude: | ||
- 'spec/**/*.rb' | ||
- 'api_error_handler.gemspec' | ||
|
||
Style/Documentation: | ||
Enabled: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# This configuration was generated by | ||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100` | ||
# on 2019-08-25 13:23:25 +0100 using RuboCop version 0.74.0. | ||
# 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 | ||
# versions of RuboCop, may require this file to be generated again. | ||
|
||
# Offense count: 1 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: TreatCommentsAsGroupSeparators, Include. | ||
# Include: **/*.gemspec | ||
Gemspec/OrderedDependencies: | ||
Exclude: | ||
- 'api_error_handler.gemspec' | ||
|
||
# Offense count: 1 | ||
# Cop supports --auto-correct. | ||
Layout/ClosingParenthesisIndentation: | ||
Exclude: | ||
- 'spec/api_error_handler/serializers/xml_spec.rb' | ||
|
||
# Offense count: 2 | ||
# Configuration parameters: Max. | ||
Metrics/AbcSize: | ||
Exclude: | ||
- 'lib/api_error_handler.rb' | ||
- 'lib/api_error_handler/error_reporter.rb' | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: Max. | ||
Metrics/CyclomaticComplexity: | ||
Exclude: | ||
- 'lib/api_error_handler/error_reporter.rb' | ||
|
||
# Offense count: 3 | ||
# Configuration parameters: CountComments, Max, ExcludedMethods. | ||
Metrics/MethodLength: | ||
Exclude: | ||
- 'lib/api_error_handler.rb' | ||
- 'lib/api_error_handler/error_reporter.rb' | ||
- 'lib/api_error_handler/error_id_generator.rb' | ||
- 'lib/api_error_handler/serializers/json_api.rb' | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: Max. | ||
Metrics/PerceivedComplexity: | ||
Exclude: | ||
- 'lib/api_error_handler/error_reporter.rb' | ||
|
||
# Offense count: 2 | ||
# Cop supports --auto-correct. | ||
Style/ExpandPathArguments: | ||
Exclude: | ||
- 'api_error_handler.gemspec' | ||
|
||
# Offense count: 4 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyle. | ||
# SupportedStyles: implicit, explicit | ||
Style/RescueStandardError: | ||
Exclude: | ||
- 'lib/api_error_handler.rb' | ||
- 'spec/api_error_handler/serializers/json_api_spec.rb' | ||
- 'spec/api_error_handler/serializers/json_spec.rb' | ||
- 'spec/api_error_handler/serializers/xml_spec.rb' | ||
|
||
# Offense count: 2 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyleForMultiline. | ||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma | ||
Style/TrailingCommaInArrayLiteral: | ||
Exclude: | ||
- 'lib/api_error_handler/serializers/json_api.rb' | ||
- 'spec/api_error_handler/serializers/json_api_spec.rb' | ||
|
||
# Offense count: 3 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyleForMultiline. | ||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma | ||
Style/TrailingCommaInHashLiteral: | ||
Exclude: | ||
- 'lib/api_error_handler.rb' | ||
- 'lib/api_error_handler/serializers/json.rb' | ||
- 'lib/api_error_handler/serializers/json_api.rb' |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
task default: :spec |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
lib = File.expand_path("../lib", __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
|
@@ -8,16 +9,26 @@ Gem::Specification.new do |spec| | |
spec.version = ApiErrorHandler::VERSION | ||
spec.authors = ["James Stonehill"] | ||
spec.email = ["[email protected]"] | ||
spec.required_ruby_version = '~> 2.3' | ||
spec.required_ruby_version = "~> 2.3" | ||
|
||
spec.summary = <<~SUMMARY | ||
A gem that helps you easily handle exceptions in your Rails API and return | ||
informative responses to the client. | ||
SUMMARY | ||
|
||
spec.description = <<~DESCRIPTION | ||
A gem that helps you easily handle exceptions in your Ruby on Rails API and | ||
return informative responses to the client by serializing exceptions into JSON | ||
and other popular API formats and returning a response with a status code that | ||
makes sense based on the exception. | ||
DESCRIPTION | ||
|
||
spec.summary = %q{A gem that helps you easily handle exceptions in your Rails API and return informative responses to the client.} | ||
spec.description = %q{A gem that helps you easily handle exceptions in your Ruby on Rails API and return informative responses to the client by serializing exceptions into JSON and other popular API formats and returning a response with a status code that makes sense based on the exception.} | ||
spec.homepage = "https://github.com/jamesstonehill/api_error_handler" | ||
spec.license = "MIT" | ||
|
||
# Specify which files should be added to the gem when it is released. | ||
# The `git ls-files -z` loads the files in the RubyGem that have been added into git. | ||
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do | ||
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do | ||
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|rails_.+)/}) } | ||
end | ||
spec.bindir = "exe" | ||
|
@@ -31,4 +42,5 @@ Gem::Specification.new do |spec| | |
spec.add_development_dependency "bundler", "~> 2.0" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
spec.add_development_dependency "rspec-rails", "~> 3.0" | ||
spec.add_development_dependency "rubocop", "~> 0.74.0" | ||
end |
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
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 "api_error_handler" | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module ApiErrorHandler | ||
class Error < StandardError; end | ||
|
||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module ApiErrorHandler | ||
VERSION = "0.1.0" | ||
end |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/setup" | ||
require "api_error_handler" | ||
|
||
|