Skip to content

2025-04-28 v. 9.3.5.1: added new checkers #1026

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

Merged
merged 4 commits into from
Apr 28, 2025
Merged
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
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@ require 'rake/testtask'
end

desc 'Run all custom checks for CI'
require_relative './ci/master_checker'
require_relative './ci/links_checker'
require_relative './ci/readme_duplicates_checker'
require_relative './ci/readme_paths_checker'
require_relative './ci/tests_checker'
require_relative './ci/version_checker'
require_relative './ci/duplicate_links_checker'
require_relative './ci/stage_checker'
task :ci do
[
::CI::MasterChecker.new,
::CI::LinksChecker.new,
::CI::ReadmeDuplicatesChecker.new,
::CI::ReadmePathsChecker.new,
::CI::TestsChecker.new,
::CI::VersionChecker.new,
::CI::DuplicateLinksChecker.new
::CI::DuplicateLinksChecker.new,
::CI::StageChecker.new
].each(&:process)
end
2 changes: 1 addition & 1 deletion ci/ci_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def run
end

# Use this method in your realization when task completed with error.
# @param {String} details
# @param {Proc} details
# @return {Void}
def end_with_error(details)
details.call
Expand Down
18 changes: 18 additions & 0 deletions ci/master_checker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

require_relative './ci_job'

module CI
# CI job that checks that we are not in master branch.
class MasterChecker < CIJob
# Process MasterChecker.
# @return {Void}
def process
current_branch = `git rev-parse --abbrev-ref HEAD`.strip

return unless current_branch == 'master'

end_with_error(-> { puts('MasterChecker ends with an error. You cannot commit directly to master branch.') })
end
end
end
12 changes: 12 additions & 0 deletions ci/stage_checker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require_relative './ci_job'

module CI
# CI job that add all files to stage for commit.
class StageChecker < ::CI::CIJob
# Process StageChecker.
# @return {Void}
def process = `git add -u`
end
end
2 changes: 1 addition & 1 deletion leetcode-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'English'
::Gem::Specification.new do |s|
s.required_ruby_version = '>= 3.0'
s.name = 'leetcode-ruby'
s.version = '9.3.5'
s.version = '9.3.5.1'
s.license = 'MIT'
s.files = ::Dir['lib/**/*.rb'] + %w[README.md]
s.executable = 'leetcode-ruby'
Expand Down