Skip to content

Commit 79ca67f

Browse files
authored
Merge pull request #701 from fartem/ci-31
2024-08-07 v. 6.4.1.1: refactored CI jobs
2 parents c72b367 + 55e91d9 commit 79ca67f

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

ci/ci_job.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,24 @@ module CI
66
# Use it to create concrete CI jobs.
77
class CIJob
88
PROCESS_NO_IMPL_ERROR = "No implementation for process in #{self.class.name}"
9+
910
private_constant :PROCESS_NO_IMPL_ERROR
1011

1112
# Main entry of job class that runs your check.
1213
def run
1314
puts("#{self.class.name} started...")
15+
1416
process
17+
1518
puts("#{self.class.name} ended without errors!")
1619
end
1720

1821
# Use this method in your realization when task completed with error.
1922
def end_with_error(details)
2023
details.call
24+
2125
puts("#{self.class.name} ended with an error.")
26+
2227
exit(1)
2328
end
2429

ci/links_checker.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ def check(difficulty)
2020
lines = ::IO.readlines("#{path}/#{file_name}")
2121
has_comment = false
2222
lines.each do |line|
23-
if line.start_with?('# https://leetcode.com/')
24-
has_comment = true
25-
break
26-
end
23+
next unless line.start_with?('# https://leetcode.com/')
24+
25+
has_comment = true
26+
27+
break
2728
end
2829

2930
end_with_error(-> { puts("LinksChecker ends with an error from #{file_name}.") }) unless has_comment

ci/readme_checker.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ def check(difficulty)
1919
readme = ::File.readlines('./README.md')
2020

2121
solutions.each do |file_name|
22-
links_count = 0
23-
readme.each do |line|
24-
links_count += 1 if line.include?(file_name)
25-
end
22+
links_count = readme.count { |line| line.include?(file_name) }
2623

2724
end_with_error(-> { puts("ReadmeChecker ends with an error from #{file_name}.") }) if links_count != 1
2825
end

0 commit comments

Comments
 (0)