Skip to content

Commit

Permalink
Merge pull request #448 from bobbrodie/rubocop
Browse files Browse the repository at this point in the history
Initial Rubocop implementation
  • Loading branch information
bobbrodie authored May 1, 2024
2 parents 3e1deb0 + a975e58 commit 7f6319d
Show file tree
Hide file tree
Showing 99 changed files with 1,030 additions and 656 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Rubocop

on: [push, pull_request]

jobs:
rubocop:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Run rubocop
run: |
bundle exec rubocop --format github
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand Down
191 changes: 191 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
require:
- rubocop-rspec

AllCops:
Exclude:
- 'example.rb'
- 'http-basic-example.rb'
- 'vendor/**/*'
NewCops: enable
TargetRubyVersion: 3.1

Naming/FileName:
Exclude:
- 'lib/jira-ruby.rb'

Naming/MethodName:
Enabled: false

Style/Documentation:
Enabled: false

Style/FrozenStringLiteralComment:
Exclude:
- 'spec/**/*'

##
# Temporarily Disable
#
# We are going to disable these and fix in pull requests
##
Layout/ClosingHeredocIndentation:
Enabled: false

Layout/EmptyLineAfterGuardClause:
Enabled: false

Layout/EmptyLinesAroundMethodBody:
Enabled: false

Layout/HashAlignment:
Enabled: false

Layout/LineLength:
Enabled: false

Lint/ConstantDefinitionInBlock:
Enabled: false

Lint/EmptyClass:
Enabled: false

Lint/IneffectiveAccessModifier:
Enabled: false

Lint/MissingSuper:
Enabled: false

Lint/RedundantCopDisableDirective:
Enabled: false

Lint/UselessAssignment:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Naming/AccessorMethodName:
Enabled: false

Naming/BlockForwarding:
Enabled: false

Naming/HeredocDelimiterNaming:
Enabled: false

Naming/PredicateName:
Enabled: false

Naming/VariableNumber:
Enabled: false

RSpec/AnyInstance:
Enabled: false

RSpec/BeEq:
Enabled: false

RSpec/ContextWording:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/ExpectInHook:
Enabled: false

RSpec/FilePath:
Enabled: false

RSpec/IndexedLet:
Enabled: false

RSpec/InstanceVariable:
Enabled: false

RSpec/LeakyConstantDeclaration:
Enabled: false

RSpec/MessageChain:
Enabled: false

RSpec/MessageSpies:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Enabled: false

RSpec/NamedSubject:
Enabled: false

RSpec/NestedGroups:
Enabled: false

RSpec/NoExpectationExample:
Enabled: false

RSpec/PredicateMatcher:
Enabled: false

RSpec/ReceiveMessages:
Enabled: false

RSpec/RepeatedSubjectCall:
Enabled: false

RSpec/SpecFilePathFormat:
Enabled: false

RSpec/SpecFilePathSuffix:
Enabled: false

RSpec/StubbedMock:
Enabled: false

RSpec/SubjectStub:
Enabled: false

RSpec/VerifiedDoubleReference:
Enabled: false

RSpec/VerifiedDoubles:
Enabled: false

Security/Open:
Enabled: false

Style/ArgumentsForwarding:
Enabled: false

Style/CaseEquality:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/MissingRespondToMissing:
Enabled: false

Style/OpenStructUse:
Enabled: false

Style/OptionalBooleanParameter:
Enabled: false

Style/SymbolProc:
Enabled: false
12 changes: 10 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# frozen_string_literal: true

source 'https://rubygems.org'

group :development do
gem 'guard'
gem 'guard-rspec'
gem 'guard', '~> 2.18', '>= 2.18.1'
gem 'guard-rspec', '~> 4.7', '>= 4.7.3'
gem 'railties'
gem 'rake', '~> 13.2', '>= 13.2.1'
gem 'rspec', '~> 3.0', '>= 3.13'
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
gem 'webmock', '~> 3.23', '>= 3.23.0'
end

group :development, :test do
gem 'pry' # this was in the original Gemfile - but only needed in development & test
gem 'rubocop'
gem 'rubocop-rspec', require: false
end

# Specify your gem's dependencies in jira_api.gemspec
Expand Down
2 changes: 2 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

gem 'wdm', '>= 0.1.0' if Gem.win_platform?
gem 'rspec', '~> 3.0.0'

Expand Down
7 changes: 3 additions & 4 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 'rubygems'
Expand All @@ -13,13 +15,10 @@ task test: %i[prepare spec]
desc 'Prepare and run rspec tests'
task :prepare do
rsa_key = File.expand_path('rsakey.pem')
unless File.exist?(rsa_key)
Rake::Task['jira:generate_public_cert'].invoke
end
Rake::Task['jira:generate_public_cert'].invoke unless File.exist?(rsa_key)
end

desc 'Run RSpec tests'
# RSpec::Core::RakeTask.new(:spec)
RSpec::Core::RakeTask.new(:spec, [] => [:prepare]) do |task|
task.rspec_opts = ['--color', '--format', 'doc']
end
Expand Down
2 changes: 2 additions & 0 deletions http-basic-example.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rubygems'
require 'pp'
require 'jira-ruby'
Expand Down
18 changes: 6 additions & 12 deletions jira-ruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$LOAD_PATH.push File.expand_path('lib', __dir__)
require 'jira/version'

Expand All @@ -9,27 +11,19 @@ Gem::Specification.new do |s|
s.summary = 'Ruby Gem for use with the Atlassian JIRA REST API'
s.description = 'API for JIRA'
s.licenses = ['MIT']
s.metadata = { 'source_code_uri' => 'https://github.com/sumoheavy/jira-ruby' }
s.metadata = {
'source_code_uri' => 'https://github.com/sumoheavy/jira-ruby',
'rubygems_mfa_required' => 'true'
}

s.required_ruby_version = '>= 3.1.0'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ['lib']

# Runtime Dependencies
s.add_runtime_dependency 'activesupport'
s.add_runtime_dependency 'atlassian-jwt'
s.add_runtime_dependency 'multipart-post'
s.add_runtime_dependency 'oauth', '~> 1.0'

# Development Dependencies
s.add_development_dependency 'guard', '~> 2.18', '>= 2.18.1'
s.add_development_dependency 'guard-rspec', '~> 4.7', '>= 4.7.3'
s.add_development_dependency 'pry', '~> 0.14', '>= 0.14.3'
s.add_development_dependency 'railties'
s.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
s.add_development_dependency 'rspec', '~> 3.0', '>= 3.13'
s.add_development_dependency 'webmock', '~> 3.23', '>= 3.23.0'
end
4 changes: 3 additions & 1 deletion lib/jira-ruby.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# frozen_string_literal: true

$LOAD_PATH << __dir__

require 'active_support'
require 'active_support/inflector'
ActiveSupport::Inflector.inflections do |inflector|
inflector.singular /status$/, 'status'
inflector.singular(/status$/, 'status')
end

require 'jira/base'
Expand Down
Loading

0 comments on commit 7f6319d

Please sign in to comment.