payping-gitlab-triage 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +19 -0
  3. data/.gitignore +15 -0
  4. data/.gitlab/CODEOWNERS +2 -0
  5. data/.gitlab/changelog_config.yml +13 -0
  6. data/.gitlab/issue_templates/Default.md +13 -0
  7. data/.gitlab/merge_request_templates/Default.md +11 -0
  8. data/.gitlab/merge_request_templates/Release.md +13 -0
  9. data/.gitlab-ci.yml +146 -0
  10. data/.rubocop.yml +21 -0
  11. data/.rubocop_todo.yml +145 -0
  12. data/.ruby-version +1 -0
  13. data/.tool-versions +1 -0
  14. data/.yardopts +4 -0
  15. data/CONTRIBUTING.md +31 -0
  16. data/Dangerfile +5 -0
  17. data/Gemfile +15 -0
  18. data/Guardfile +70 -0
  19. data/LICENSE.md +25 -0
  20. data/README.md +1480 -0
  21. data/Rakefile +6 -0
  22. data/bin/gitlab-triage +19 -0
  23. data/gitlab-triage.gemspec +41 -0
  24. data/lib/gitlab/triage/action/base.rb +14 -0
  25. data/lib/gitlab/triage/action/comment.rb +104 -0
  26. data/lib/gitlab/triage/action/comment_on_summary.rb +83 -0
  27. data/lib/gitlab/triage/action/delete.rb +56 -0
  28. data/lib/gitlab/triage/action/issue.rb +64 -0
  29. data/lib/gitlab/triage/action/summarize.rb +82 -0
  30. data/lib/gitlab/triage/action.rb +36 -0
  31. data/lib/gitlab/triage/api_query_builders/base_query_param_builder.rb +27 -0
  32. data/lib/gitlab/triage/api_query_builders/date_query_param_builder.rb +42 -0
  33. data/lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb +28 -0
  34. data/lib/gitlab/triage/api_query_builders/single_query_param_builder.rb +13 -0
  35. data/lib/gitlab/triage/command_builders/base_command_builder.rb +40 -0
  36. data/lib/gitlab/triage/command_builders/cc_command_builder.rb +19 -0
  37. data/lib/gitlab/triage/command_builders/comment_command_builder.rb +19 -0
  38. data/lib/gitlab/triage/command_builders/label_command_builder.rb +40 -0
  39. data/lib/gitlab/triage/command_builders/move_command_builder.rb +19 -0
  40. data/lib/gitlab/triage/command_builders/remove_label_command_builder.rb +15 -0
  41. data/lib/gitlab/triage/command_builders/status_command_builder.rb +23 -0
  42. data/lib/gitlab/triage/command_builders/text_content_builder.rb +138 -0
  43. data/lib/gitlab/triage/engine.rb +635 -0
  44. data/lib/gitlab/triage/entity_builders/issue_builder.rb +54 -0
  45. data/lib/gitlab/triage/entity_builders/summary_builder.rb +82 -0
  46. data/lib/gitlab/triage/errors/network.rb +11 -0
  47. data/lib/gitlab/triage/errors.rb +1 -0
  48. data/lib/gitlab/triage/expand_condition/expansion.rb +203 -0
  49. data/lib/gitlab/triage/expand_condition/list.rb +25 -0
  50. data/lib/gitlab/triage/expand_condition/sequence.rb +25 -0
  51. data/lib/gitlab/triage/expand_condition.rb +23 -0
  52. data/lib/gitlab/triage/filters/assignee_member_conditions_filter.rb +13 -0
  53. data/lib/gitlab/triage/filters/author_member_conditions_filter.rb +13 -0
  54. data/lib/gitlab/triage/filters/base_conditions_filter.rb +58 -0
  55. data/lib/gitlab/triage/filters/branch_date_filter.rb +73 -0
  56. data/lib/gitlab/triage/filters/branch_protected_filter.rb +26 -0
  57. data/lib/gitlab/triage/filters/discussions_conditions_filter.rb +58 -0
  58. data/lib/gitlab/triage/filters/issue_date_conditions_filter.rb +78 -0
  59. data/lib/gitlab/triage/filters/member_conditions_filter.rb +84 -0
  60. data/lib/gitlab/triage/filters/merge_request_date_conditions_filter.rb +13 -0
  61. data/lib/gitlab/triage/filters/name_conditions_filter.rb +26 -0
  62. data/lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb +30 -0
  63. data/lib/gitlab/triage/filters/ruby_conditions_filter.rb +33 -0
  64. data/lib/gitlab/triage/filters/votes_conditions_filter.rb +54 -0
  65. data/lib/gitlab/triage/graphql_network.rb +81 -0
  66. data/lib/gitlab/triage/graphql_queries/query_builder.rb +158 -0
  67. data/lib/gitlab/triage/graphql_queries/query_param_builders/base_param_builder.rb +30 -0
  68. data/lib/gitlab/triage/graphql_queries/query_param_builders/date_param_builder.rb +35 -0
  69. data/lib/gitlab/triage/graphql_queries/query_param_builders/labels_param_builder.rb +18 -0
  70. data/lib/gitlab/triage/limiters/base_limiter.rb +35 -0
  71. data/lib/gitlab/triage/limiters/date_field_limiter.rb +45 -0
  72. data/lib/gitlab/triage/network.rb +39 -0
  73. data/lib/gitlab/triage/network_adapters/base_adapter.rb +17 -0
  74. data/lib/gitlab/triage/network_adapters/graphql_adapter.rb +92 -0
  75. data/lib/gitlab/triage/network_adapters/httparty_adapter.rb +116 -0
  76. data/lib/gitlab/triage/network_adapters/test_adapter.rb +39 -0
  77. data/lib/gitlab/triage/option_parser.rb +105 -0
  78. data/lib/gitlab/triage/options.rb +30 -0
  79. data/lib/gitlab/triage/param_builders/date_param_builder.rb +64 -0
  80. data/lib/gitlab/triage/policies/base_policy.rb +80 -0
  81. data/lib/gitlab/triage/policies/rule_policy.rb +36 -0
  82. data/lib/gitlab/triage/policies/summary_policy.rb +29 -0
  83. data/lib/gitlab/triage/policies_resources/rule_resources.rb +11 -0
  84. data/lib/gitlab/triage/policies_resources/summary_resources.rb +11 -0
  85. data/lib/gitlab/triage/resource/base.rb +102 -0
  86. data/lib/gitlab/triage/resource/branch.rb +13 -0
  87. data/lib/gitlab/triage/resource/context.rb +47 -0
  88. data/lib/gitlab/triage/resource/epic.rb +20 -0
  89. data/lib/gitlab/triage/resource/instance_version.rb +35 -0
  90. data/lib/gitlab/triage/resource/issue.rb +52 -0
  91. data/lib/gitlab/triage/resource/label.rb +56 -0
  92. data/lib/gitlab/triage/resource/label_event.rb +48 -0
  93. data/lib/gitlab/triage/resource/linked_issue.rb +15 -0
  94. data/lib/gitlab/triage/resource/merge_request.rb +23 -0
  95. data/lib/gitlab/triage/resource/milestone.rb +98 -0
  96. data/lib/gitlab/triage/resource/shared/issuable.rb +119 -0
  97. data/lib/gitlab/triage/rest_api_network.rb +125 -0
  98. data/lib/gitlab/triage/retryable.rb +33 -0
  99. data/lib/gitlab/triage/ui.rb +23 -0
  100. data/lib/gitlab/triage/url_builders/url_builder.rb +54 -0
  101. data/lib/gitlab/triage/utils.rb +13 -0
  102. data/lib/gitlab/triage/validators/limiter_validator.rb +21 -0
  103. data/lib/gitlab/triage/validators/params_validator.rb +43 -0
  104. data/lib/gitlab/triage/version.rb +7 -0
  105. data/lib/gitlab/triage.rb +6 -0
  106. data/support/.gitlab-ci.example.yml +22 -0
  107. data/support/.triage-policies.example.yml +51 -0
  108. metadata +280 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 76692ec37afef600bb2a8965cad393694e7428b1351535e5fe14b0e650ecb76a
