Skip to content

Commit

Permalink
chore: support for rubocop linting on ruby-head (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunga1 authored Jan 18, 2022
1 parent 51cf877 commit c9a465a
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 28 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
strategy:
matrix:
ruby: [ 2.4, 2.5, 2.6, 2.7, '3.0', ruby-head, jruby-9.2 ]
continue-on-error: ${{ matrix.ruby == 'ruby-head' }}
steps:
- name: Checkout twilio-ruby
uses: actions/checkout@v2
Expand All @@ -29,8 +28,18 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

# Excludes incompatible versions of ruby
- name: Set up linter
run: bundle add rubocop --version "~> 1.24.1" --group "development" --skip-install
if: ${{ matrix.ruby != '2.4' }}

- run: bundle install --with development
- run: bundle exec rake install

- name: Run linter
run: bundle exec rubocop -d --cache true --parallel
if: ${{ matrix.ruby != '2.4' }}

- name: Run Unit Tests
run: make test

Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5
Exclude:
- 'lib/twilio-ruby/rest/**/*'
- 'spec/integration/**/*'
Expand Down
105 changes: 84 additions & 21 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-04-29 14:57:47 -0500 using RuboCop version 0.82.0.
# on 2022-01-13 21:45:15 UTC using RuboCop version 1.24.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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
# Include: **/*.gemspec
Gemspec/OrderedDependencies:
Exclude:
Expand All @@ -28,13 +28,6 @@ Layout/EmptyLineAfterGuardClause:
- 'lib/rack/twilio_webhook_authentication.rb'
- 'lib/twilio-ruby/framework/serialize.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
Layout/ExtraSpacing:
Exclude:
- 'twilio-ruby.gemspec'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
Expand All @@ -53,6 +46,24 @@ Layout/SpaceInsideHashLiteralBraces:
- 'spec/jwt/access_token_spec.rb'
- 'spec/jwt/client_capability_spec.rb'

# Offense count: 3
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/jwt/client_capability_spec.rb'
- 'spec/rest/client_spec.rb'

# Offense count: 1
Lint/MissingSuper:
Exclude:
- 'lib/twilio-ruby/framework/rest/error.rb'

# Offense count: 1
Lint/SelfAssignment:
Exclude:
- 'lib/twilio-ruby/framework/rest/version.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Expand All @@ -70,6 +81,7 @@ Lint/UnusedMethodArgument:
- 'spec/holodeck/holodeck.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
Expand All @@ -80,29 +92,43 @@ Lint/UselessAssignment:
Exclude:
- 'spec/rack/twilio_webhook_authentication_spec.rb'

# Offense count: 6
# Configuration parameters: Max, CountKeywordArgs.
Metrics/ParameterLists:
MaxOptionalParameters: 6

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# 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:
- 'lib/twilio-ruby.rb'

# Offense count: 2
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/twilio-ruby/security/request_validator.rb'

# Offense count: 19
# Configuration parameters: EnforcedStyle.
# Configuration parameters: EnforcedStyle, AllowedIdentifiers.
# SupportedStyles: snake_case, camelCase
Naming/VariableName:
Exclude:
- 'spec/jwt/client_capability_spec.rb'
- 'spec/jwt/task_router_spec.rb'

# Offense count: 39
# Offense count: 3
# Cop supports --auto-correct.
Style/CaseLikeIf:
Exclude:
- 'lib/twilio-ruby/framework/serialize.rb'
- 'lib/twilio-ruby/jwt/task_router.rb'

# Offense count: 40
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

Expand All @@ -119,28 +145,36 @@ Style/ExpandPathArguments:
- 'spec/spec_helper.rb'
- 'twilio-ruby.gemspec'

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

# Offense count: 1
# Cop supports --auto-correct.
Style/GlobalStdStream:
Exclude:
- 'spec/rest/client_spec.rb'

# Offense count: 3
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/twilio-ruby/framework/rest/page.rb'

# Offense count: 1
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
# SupportedShorthandSyntax: always, never
Style/HashSyntax:
Exclude:
- 'Gemfile'
- 'spec/jwt/access_token_spec.rb'

# Offense count: 12
# Offense count: 13
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
Expand All @@ -150,6 +184,20 @@ Style/IfUnlessModifier:
- 'lib/twilio-ruby/jwt/client_capability.rb'
- 'lib/twilio-ruby/jwt/jwt.rb'

# Offense count: 3
# Cop supports --auto-correct.
Style/RedundantAssignment:
Exclude:
- 'lib/twilio-ruby/jwt/access_token.rb'
- 'lib/twilio-ruby/jwt/client_capability.rb'
- 'lib/twilio-ruby/jwt/task_router.rb'

# Offense count: 2
# Cop supports --auto-correct.
Style/RedundantFileExtensionInRequire:
Exclude:
- 'spec/spec_helper.rb'

# Offense count: 4
# Cop supports --auto-correct.
Style/RedundantFreeze:
Expand All @@ -173,15 +221,30 @@ Style/RegexpLiteral:
- 'lib/twilio-ruby/framework/rest/version.rb'
- 'spec/rack/twilio_webhook_authentication_spec.rb'

# Offense count: 5
# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'examples/print_call_log.rb'
- 'lib/twilio-ruby/framework/request.rb'
- 'lib/twilio-ruby/framework/rest/error.rb'
- 'lib/twilio-ruby/framework/serialize.rb'
- 'lib/twilio-ruby/http/http_client.rb'
- 'lib/twilio-ruby/jwt/client_capability.rb'
- 'spec/framework/request_spec.rb'
- 'spec/spec_helper.rb'

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'Gemfile'
- 'spec/framework/serialize_spec.rb'

# Offense count: 14
# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: AllowNamedUnderscoreVariables.
Style/TrailingUnderscoreVariable:
Expand All @@ -190,7 +253,7 @@ Style/TrailingUnderscoreVariable:
- 'spec/jwt/client_capability_spec.rb'
- 'spec/jwt/task_router_spec.rb'

# Offense count: 15
# Offense count: 16
# Cop supports --auto-correct.
# Configuration parameters: MinSize, WordRegex.
# SupportedStyles: percent, brackets
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ githooks:
install:
bundle install --with development; bundle exec rake install

test: lint
test:
bundle exec rake spec

lint:
bundle exec rubocop -d --cache true --parallel

docs:
bundle exec yard doc --output-dir ./doc

Expand Down
1 change: 0 additions & 1 deletion twilio-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rack', '~> 2.0'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.82.0'
spec.add_development_dependency 'yard', '~> 0.9.9'
spec.add_development_dependency 'logger', '~> 1.4.2'
end

0 comments on commit c9a465a

Please sign in to comment.