Skip to content

Commit

Permalink
Merge pull request #5 from JuzerShakir/lint
Browse files Browse the repository at this point in the history
Modify Linting Configuration
  • Loading branch information
JuzerShakir authored Dec 27, 2024
2 parents cd80f59 + 62e7d54 commit a2f74b7
Showing 12 changed files with 107 additions and 55 deletions.
20 changes: 11 additions & 9 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -6,14 +6,16 @@
# guidelines for contributions.
#
# Any of these may be changed.
AllCops:
TargetRubyVersion: "3.2.2"

StringLiterals:
Enabled: false
require:
- rubocop-minitest
- rubocop-rake
- standard

SpaceInsideHashLiteralBraces:
Enabled: false
inherit_gem:
standard: config/base.yml

Style/ClassVars:
Enabled: false
AllCops:
TargetRubyVersion: 3.2.2
NewCops: enable
Exclude:
- "test.rb"
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -13,6 +13,9 @@ gem "minitest-hooks", "~> 1.5", ">= 1.5.2"
gem "rake", "~> 13.0", ">= 13.0.6"
gem "reek", "~> 6.1", ">= 6.1.4"
gem "require_all", "~> 3.0"
gem "rubocop", "~> 1.69", ">= 1.69.2"
gem "rubocop-minitest", "~> 0.36.0"
gem "rubocop-rake", "~> 0.6.0"
gem "standard", "~> 1.31", ">= 1.31.1"
gem "vcr", "~> 6.3", ">= 6.3.1"
gem "webmock", "~> 3.24"
91 changes: 65 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -13,13 +13,42 @@ GEM
ast (2.4.2)
base64 (0.1.1)
bigdecimal (3.1.9)
concurrent-ruby (1.3.4)
crack (1.0.0)
bigdecimal
rexml
date (3.4.1)
debug (1.10.0)
irb (~> 1.10)
reline (>= 0.3.8)
dry-configurable (1.2.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.2)
concurrent-ruby (~> 1.0)
logger
zeitwerk (~> 2.6)
dry-inflector (1.1.0)
dry-initializer (3.1.1)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-schema (1.13.4)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-logic (>= 1.4, < 2)
dry-types (>= 1.7, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.2)
bigdecimal (~> 3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
hashdiff (1.1.2)
httparty (0.21.0)
mini_mime (>= 1.0.0)
@@ -28,19 +57,19 @@ GEM
irb (1.14.3)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.6.3)
kwalify (0.7.2)
json (2.9.1)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.4)
mini_mime (1.1.5)
minitest (5.20.0)
minitest-hooks (1.5.2)
minitest (> 5.3)
multi_xml (0.6.0)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
parallel (1.23.0)
parser (3.2.2.3)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
psych (5.2.2)
@@ -52,53 +81,60 @@ GEM
rake (13.0.6)
rdoc (6.10.0)
psych (>= 4.0.0)
reek (6.1.4)
kwalify (~> 0.7.0)
parser (~> 3.2.0)
reek (6.3.0)
dry-schema (~> 1.13.0)
parser (~> 3.3.0)
rainbow (>= 2.0, < 4.0)
regexp_parser (2.8.1)
rexml (~> 3.1)
regexp_parser (2.10.0)
reline (0.6.0)
io-console (~> 0.5)
require_all (3.0.0)
rexml (3.2.6)
rubocop (1.56.4)
base64 (~> 0.1.1)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.23.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
standard (1.31.1)
standard (1.43.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.56.2)
rubocop (~> 1.69.1)
standard-custom (~> 1.0.0)
standard-performance (~> 1.2)
standard-performance (~> 1.6)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.2.0)
standard-performance (1.6.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.19.0)
rubocop-performance (~> 1.23.0)
stringio (3.1.2)
unicode-display_width (2.4.2)
unicode-display_width (3.1.3)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
vcr (6.3.1)
base64
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
zeitwerk (2.7.1)

PLATFORMS
x86_64-linux
@@ -111,6 +147,9 @@ DEPENDENCIES
rake (~> 13.0, >= 13.0.6)
reek (~> 6.1, >= 6.1.4)
require_all (~> 3.0)
rubocop (~> 1.69, >= 1.69.2)
rubocop-minitest (~> 0.36.0)
rubocop-rake (~> 0.6.0)
standard (~> 1.31, >= 1.31.1)
vcr (~> 6.3, >= 6.3.1)
webmock (~> 3.24)
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -47,6 +47,6 @@ end