4
+ data.tar.gz: dbbf66dc7de56db0f671d8c2c7648a41ba8d143fce50261a29a6250f4389229e
5
+ SHA512:
6
+ metadata.gz: a65a4a1362a30ff908807c3e1d17b1475e3c6694fafa122bab5d1e28320cde717879d3899a13ff886c68945e0dd7ea00b102e36de84b9ebb9fbea8b38e93e494
7
+ data.tar.gz: ce275d436cc96705305055be3f530661cec620217f10fe2fb85dde5cac5a7514688028ccdd93429fb474889d53444ee68b6ac4686cbaa2ffb9a28cf0b6039ef4
data/.codeclimate.yml ADDED
@@ -0,0 +1,19 @@
1
+ ---
2
+ engines:
3
+ bundler-audit:
4
+ enabled: true
5
+ duplication:
6
+ enabled: true
7
+ config:
8
+ languages:
9
+ - ruby
10
+ rubocop-gitlab:
11
+ enabled: true
12
+ ratings:
13
+ paths:
14
+ - Gemfile.lock
15
+ - "**.rb"
16
+ exclude_paths:
17
+ - spec/
18
+ - vendor/
19
+ - tmp/
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.DS_Store
2
+ /vendor/
3
+ /.rspec
4
+ /.bundle/
5
+ /.yardoc
6
+ /Gemfile.lock
7
+ /_yardoc/
8
+ /coverage/
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
12
+ /doc/
13
+
14
+ # rspec failure tracking
15
+ .rspec_status
@@ -0,0 +1,2 @@
1
+ # The official maintainers
2
+ * @gitlab-org/quality/engineering-productivity
@@ -0,0 +1,13 @@
1
+ ---
2
+ # Settings for generating changelogs using the GitLab API. See
3
+ # https://docs.gitlab.com/ee/api/repositories.html#generate-changelog-data for
4
+ # more information.
5
+ categories:
6
+ added: Added
7
+ fixed: Fixed
8
+ changed: Changed
9
+ deprecated: Deprecated
10
+ removed: Removed
11
+ security: Security
12
+ performance: Performance
13
+ other: Other
@@ -0,0 +1,13 @@
1
+ Before raising an issue to the GitLab issue tracker, please read through our guide for finding help to determine the best place to post:
2
+
3
+ * https://about.gitlab.com/getting-help/
4
+
5
+ If you are experiencing an issue when using GitLab.com, your first port of call should be the Community Forum. Your issue may have already been reported there by another user. Please check:
6
+
7
+ * https://forum.gitlab.com/
8
+
9
+ If you feel that your issue can be categorized as a reproducible bug or a feature proposal, please use one of the issue templates provided and include as much information as possible.
10
+
11
+ Thank you for helping to make GitLab a better product.
12
+
13
+ <!-- template sourced from https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/blob/master/.gitlab/issue_templates/Default.md -->
@@ -0,0 +1,11 @@
1
+ ## What does this MR do and why?
2
+
3
+ _Describe in detail what your merge request does and why._
4
+
5
+ <!--
6
+ Please keep this description updated with any discussion that takes place so
7
+ that reviewers can understand your intent. Keeping the description updated is
8
+ especially important if they didn't participate in the discussion.
9
+ -->
10
+
11
+ <!-- template sourced from https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/blob/master/.gitlab/merge_request_templates/Default.md -->
@@ -0,0 +1,13 @@
1
+ <!-- Replace `<PREVIOUS_VERSION>` with the previous version number here, `<COMMIT_UPDATING_VERSION>` with the latest
2
+ commit from this merge request, and `<NEW_VERSION>` with the upcoming version number. -->
3
+ ## Diff
4
+
5
+ https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/compare/v<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Diff link is up-to-date.
10
+ - [ ] Check the release notes: https://gitlab.com/api/v4/projects/3430480/repository/changelog?version=<NEW_VERSION>
11
+ - [ ] Based on the diff and the release notes, `version.rb` is updated, according to [SemVer](https://semver.org).
12
+
13
+ /label ~"type::tooling" ~"tooling::workflow" ~"ep::triage"
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,146 @@
1
+ stages:
2
+ - prepare
3
+ - test
4
+ - triage
5
+ - deploy
6
+
7
+ default:
8
+ image: ruby:2.7
9
+ tags:
10
+ - gitlab-org
11
+ cache:
12
+ key:
13
+ files:
14
+ - Gemfile
15
+ - gitlab-triage.gemspec
16
+ paths:
17
+ - vendor/ruby
18
+ - Gemfile.lock
19
+ policy: pull
20
+ before_script:
21
+ - ruby --version
22
+ - gem install bundler --no-document --version 2.0.2
23
+ - bundle --version
24
+ - bundle install --jobs $(nproc) --path=vendor --retry 3 --quiet
25
+ - bundle check
26
+
27
+ workflow:
28
+ rules:
29
+ # For merge requests, create a pipeline.
30
+ - if: '$CI_MERGE_REQUEST_IID'
31
+ # For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
32
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
33
+ # For tags, create a pipeline.
34
+ - if: '$CI_COMMIT_TAG'
35
+
36
+ .use-docker-in-docker:
37
+ image: docker:${DOCKER_VERSION}
38
+ services:
39
+ - docker:${DOCKER_VERSION}-dind
40
+ variables:
41
+ DOCKER_VERSION: "19.03.0"
42
+ DOCKER_DRIVER: overlay2
43
+ DOCKER_HOST: tcp://docker:2375
44
+ DOCKER_TLS_CERTDIR: ""
45
+ tags:
46
+ # See https://gitlab.com/gitlab-com/www-gitlab-com/-/issues/7019 for tag descriptions
47
+ - gitlab-org-docker
48
+
49
+ ###################
50
+ ## Prepare stage ##
51
+ ###################
52
+ setup-test-env:
53
+ stage: prepare
54
+ script:
55
+ - echo "Setup done!"
56
+ cache:
57
+ policy: pull-push
58
+ artifacts:
59
+ paths:
60
+ - Gemfile.lock
61
+
62
+ ################
63
+ ## Test stage ##
64
+ ################
65
+ rubocop:
66
+ stage: test
67
+ needs: ["setup-test-env"]
68
+ dependencies: ["setup-test-env"]
69
+ script:
70
+ - bundle exec rubocop --parallel
71
+ cache:
72
+ key: "$CI_JOB_NAME"
73
+ paths:
74
+ - .cache/rubocop_cache/
75
+
76
+ # We need to copy this job's definition from the Code-Quality.gitlab-ci.yml
77
+ # template because `only` is set without `refs`, so it takes precedence over default workflow rules.
78
+ # See https://gitlab.com/gitlab-org/gitlab-ce/issues/66767.
79
+ code_quality:
80
+ extends: .use-docker-in-docker
81
+ stage: test
82
+ allow_failure: true
83
+ variables:
84
+ DOCKER_TLS_CERTDIR: ""
85
+ before_script: []
86
+ script:
87
+ - |
88
+ if ! docker info &>/dev/null; then
89
+ if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
90
+ export DOCKER_HOST='tcp://localhost:2375'
91
+ fi
92
+ fi
93
+ - docker run
94
+ --env SOURCE_CODE="$PWD"
95
+ --volume "$PWD":/code
96
+ --volume /var/run/docker.sock:/var/run/docker.sock
97
+ "registry.gitlab.com/gitlab-org/security-products/codequality:12-0-stable" /code
98
+ artifacts:
99
+ reports:
100
+ codequality: gl-code-quality-report.json
101
+ expire_in: 1 week
102
+
103
+ specs:
104
+ needs: ["setup-test-env"]
105
+ stage: test
106
+ script:
107
+ - bundle exec rake spec
108
+
109
+ specs ruby3.0:
110
+ image: ruby:3.0
111
+ needs: ["setup-test-env"]
112
+ stage: test
113
+ script:
114
+ - bundle exec rake spec
115
+
116
+ ##################
117
+ ## Triage stage ##
118
+ ##################
119
+ dry-run:gitlab-triage:
120
+ needs: ["setup-test-env"]
121
+ stage: triage
122
+ script:
123
+ - bundle exec rake build
124
+ - gem install pkg/*.gem
125
+ - which gitlab-triage
126
+ - gitlab-triage --version
127
+ - gitlab-triage --help
128
+ - gitlab-triage --init
129
+ - gitlab-triage --dry-run --debug --source-id $CI_PROJECT_PATH
130
+
131
+ # This job requires allows to override the `CI_PROJECT_PATH` variable when triggered.
132
+ dry-run:custom:
133
+ extends: dry-run:gitlab-triage
134
+ rules:
135
+ - when: manual
136
+ allow_failure: true
137
+
138
+ include:
139
+ - template: Security/Dependency-Scanning.gitlab-ci.yml
140
+ - template: Security/License-Scanning.gitlab-ci.yml
141
+ - template: Security/SAST.gitlab-ci.yml
142
+ - template: Security/Secret-Detection.gitlab-ci.yml
143
+ - project: 'gitlab-org/quality/pipeline-common'
144
+ file:
145
+ - '/ci/danger-review.yml'
146
+ - '/ci/gem-release.yml'
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ inherit_gem:
4
+ gitlab-styles:
5
+ - rubocop-default.yml
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 2.7
9
+ Exclude:
10
+ - 'vendor/**/*'
11
+ - 'tmp/**/*'
12
+ CacheRootDirectory: tmp
13
+
14
+ Rails/Output:
15
+ Enabled: false
16
+
17
+ Metrics/LineLength:
18
+ Max: 152
19
+
20
+ Style/SingleArgumentDig:
21
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,145 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-05-26 15:15:19 UTC using RuboCop version 0.93.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 43
10
+ CodeReuse/ActiveRecord:
11
+ Exclude:
12
+ - 'lib/gitlab/triage/engine.rb'
13
+ - 'lib/gitlab/triage/graphql_network.rb'
14
+ - 'spec/gitlab/triage/engine_spec.rb'
15
+ - 'spec/gitlab/triage/graphql_network_spec.rb'
16
+ - 'spec/gitlab/triage/network_adapters/graphql_adapter_spec.rb'
17
+ - 'spec/gitlab/triage/rest_api_network_spec.rb'
18
+ - 'spec/gitlab/triage/policies/rule_policy_spec.rb'
19
+ - 'spec/gitlab/triage/resource/label_spec.rb'
20
+ - 'spec/support/expect_next_instance_of.rb'
21
+ - 'spec/support/shared_examples/issuable_shared_examples.rb'
22
+ - 'spec/support/shared_examples/label_command_shared_examples.rb'
23
+ - 'spec/support/stub_api.rb'
24
+
25
+ # Offense count: 1
26
+ # Cop supports --auto-correct.
27
+ Cop/LineBreakAroundConditionalBlock:
28
+ Exclude:
29
+ - 'lib/gitlab/triage/engine.rb'
30
+
31
+ # Offense count: 1
32
+ # Configuration parameters: Include.
33
+ # Include: **/*.gemspec
34
+ Gemspec/RequiredRubyVersion:
35
+ Exclude:
36
+ - 'gitlab-triage.gemspec'
37
+
38
+ # Offense count: 1
39
+ # Cop supports --auto-correct.
40
+ Lint/NonDeterministicRequireOrder:
41
+ Exclude:
42
+ - 'spec/spec_helper.rb'
43
+
44
+ # Offense count: 1
45
+ # Configuration parameters: IgnoredMethods.
46
+ Metrics/AbcSize:
47
+ Max: 57
48
+
49
+ # Offense count: 1
50
+ # Cop supports --auto-correct.
51
+ Performance/ConstantRegexp:
52
+ Exclude:
53
+ - 'lib/gitlab/triage/command_builders/text_content_builder.rb'
54
+
55
+ # Offense count: 2
56
+ # Cop supports --auto-correct.
57
+ # Configuration parameters: SafeMultiline.
58
+ Performance/DeleteSuffix:
59
+ Exclude:
60
+ - 'lib/gitlab/triage/api_query_builders/date_query_param_builder.rb'
61
+ - 'lib/gitlab/triage/graphql_queries/query_param_builders/date_param_builder.rb'
62
+
63
+ # Offense count: 5
64
+ Performance/MethodObjectAsBlock:
65
+ Exclude:
66
+ - 'lib/gitlab/triage/engine.rb'
67
+ - 'lib/gitlab/triage/entity_builders/issue_builder.rb'
68
+ - 'lib/gitlab/triage/expand_condition.rb'
69
+ - 'lib/gitlab/triage/expand_condition/expansion.rb'
70
+ - 'lib/gitlab/triage/limiters/date_field_limiter.rb'
71
+
72
+ # Offense count: 31
73
+ # Cop supports --auto-correct.
74
+ RSpec/EmptyLineAfterLetBlock:
75
+ Enabled: false
76
+
77
+ # Offense count: 93
78
+ # Configuration parameters: AllowSubject.
79
+ RSpec/MultipleMemoizedHelpers:
80
+ Max: 12
81
+
82
+ # Offense count: 12
83
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
84
+ RSpec/VerifiedDoubles:
85
+ Exclude:
86
+ - 'spec/gitlab/triage/graphql_network_spec.rb'
87
+ - 'spec/gitlab/triage/network_adapters/graphql_adapter_spec.rb'
88
+ - 'spec/gitlab/triage/rest_api_network_spec.rb'
89
+ - 'spec/support/shared_examples/label_command_shared_examples.rb'
90
+
91
+ # Offense count: 1
92
+ # Cop supports --auto-correct.
93
+ Rails/IndexBy:
94
+ Exclude:
95
+ - 'lib/gitlab/triage/engine.rb'
96
+
97
+ # Offense count: 1
98
+ # Cop supports --auto-correct.
99
+ Rails/NegateInclude:
100
+ Exclude:
101
+ - 'lib/gitlab/triage/filters/member_conditions_filter.rb'
102
+
103
+ # Offense count: 3
104
+ # Cop supports --auto-correct.
105
+ Rails/Pluck:
106
+ Exclude:
107
+ - 'lib/gitlab/triage/filters/base_conditions_filter.rb'
108
+ - 'lib/gitlab/triage/filters/member_conditions_filter.rb'
109
+ - 'lib/gitlab/triage/validators/limiter_validator.rb'
110
+
111
+ # Offense count: 2
112
+ # Cop supports --auto-correct.
113
+ Style/ArrayCoercion:
114
+ Exclude:
115
+ - 'lib/gitlab/triage/graphql_network.rb'
116
+
117
+ # Offense count: 1
118
+ # Cop supports --auto-correct.
119
+ Style/ExplicitBlockArgument:
120
+ Exclude:
121
+ - 'spec/support/expect_next_instance_of.rb'
122
+
123
+ # Offense count: 115
124
+ # Cop supports --auto-correct.
125
+ # Configuration parameters: EnforcedStyle.
126
+ # SupportedStyles: always, always_true, never
127
+ Style/FrozenStringLiteralComment:
128
+ Enabled: false
129
+
130
+ # Offense count: 5
131
+ Style/OpenStructUse:
132
+ Exclude:
133
+ - 'spec/gitlab/triage/network_adapters/httparty_adapter_spec.rb'
134
+
135
+ # Offense count: 1
136
+ # Cop supports --auto-correct.
137
+ Style/RedundantRegexpEscape:
138
+ Exclude:
139
+ - 'lib/gitlab/triage/command_builders/text_content_builder.rb'
140
+
141
+ # Offense count: 1
142
+ # Configuration parameters: AllowModifier.
143
+ Style/SoleNestedConditional:
144
+ Exclude:
145
+ - 'lib/gitlab/triage/validators/params_validator.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.4
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.4
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --protected
2
+ --private
3
+ -
4
+ LICENSE.md
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,31 @@
1
+ ## Developer Certificate of Origin + License
2
+
3
+ By contributing to GitLab B.V., You accept and agree to the following terms and
4
+ conditions for Your present and future Contributions submitted to GitLab B.V.
5
+ Except for the license granted herein to GitLab B.V. and recipients of software
6
+ distributed by GitLab B.V., You reserve all right, title, and interest in and to
7
+ Your Contributions. All Contributions are subject to the following DCO + License
8
+ terms.
9
+
10
+ [DCO + License](https://gitlab.com/gitlab-org/dco/blob/master/README.md)
11
+
12
+ ## Style guide
13
+
14
+ This project employs [rubocop](https://github.com/bbatsov/rubocop) to enforce code styles. Check your new branch by:
15
+
16
+ ```
17
+ git checkout my_branch
18
+ bundle install --path vendor/bundle
19
+ bundle exec rubocop
20
+ ```
21
+
22
+ ## Testing
23
+
24
+ - Please consider tests for any code change that is made
25
+ - Please ensure that the existing test suite passes
26
+
27
+ ```
28
+ git checkout my_branch
29
+ bundle install --path vendor/bundle
30
+ bundle exec rake spec
31
+ ```
data/Dangerfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gitlab-dangerfiles'
4
+
5
+ Gitlab::Dangerfiles.for_project(self, &:import_defaults)
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gitlab-rubocop.gemspec
4
+ gemspec
5
+
6
+ gem "yard"
7
+
8
+ group :test do
9
+ gem 'gitlab-styles', '~> 7.0'
10
+ end
11
+
12
+ group :development, :test, :danger do
13
+ gem 'gitlab-dangerfiles', '~> 2.11.0', require: false
14
+ gem 'guard-rspec', '~> 4.7.3', require: false
15
+ end
data/Guardfile ADDED
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec -f doc" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w[erb haml slim])
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.call("routing/#{m[1]}_routing"),
51
+ rspec.spec.call("controllers/#{m[1]}_controller"),
52
+ rspec.spec.call("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
data/LICENSE.md ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2011-2017 GitLab B.V.
2
+
3
+ With regard to the GitLab Software:
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
23
+ For all third party components incorporated into the GitLab Software, those
24
+ components are licensed under the original license provided by the owner of the
25
+ applicable component.