Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add rubocop check to CI #315

Merged
merged 6 commits into from
Sep 18, 2020
Merged
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
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
inherit_from: .rubocop_todo.yml

Metrics/LineLength:
Max: 120

Style/StringLiterals:
Enabled: false
272 changes: 30 additions & 242 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,132 +1,25 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-09-09 23:09:21 UTC using RuboCop version 0.90.0.
# on 2020-09-18 20:20:54 UTC using RuboCop version 0.91.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.
Layout/BlockEndNewline:
Exclude:
- 'spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/ClosingParenthesisIndentation:
Exclude:
- 'examples/helpers/eventwebhook/example.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'lib/rack/sendgrid_webhook_verification.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLineAfterMagicComment:
Exclude:
- 'test/sendgrid/helpers/mail/test_attachment.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
Layout/EmptyLinesAroundClassBody:
Exclude:
- 'test/sendgrid/permissions/test_scopes.rb'

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
Layout/FirstArgumentIndentation:
Exclude:
- 'examples/helpers/eventwebhook/example.rb'
- 'spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Layout/FirstHashElementIndentation:
Exclude:
- 'spec/fixtures/event_webhook.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/HashAlignment:
Exclude:
- 'spec/fixtures/event_webhook.rb'

# Offense count: 27
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 381

# Offense count: 1
# Cop supports --auto-correct.
Layout/MultilineBlockLayout:
Exclude:
- 'spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Layout/SpaceAroundOperators:
Exclude:
- 'spec/fixtures/event_webhook.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceBeforeBlockBraces:
EnforcedStyle: space

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideBlockBraces:
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'examples/ips/ips.rb'
- 'lib/sendgrid/helpers/ip_management/ip_management.rb'
- 'sendgrid-ruby.gemspec'

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'examples/helpers/mail/example.rb'
- 'examples/mail/mail.rb'
- 'lib/sendgrid/helpers/permissions/scope.rb'
- 'spec/fixtures/event_webhook.rb'
- 'spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb'
- 'test/sendgrid/helpers/mail/test_attachment.rb'

# Offense count: 2
Lint/ImplicitStringConcatenation:
Exclude:
- 'test/sendgrid/helpers/mail/test_attachment.rb'

# Offense count: 16
# Offense count: 22
Lint/UselessAssignment:
Exclude:
- 'examples/scopes/scopes.rb'
- 'spec/rack/sendgrid_webhook_verification_spec.rb'

# Offense count: 4
# Offense count: 8
# Configuration parameters: IgnoredMethods.
Metrics/AbcSize:
Max: 144
Expand All @@ -137,29 +30,37 @@ Metrics/AbcSize:
Metrics/BlockLength:
Max: 96

# Offense count: 1
# Offense count: 3
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 123
Max: 2006

# Offense count: 14
# Offense count: 41
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
Metrics/MethodLength:
Max: 83
Max: 141

# Offense count: 1
# Offense count: 2
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 6
Max: 7

# Offense count: 3
# Offense count: 4
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'gemfiles/Sinatra_1.gemfile'
- 'gemfiles/Sinatra_2.gemfile'
- 'lib/sendgrid-ruby.rb'
- 'test/sendgrid/test_sendgrid-ruby.rb'

# Offense count: 1
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/sendgrid/helpers/mail/personalization.rb'

# Offense count: 1
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
Expand All @@ -172,50 +73,9 @@ Naming/PredicateName:
- 'spec/**/*'
- 'examples/helpers/eventwebhook/example.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# IgnoredMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb'

