Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/test.gitlab-ci.yml12
-rw-r--r--.rubocop.yml1
-rw-r--r--Makefile4
-rw-r--r--lefthook.yml2
-rw-r--r--lib/tasks/task_helpers.rb14
5 files changed, 26 insertions, 7 deletions
diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml
index c52d02c7..6dc4a6f0 100644
--- a/.gitlab/ci/test.gitlab-ci.yml
+++ b/.gitlab/ci/test.gitlab-ci.yml
@@ -113,6 +113,18 @@ js_lint:
- make prettier-tests
#
+# RuboCop
+#
+rubocop:
+ extends:
+ - .rules_site_tests
+ - .bundle
+ needs: []
+ stage: test
+ script:
+ - make rubocop-tests
+
+#
# Lint SCSS
#
stylelint:
diff --git a/.rubocop.yml b/.rubocop.yml
index a60936bc..371edfd4 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -4,6 +4,7 @@ inherit_gem:
AllCops:
NewCops: enable
+ SuggestExtensions: false
CodeReuse/ActiveRecord:
Enabled: false
diff --git a/Makefile b/Makefile
index 056d9a36..ad0ef60d 100644
--- a/Makefile
+++ b/Makefile
@@ -151,6 +151,10 @@ prettier-tests:
@printf "\n$(INFO)INFO: Running Prettier tests...$(END)\n"
@yarn prettier
+rubocop-tests:
+ @printf "\n$(INFO)INFO: Running RuboCop tests...$(END)\n"
+ @bundle exec rubocop
+
stylelint-tests:
@printf "\n$(INFO)INFO: Running Stylelint tests...$(END)\n"
@yarn stylelint content/assets/stylesheets
diff --git a/lefthook.yml b/lefthook.yml
index e8f37766..14266e66 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -10,6 +10,8 @@ pre-push:
run: make eslint-tests
prettier-tests:
run: make prettier-tests
+ rubocop-tests:
+ run: make rubocop-tests
stylelint-tests:
run: make stylelint-tests
hadolint-tests:
diff --git a/lib/tasks/task_helpers.rb b/lib/tasks/task_helpers.rb
index 52445d2f..106a29f3 100644
--- a/lib/tasks/task_helpers.rb
+++ b/lib/tasks/task_helpers.rb
@@ -31,7 +31,7 @@ class TaskHelpers
# variable, and if not assigned, set to the default branch.
#
if stable_branch_name.nil?
- merge_request_iid = ENV["MERGE_REQUEST_IID_#{slug.upcase}"]
+ merge_request_iid = ENV.fetch("MERGE_REQUEST_IID_#{slug.upcase}", nil)
branch_name = ENV.fetch("BRANCH_#{slug.upcase}", default_branch(products[slug].fetch('repo')))
return branch_name, "heads/#{branch_name}" if merge_request_iid.nil?
@@ -42,26 +42,26 @@ class TaskHelpers
#
# Check the project slug to determine the branch name
#
- stable_branch = case slug
+ stable_branch = stable_branch_for(slug)
+ [stable_branch, "heads/#{stable_branch}"]
+ end
+
+ def stable_branch_for(slug)
+ case slug
when 'ee'
"#{stable_branch_name}-ee"
-
when 'omnibus', 'runner'
stable_branch_name
-
# Charts don't use the same version scheme as GitLab, we need to
# deduct their version from the GitLab equivalent one.
when 'charts'
charts_stable_branch
-
# If the upstream product doesn't follow a stable branch scheme, set the
# branch to the default
else
default_branch(products[slug].fetch('repo'))
end
-
- return stable_branch, "heads/#{stable_branch}"
end
def git_workdir_dirty?