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

FC-745 Disable SchemaComment, update dependencies #8

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
# IntelliJ IDEA files
.idea

.DS_Store

# build
*.gem

9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Naming/FileName:
Exclude:
- lib/rubocop-fairmoney.rb

AllCops:
NewCops: enable

Style/Documentation:
Enabled: false

Naming/HeredocDelimiterNaming:
Enabled: false
21 changes: 12 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
source "https://rubygems.org"
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in rubocop-fairmoney.gemspec
gemspec

gem "rake", "~> 12.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.13"
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rake", require: false
gem "rubocop-rspec", require: false
gem "rubocop-thread_safety", require: false
gem 'activesupport', '~> 6'
gem 'rake', '~> 12.0'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.13'
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
gem 'rubocop-rake', require: false
gem 'rubocop-rspec', require: false
gem 'rubocop-thread_safety', require: false
72 changes: 36 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,74 +12,74 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.3.1)
activesupport (6.1.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
ast (2.4.2)
concurrent-ruby (1.1.8)
diff-lcs (1.4.4)
i18n (1.8.9)
concurrent-ruby (1.1.9)
diff-lcs (1.5.0)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
minitest (5.14.4)
parallel (1.20.1)
parser (3.0.1.0)
minitest (5.15.0)
parallel (1.21.0)
parser (3.1.0.0)
ast (~> 2.4.1)
rack (2.2.3)
rainbow (3.0.0)
rainbow (3.1.1)
rake (12.3.3)
regexp_parser (2.1.1)
regexp_parser (2.2.0)
rexml (3.2.5)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rubocop (1.13.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.3)
rubocop (1.24.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-performance (1.10.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-performance (1.13.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.9.1)
rubocop-rails (2.13.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-rake (0.5.1)
rubocop
rubocop-rspec (2.2.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
rubocop-thread_safety (0.4.2)
rubocop-rspec (2.7.0)
rubocop (~> 1.19)
rubocop-thread_safety (0.4.4)
rubocop (>= 0.53.0)
ruby-progressbar (1.11.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
zeitwerk (2.4.2)
unicode-display_width (2.1.0)
zeitwerk (2.5.3)

PLATFORMS
ruby

DEPENDENCIES
activesupport (~> 6)
rake (~> 12.0)
rspec (~> 3.0)
rubocop (~> 1.13)
Expand All @@ -91,4 +91,4 @@ DEPENDENCIES
rubocop-thread_safety

BUNDLED WITH
2.2.25
2.2.27
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
# frozen_string_literal: true

RSpec::Core::RakeTask.new(:spec)
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

task :default => :spec
RSpec::Core::RakeTask.new(:spec)

require 'rspec/core/rake_task'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated require

task default: :spec

RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
Expand Down
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "rubocop/fairmoney"
require 'bundler/setup'
require 'rubocop/fairmoney'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -10,5 +11,5 @@ require "rubocop/fairmoney"
# require "pry"
# Pry.start

require "irb"
require 'irb'
IRB.start(__FILE__)
3 changes: 3 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ Style/MissingElse:
Style/StringHashKeys:
Exclude:
- 'config/routes.rb'

Rails/SchemaComment:
Enabled: false
7 changes: 5 additions & 2 deletions lib/rubocop/cop/fairmoney/no_if_in_test_descriptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ module Fairmoney
# it 'raises an error when the category is unknown'
#
class NoIfInTestDescriptions < Cop
MSG = 'Test descriptions should not include "if", use "when" instead'.freeze
MSG = 'Test descriptions should not include "if", use "when" instead'

def on_send(node)
return unless %i[describe context it xit it_behaves_like].include?(node.method_name)

node.first_argument&.each_node do |child_node|
child_node.node_parts.each do |description_line|
next unless description_line.class == String
next unless description_line.instance_of?(String)

parse_description(child_node, description_line)
end
end
Expand All @@ -38,6 +40,7 @@ def autocorrect(node)

def parse_description(node, description_line)
return unless description_line.include?(' if ')

add_offense(node)
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/fairmoney_cops.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# frozen_string_literal: true

require_relative 'fairmoney/no_if_in_test_descriptions'
4 changes: 3 additions & 1 deletion lib/rubocop/fairmoney.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require "rubocop/fairmoney/version"
# frozen_string_literal: true

require 'rubocop/fairmoney/version'

module RuboCop
module Fairmoney
Expand Down
4 changes: 3 additions & 1 deletion lib/rubocop/fairmoney/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

module RuboCop
module Fairmoney
VERSION = "1.0.3"
VERSION = '1.0.3'
end
end
29 changes: 15 additions & 14 deletions rubocop-fairmoney.gemspec
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
# frozen_string_literal: true

require_relative 'lib/rubocop/fairmoney/version'

Gem::Specification.new do |spec|
spec.name = "rubocop-fairmoney"
spec.name = 'rubocop-fairmoney'
spec.version = RuboCop::Fairmoney::VERSION
spec.authors = ["Matthieu Gendreau"]
spec.email = ["[email protected]"]
spec.authors = ['Matthieu Gendreau']
spec.email = ['[email protected]']

spec.summary = "Custom code style checking for FairMoney."
spec.summary = 'Custom code style checking for FairMoney.'
spec.description = <<-EOF
A plugin for RuboCop code style enforcing & linting tool. It includes Rubocop configuration
used at FairMoney.
EOF
spec.homepage = "https://fairmoney.ng/"
spec.license = "MIT"
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
spec.homepage = 'https://fairmoney.ng/'
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0') # rubocop:disable Gemspec/RequiredRubyVersion

spec.metadata['allowed_push_host'] = 'https://rubygems.pkg.github.com'

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/fairmoney/rubocop-fairmoney"
spec.metadata["changelog_uri"] = "https://github.com/fairmoney/rubocop-fairmoney/blob/master/CHANGELOG.md"
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/fairmoney/rubocop-fairmoney'
spec.metadata['changelog_uri'] = 'https://github.com/fairmoney/rubocop-fairmoney/blob/master/CHANGELOG.md'

# 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(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rubocop-performance'
Expand All @@ -37,4 +39,3 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'rubocop-rspec'
spec.add_runtime_dependency 'rubocop-thread_safety'
end

4 changes: 3 additions & 1 deletion spec/rubocop/fairmoney_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Fairmoney do
it "has a version number" do
it 'has a version number' do
expect(RuboCop::Fairmoney::VERSION).not_to be nil
end
end