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

Initial Rubocop implementation #448

Merged
merged 61 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
86a1abf
Initialize Rubocop, work on files in the root
bobbrodie Apr 28, 2024
cda3da2
Add Rubocop to CI
bobbrodie Apr 28, 2024
205616b
Add frozen_string_literal to resources
bobbrodie Apr 28, 2024
05dd40c
Don't warn about documentation (for now)
bobbrodie Apr 28, 2024
db34bfc
Clean up resources
bobbrodie Apr 28, 2024
facac23
Update remainder of frozen_string_literal
bobbrodie Apr 28, 2024
f7cbc56
Updated Rubocop configuration
bobbrodie Apr 28, 2024
d1b4af5
Fixed Style/StringConcatenation
bobbrodie Apr 28, 2024
b584d12
Fixed Layout/SpaceInsideHashLiteralBraces
bobbrodie Apr 28, 2024
0d45b6b
Fixed Layout/HashAlignment
bobbrodie Apr 28, 2024
ec5fb07
Fixed Style/StringLiterals
bobbrodie Apr 28, 2024
08d48f1
Fixed Layout/LineLength
bobbrodie Apr 28, 2024
b6063b0
Fixed RSpec/ItBehavesLike
bobbrodie Apr 28, 2024
3769e1a
Move rubocop to its own workflow
bobbrodie Apr 28, 2024
cc09d1c
Exclude vendor dir on GitHub Actions
bobbrodie Apr 28, 2024
ead14d3
Use GitHub formatter
bobbrodie Apr 28, 2024
7777ab5
Fixed RSpec/ExampleWording
bobbrodie Apr 28, 2024
bea4072
Fixed Layout/TrailingWhitespace
bobbrodie Apr 28, 2024
7127da5
Fixed Layout/ArgumentAlignment
bobbrodie Apr 28, 2024
ea655e5
Fixed Style/HashSyntax
bobbrodie Apr 28, 2024
c639f38
Fixed RSpec/DescribedClass
bobbrodie Apr 29, 2024
9cfcbfd
Fixed Lint/SymbolConversion
bobbrodie Apr 29, 2024
2d60892
Fixed Layout/LineLength
bobbrodie Apr 29, 2024
6fdb71a
Fixed Layout/ExtraSpacing
bobbrodie Apr 29, 2024
5fbb835
Fixed Layout/FirstHashElementIndentation
bobbrodie Apr 29, 2024
313c704
Fixed Style/SymbolArray
bobbrodie Apr 29, 2024
503718b
Fixed Style/RedundantReturn
bobbrodie Apr 29, 2024
bdb2405
Fixed RSpec/HookArgument
bobbrodie Apr 29, 2024
6b3030f
Fixed RSpec/LeadingSubject and RSpec/EmptyLineAfterSubject
bobbrodie Apr 29, 2024
1077790
Fixed Layout/EmptyLines
bobbrodie Apr 29, 2024
af938b1
Fixed RSpec/ReturnFromStub
bobbrodie Apr 29, 2024
30d1912
Fixed Layout/EmptyLinesAroundBlockBody
bobbrodie Apr 29, 2024
f007500
Fixed Naming/BlockForwarding
bobbrodie Apr 29, 2024
885ffbb
Fixed Layout/ArgumentAlignment
bobbrodie Apr 29, 2024
3d166ba
Fixed Style/BlockDelimiters
bobbrodie Apr 29, 2024
9efb6a4
Fixed Layout/BlockEndNewline
bobbrodie Apr 29, 2024
b341e3c
Fixed Layout/MultilineMethodCallIndentation
bobbrodie Apr 29, 2024
98affed
Fixed Lint/RedundantStringCoercion
bobbrodie Apr 29, 2024
5c9ccfc
Fixed Style/MultilineIfModifier
bobbrodie Apr 29, 2024
9b3d95b
Fixed Layout/SpaceAroundOperators
bobbrodie Apr 29, 2024
93e9fc4
Fixed Layout/TrailingEmptyLines
bobbrodie Apr 29, 2024
6e00a0e
Fixed Naming/HeredocDelimiterCase
bobbrodie Apr 29, 2024
4bec42a
Fixed Style/ArgumentsForwarding
bobbrodie Apr 29, 2024
06dac01
Fixed Style issues
bobbrodie Apr 29, 2024
8d8f54b
Resolve merge conflicts
bobbrodie Apr 29, 2024
6cec323
Fix Style/RedundantFreeze after merge conflicts
bobbrodie Apr 29, 2024
3f25297
Fix RSpec issues
bobbrodie Apr 29, 2024
3d04164
Fix Naming/RescuedExceptionsVariableName
bobbrodie Apr 29, 2024
821c25b
Fix Layout issues
bobbrodie Apr 29, 2024
bdb09fb
Line length cleanup
bobbrodie Apr 29, 2024
17002cc
Designate self.path_base as private
bobbrodie Apr 29, 2024
fe70821
Fix Style/IfUnlessModifier and disable some cops
bobbrodie Apr 29, 2024
5884183
Disable Style/CombinableLoops in the two pass approach
bobbrodie Apr 29, 2024
a4c7f55
Remove unused file - tasks.rb
bobbrodie Apr 29, 2024
91cdf01
Fix RSpec/DescribedClass
bobbrodie Apr 29, 2024
de7e820
Fix Layout/ElseAlignment
bobbrodie Apr 29, 2024
96ea2eb
Fix Style/HashConversion
bobbrodie Apr 29, 2024
54eb541
Fix RSpec/BeEql
bobbrodie Apr 29, 2024
e62baba
Disable remaining cops since they need more thought
bobbrodie Apr 29, 2024
669a600
Resolve conflicts
bobbrodie Apr 30, 2024
a975e58
Update attachment spec for rubocop
bobbrodie Apr 30, 2024
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
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