# Offense count: 14
# Offense count: 35
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/sendgrid/helpers/inbound/app.rb'
- 'lib/sendgrid/helpers/ip_management/ip_management.rb'
- 'lib/sendgrid/helpers/mail/category.rb'
- 'lib/sendgrid/helpers/permissions/scope.rb'
- 'lib/sendgrid/helpers/settings/mail_settings_dto.rb'
- 'lib/sendgrid/helpers/settings/partner_settings_dto.rb'
- 'lib/sendgrid/helpers/settings/settings.rb'
- 'lib/sendgrid/helpers/settings/tracking_settings_dto.rb'
- 'lib/sendgrid/helpers/settings/user_settings_dto.rb'
- 'lib/sendgrid/helpers/stats/email_stats.rb'
- 'lib/sendgrid/helpers/stats/metrics.rb'
- 'lib/sendgrid/helpers/stats/stats_response.rb'
- 'lib/sendgrid/sendgrid.rb'
- 'lib/sendgrid/twilio_email.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'test/sendgrid/helpers/mail/test_attachment.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/Encoding:
Exclude:
- 'test/sendgrid/helpers/mail/test_attachment.rb'
Enabled: false

# Offense count: 4
# Configuration parameters: EnforcedStyle.
Expand All @@ -224,98 +84,26 @@ Style/FormatStringToken:
Exclude:
- 'examples/emailactivity/emailactivity.rb'

# Offense count: 72
# Offense count: 97
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 2
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/rack/sendgrid_webhook_verification.rb'
- 'lib/sendgrid/helpers/eventwebhook/eventwebhook.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'lib/sendgrid/helpers/eventwebhook/eventwebhook.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
Style/MethodCallWithoutArgsParentheses:
Exclude:
- 'examples/emailactivity/emailactivity.rb'

# Offense count: 5
# Offense count: 6
Style/MixinUsage:
Exclude:
- 'examples/helpers/eventwebhook/example.rb'
- 'examples/helpers/mail/example.rb'
- 'examples/helpers/settings/example.rb'
- 'examples/helpers/stats/example.rb'
- 'test/sendgrid/helpers/mail/test_attachment.rb'
- 'test/sendgrid/helpers/mail/test_mail.rb'

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Style/MutableConstant:
Exclude:
- 'lib/sendgrid/helpers/eventwebhook/eventwebhook.rb'
- 'spec/fixtures/event_webhook.rb'

# Offense count: 2
# Cop supports --auto-correct.
Style/OrAssignment:
Exclude:
- 'lib/sendgrid/sendgrid.rb'
- 'lib/sendgrid/twilio_email.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantCondition:
Exclude:
- 'lib/sendgrid/base_interface.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Exclude:
- 'lib/rack/sendgrid_webhook_verification.rb'

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'spec/rack/sendgrid_webhook_verification_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Exclude:
- 'lib/sendgrid/helpers/eventwebhook/eventwebhook.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInHashLiteral:
Exclude:
- 'spec/fixtures/event_webhook.rb'

# Offense count: 27
# Offense count: 55
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 381
Max: 3211
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ All notable changes to this project will be documented in this file.

## [5.2.0] - 2017-10-30 ##
### Added
- PR #234: Helpers for email statistics - global, category, subuser
- PR #234: Helpers for email statistics - global, category, subuser
- Thanks to [Awin Abi](https://github.com/awinabi) for the pull request!

## [5.1.0] - 2017-9-1 ##
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ Please run your code through:
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/sendgrid/sendgrid-ruby

# Navigate to the newly cloned directory
cd sendgrid-ruby

# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/sendgrid/sendgrid-ruby
```
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ install:

test:
bundle exec rake
rubocop

test-integ: test

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Twilio SendGrid Logo](twilio_sendgrid_logo.png)

[![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=main)](https://travis-ci.org/sendgrid/sendgrid-ruby)
[![Travis Badge](https://travis-ci.org/sendgrid/sendgrid-ruby.svg?branch=main)](https://travis-ci.org/sendgrid/sendgrid-ruby)
[![Gem Version](https://badge.fury.io/rb/sendgrid-ruby.svg)](https://badge.fury.io/rb/sendgrid-ruby)
[![Email Notifications Badge](https://dx.sendgrid.com/badge/ruby)](https://dx.sendgrid.com/newsletter/ruby)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ end

RSpec::Core::RakeTask.new(:spec)

desc "Run tests"
desc 'Run tests'
task default: %i[spec test]
Loading