Skip to content
代码片段 群组 项目
未验证 提交 4330c650 编辑于 作者: Dylan Griffith's avatar Dylan Griffith 提交者: GitLab
浏览文件

Add gitlab-housekeper CI template to run in CI

上级 ea71b210
No related branches found
No related tags found
无相关合并请求
......@@ -41,3 +41,6 @@ include:
- local: .gitlab/ci/templates/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-database-lock_retries"
- local: .gitlab/ci/templates/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-housekeeper"
......@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
spec.executables = ['gitlab-housekeeper']
spec.add_runtime_dependency 'activesupport'
spec.add_runtime_dependency 'awesome_print'
spec.add_runtime_dependency 'httparty'
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'awesome_print'
spec.add_development_dependency 'gitlab-styles'
spec.add_development_dependency 'rspec-rails'
......
......@@ -70,7 +70,7 @@ def each_allowed_rubocop_rule
end
end
def remove_first_exclusions(rule, file, remove_count)
def remove_first_exclusions(_rule, file, remove_count)
content = File.read(file)
skipped = 0
......
......@@ -17,6 +17,7 @@ def setup_master_branch
File.write(file_in_master, 'File already in master!')
::Gitlab::Housekeeper::Shell.execute('git', 'init')
::Gitlab::Housekeeper::Shell.execute('git', 'config', '--local', 'user.email', 'test@example.com')
::Gitlab::Housekeeper::Shell.execute('git', 'checkout', '-b', 'master')
::Gitlab::Housekeeper::Shell.execute('git', 'add', file_in_master)
::Gitlab::Housekeeper::Shell.execute('git', 'commit', '-m', 'Initial commit!')
......
......@@ -2,26 +2,10 @@
require 'spec_helper'
# rubocop:disable RSpec/MultipleMemoizedHelpers
RSpec.describe ::Gitlab::Housekeeper::Keeps::RubocopFixer do
let(:todo_dir) { Dir.mktmpdir }
let(:rule1_file) { Pathname(todo_dir).join('rule1.yml').to_s }
let(:rule2_file) { Pathname(todo_dir).join('rule2.yml').to_s }
let(:not_autocorrectable_file) { Pathname(todo_dir).join('not_autocorrectable.yml').to_s }
let(:todo_dir_pattern) { Pathname(todo_dir).join('**/*.yml').to_s }
before do
dir = Pathname.new(todo_dir)
FileUtils.cp('spec/fixtures/rubocop_todo1.yml', rule1_file)
FileUtils.cp('spec/fixtures/rubocop_todo2.yml', rule2_file)
FileUtils.cp('spec/fixtures/rubocop_todo_not_autocorrectable.yml', not_autocorrectable_file)
end
after do
FileUtils.remove_entry(todo_dir)
end
let(:rubocop_fixer) { described_class.new(todo_dir_pattern: todo_dir_pattern, limit_fixes: 5) }
let(:rule1_violating_files) do
[
'rule1_violation1.rb',
......@@ -45,6 +29,22 @@
]
end
let(:rule1_file) { Pathname(todo_dir).join('rule1.yml').to_s }
let(:rule2_file) { Pathname(todo_dir).join('rule2.yml').to_s }
let(:not_autocorrectable_file) { Pathname(todo_dir).join('not_autocorrectable.yml').to_s }
let(:todo_dir_pattern) { Pathname(todo_dir).join('**/*.yml').to_s }
before do
Pathname.new(todo_dir)
FileUtils.cp('spec/fixtures/rubocop_todo1.yml', rule1_file)
FileUtils.cp('spec/fixtures/rubocop_todo2.yml', rule2_file)
FileUtils.cp('spec/fixtures/rubocop_todo_not_autocorrectable.yml', not_autocorrectable_file)
end
after do
FileUtils.remove_entry(todo_dir)
end
describe '#each_change' do
it 'iterates over todo_dir_pattern files' do
yielded_times = 0
......@@ -116,3 +116,4 @@
end
end
end
# rubocop:enable RSpec/MultipleMemoizedHelpers
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册