File tree 3 files changed +11
-8
lines changed
3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -6,19 +6,24 @@ module CI
6
6
# Use it to create concrete CI jobs.
7
7
class CIJob
8
8
PROCESS_NO_IMPL_ERROR = "No implementation for process in #{ self . class . name } "
9
+
9
10
private_constant :PROCESS_NO_IMPL_ERROR
10
11
11
12
# Main entry of job class that runs your check.
12
13
def run
13
14
puts ( "#{ self . class . name } started..." )
15
+
14
16
process
17
+
15
18
puts ( "#{ self . class . name } ended without errors!" )
16
19
end
17
20
18
21
# Use this method in your realization when task completed with error.
19
22
def end_with_error ( details )
20
23
details . call
24
+
21
25
puts ( "#{ self . class . name } ended with an error." )
26
+
22
27
exit ( 1 )
23
28
end
24
29
Original file line number Diff line number Diff line change @@ -20,10 +20,11 @@ def check(difficulty)
20
20
lines = ::IO . readlines ( "#{ path } /#{ file_name } " )
21
21
has_comment = false
22
22
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
27
28
end
28
29
29
30
end_with_error ( -> { puts ( "LinksChecker ends with an error from #{ file_name } ." ) } ) unless has_comment
Original file line number Diff line number Diff line change @@ -19,10 +19,7 @@ def check(difficulty)
19
19
readme = ::File . readlines ( './README.md' )
20
20
21
21
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 ) }
26
23
27
24
end_with_error ( -> { puts ( "ReadmeChecker ends with an error from #{ file_name } ." ) } ) if links_count != 1
28
25
end
You can’t perform that action at this time.
0 commit comments