desc "linting & code smell detector"
task :analysis do
sh "standardrb"
sh "rubocop"
sh "reek"
end
7 changes: 4 additions & 3 deletions imdb_title.gemspec
Original file line number Diff line number Diff line change
@@ -17,9 +17,10 @@ Gem::Specification.new do |s|
s.metadata = {
"source_code_uri" => "https://github.com/JuzerShakir/imdb",
"changelog_uri" => "https://github.com/JuzerShakir/imdb/blob/master/CHANGELOG.md",
"bug_tracker_uri" => "https://github.com/JuzerShakir/imdb/issues"
"bug_tracker_uri" => "https://github.com/JuzerShakir/imdb/issues",
"rubygems_mfa_required" => "true"
}
s.add_runtime_dependency "httparty", "~> 0.21.0"
s.add_runtime_dependency "nokogiri", "~> 1.15", ">= 1.15.4"
s.add_dependency "httparty", "~> 0.21.0"
s.add_dependency "nokogiri", "~> 1.15", ">= 1.15.4"
s.required_ruby_version = ">= 2.7.0"
end
3 changes: 1 addition & 2 deletions lib/helper.rb
Original file line number Diff line number Diff line change
@@ -5,5 +5,4 @@
require "httparty"

# load all files & folders of the current directory 'lib'
lib = __dir__
Dir.glob(File.join(lib, "**", "*.rb")).sort.each(&method(:require))
Dir.glob(File.join(__dir__, "**", "*.rb")).each(&method(:require))
9 changes: 6 additions & 3 deletions test/exceptions_test.rb
Original file line number Diff line number Diff line change
@@ -6,9 +6,12 @@
# tests for custom exceptions
class ExceptionsTest < Minitest::Test
def test_invalid_url
assert_raises(IMDb::InvalidURL) do
IMDb::Title.new("http://www.example.com")
IMDb::Title.new("https://www.imdb.com/title/tt549199490/")
assert_raises(IMDb::InvalidURL) { IMDb::Title.new("http://www.example.com") }
end

def test_invalid_id
VCR.use_cassette("wrong_id") do
assert_raises(IMDb::InvalidURL) { IMDb::Title.new("https://www.imdb.com/title/tt549199490/") }
end
end
end
7 changes: 4 additions & 3 deletions test/titles/episode_test.rb
Original file line number Diff line number Diff line change
@@ -7,15 +7,16 @@
class EpisodeTest < TestHelper
ID = "tt9166672" # open wide, o earth

def test_title = super title.title, "Open Wide, O Earth"
def test_title = super(title.title, "Open Wide, O Earth")

def test_release_date
release_date = title.release_date
super release_date
super(release_date)

assert_equal("May 20, 2019 (United States)", release_date)
end

def test_duration = super title.duration, "1 hour 5 minutes"
def test_duration = super(title.duration, "1 hour 5 minutes")

def test_instance_of_class = assert_kind_of(Episode, title)
end
5 changes: 3 additions & 2 deletions test/titles/in_development_test.rb
Original file line number Diff line number Diff line change
@@ -7,10 +7,11 @@
class TitleInDevelopmentTest < TestHelper
ID = "tt4576032" # blade

def test_title = super title.title, "300: The Resurgence"
def test_title = super(title.title, "300: The Resurgence")

def test_tagline
tagline = title.tagline

assert(tagline.is_a?(String) || tagline.nil?)
end

@@ -20,5 +21,5 @@ def test_popularity = assert_nil(title.popularity)

def test_release_date = assert_nil(title.release_date)

def test_production_companies = super title.production_companies
def test_production_companies = super(title.production_companies)
end
6 changes: 4 additions & 2 deletions test/titles/movie_test.rb
Original file line number Diff line number Diff line change
@@ -9,18 +9,20 @@ class MovieTest < TestHelper

def test_instance_of_class = assert_kind_of(Movie, title)

def test_title = super title.title, "The Shawshank Redemption"
def test_title = super(title.title, "The Shawshank Redemption")

def test_duration = super title.duration, "2 hours 22 minutes"
def test_duration = super(title.duration, "2 hours 22 minutes")

def test_budget
budget = title.budget

assert_kind_of(String, budget)
assert_match(/\A\$\d+(?:,\d{3})*\z/, budget)
end

def test_revenue
revenue = title.revenue

assert_kind_of(String, revenue)
assert_match(/\A\$\d+(?:,\d{3})*\z/, revenue)
end
4 changes: 2 additions & 2 deletions test/titles/tv_show_test.rb
Original file line number Diff line number Diff line change
@@ -7,9 +7,9 @@
class TvShowTest < TestHelper
ID = "tt0903747" # breaking bad

def test_title = super title.title, "Breaking Bad"
def test_title = super(title.title, "Breaking Bad")

def test_duration = super title.duration, "45 minutes"
def test_duration = super(title.duration, "45 minutes")

def test_instance_of_class = assert_kind_of(TvShow, title)
end
5 changes: 3 additions & 2 deletions test/titles/video_game_test.rb
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@
class VideoGameTest < TestHelper
ID = "tt2140553" # the last of us

def test_title = super title.title, "The Last of Us"
def test_title = super(title.title, "The Last of Us")

def test_release_date
release_date = title.release_date
super release_date
super(release_date)

assert_equal("June 14, 2013 (United States)", release_date)
end

0 comments on commit a2f74b7

Please sign in to comment.