gitlab-triage 1.42.1 → 1.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.git-blame-ignore-revs +43 -0
  3. data/.gitlab-ci.yml +51 -50
  4. data/.rubocop.yml +34 -3
  5. data/.rubocop_todo.yml +32 -96
  6. data/.ruby-version +1 -1
  7. data/.tool-versions +1 -1
  8. data/Gemfile +2 -12
  9. data/Guardfile +2 -0
  10. data/Rakefile +2 -0
  11. data/bin/gitlab-triage +1 -0
  12. data/gitlab-triage.gemspec +14 -4
  13. data/lib/gitlab/triage/action/base.rb +5 -3
  14. data/lib/gitlab/triage/action.rb +2 -0
  15. data/lib/gitlab/triage/api_query_builders/base_query_param_builder.rb +2 -0
  16. data/lib/gitlab/triage/api_query_builders/date_query_param_builder.rb +3 -1
  17. data/lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb +2 -0
  18. data/lib/gitlab/triage/api_query_builders/single_query_param_builder.rb +2 -0
  19. data/lib/gitlab/triage/command_builders/base_command_builder.rb +2 -0
  20. data/lib/gitlab/triage/command_builders/cc_command_builder.rb +2 -0
  21. data/lib/gitlab/triage/command_builders/comment_command_builder.rb +2 -0
  22. data/lib/gitlab/triage/command_builders/label_command_builder.rb +3 -1
  23. data/lib/gitlab/triage/command_builders/move_command_builder.rb +2 -0
  24. data/lib/gitlab/triage/command_builders/remove_label_command_builder.rb +2 -0
  25. data/lib/gitlab/triage/command_builders/status_command_builder.rb +2 -0
  26. data/lib/gitlab/triage/command_builders/text_content_builder.rb +2 -2
  27. data/lib/gitlab/triage/engine.rb +8 -3
  28. data/lib/gitlab/triage/errors/network.rb +2 -0
  29. data/lib/gitlab/triage/errors.rb +2 -0
  30. data/lib/gitlab/triage/expand_condition/expansion.rb +2 -0
  31. data/lib/gitlab/triage/expand_condition/list.rb +3 -1
  32. data/lib/gitlab/triage/expand_condition/sequence.rb +3 -1
  33. data/lib/gitlab/triage/expand_condition.rb +2 -0
  34. data/lib/gitlab/triage/filters/assignee_member_conditions_filter.rb +2 -0
  35. data/lib/gitlab/triage/filters/author_member_conditions_filter.rb +2 -0
  36. data/lib/gitlab/triage/filters/base_conditions_filter.rb +3 -3
  37. data/lib/gitlab/triage/filters/branch_date_filter.rb +2 -0
  38. data/lib/gitlab/triage/filters/branch_protected_filter.rb +2 -0
  39. data/lib/gitlab/triage/filters/discussions_conditions_filter.rb +2 -0
  40. data/lib/gitlab/triage/filters/issue_date_conditions_filter.rb +2 -0
  41. data/lib/gitlab/triage/filters/member_conditions_filter.rb +4 -4
  42. data/lib/gitlab/triage/filters/merge_request_date_conditions_filter.rb +2 -0
  43. data/lib/gitlab/triage/filters/name_conditions_filter.rb +2 -0
  44. data/lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb +2 -0
  45. data/lib/gitlab/triage/filters/ruby_conditions_filter.rb +2 -0
  46. data/lib/gitlab/triage/filters/votes_conditions_filter.rb +2 -0
  47. data/lib/gitlab/triage/graphql_network.rb +2 -0
  48. data/lib/gitlab/triage/graphql_queries/query_builder.rb +3 -1
  49. data/lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb +2 -0
  50. data/lib/gitlab/triage/graphql_queries/query_param_builders/base_param_builder.rb +2 -0
  51. data/lib/gitlab/triage/graphql_queries/query_param_builders/date_param_builder.rb +3 -1
  52. data/lib/gitlab/triage/limiters/base_limiter.rb +2 -0
  53. data/lib/gitlab/triage/limiters/date_field_limiter.rb +2 -0
  54. data/lib/gitlab/triage/network.rb +2 -0
  55. data/lib/gitlab/triage/network_adapters/base_adapter.rb +2 -0
  56. data/lib/gitlab/triage/network_adapters/graphql_adapter.rb +3 -1
  57. data/lib/gitlab/triage/network_adapters/httparty_adapter.rb +2 -0
  58. data/lib/gitlab/triage/network_adapters/test_adapter.rb +3 -1
  59. data/lib/gitlab/triage/option_parser.rb +2 -0
  60. data/lib/gitlab/triage/options.rb +2 -0
  61. data/lib/gitlab/triage/param_builders/date_param_builder.rb +2 -0
  62. data/lib/gitlab/triage/resource/base.rb +3 -0
  63. data/lib/gitlab/triage/resource/instance_version.rb +2 -0
  64. data/lib/gitlab/triage/resource/milestone.rb +2 -0
  65. data/lib/gitlab/triage/rest_api_network.rb +2 -0
  66. data/lib/gitlab/triage/retryable.rb +2 -0
  67. data/lib/gitlab/triage/ui.rb +2 -0
  68. data/lib/gitlab/triage/url_builders/url_builder.rb +2 -0
  69. data/lib/gitlab/triage/utils.rb +2 -0
  70. data/lib/gitlab/triage/validators/limiter_validator.rb +3 -3
  71. data/lib/gitlab/triage/validators/params_validator.rb +3 -3
  72. data/lib/gitlab/triage/version.rb +1 -1
  73. data/lib/gitlab/triage.rb +2 -0
  74. metadata +74 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b58096f8556f0fceef5cb4ad808627438bbbad5962902ac4cebfdf01b20d28b
4
- data.tar.gz: 1678304df863fa81f4977551d1e204efbbeb1befd8ab0a829feb51c5b843ddc0
3
+ metadata.gz: 95d1d38e50b3032593baffe5e3122da139f542294529cadaaffa5e2861d0a428
4
+ data.tar.gz: 83ac90f1c5815c5a39a6cb5d3d84b34112a1a3a72f2dd9a9481291bc171648c3
5
5
  SHA512:
6
- metadata.gz: ea8a58b37b831b5ed2bc4194358696b55d63bb4250a1f0b8683437d68a8937660017bc497a7c6dc77090593bcb30f603f695a64472ecc4400264513be1bf53df
7
- data.tar.gz: 8a636467bd94cf03817d97810a5cc082946631586f00c6e82d4ef1f83d7eda5809e113ac6edb61541e9db56333a9d01d67fb49b581dfdc1f36ef18b6bd5aa555
6
+ metadata.gz: 8d0aef0429e6892959468c199b0bddbb18ecf02bf864ee038f59b01f35e779a200724e8841b3f603add6267a5a6b3c7746520d10bc48d77c2a6a025e5d3ddaa2
7
+ data.tar.gz: 70ea6376e7855ce5ac2207d0f0dc779d8d4e32eb800192c5d3ec8cbfa546425797087525c6a281bfd5513b4d8d4619cf6a81e7fd2e59b7c48d77972653ca5b37
@@ -0,0 +1,43 @@
1
+ # This file contains revisions to be ignored by git blame.
2
+ # These revisions are expected to be formatting-only changes.
3
+ #
4
+ # Calling `git blame --ignore-revs-file .git-blame-ignore-revs` will
5
+ # tell git blame to ignore changes made by these revisions when
6
+ # assigning blame, as if the change never happened.
7
+ #
8
+ # You can enable this as a default for your local repository by running
9
+ # `git config blame.ignoreRevsFile .git-blame-ignore-revs`
10
+ # This will probably be automatically picked by your IDE
11
+ # (VSCode+GitLens and JetBrains products are confirmed to this)
12
+ #
13
+ # Important: if you are switching to the branch without this file,
14
+ # `git blame` will fail with an error
15
+ #
16
+ # Guidelines:
17
+ # - Only large automated refactorings are expected to be included in this file.
18
+ # Do not add a new revision just because it is deemed trivial or unimportant
19
+ # - When adding a single revision, use inline comments to link relevant issues and merge requests
20
+ # Example:
21
+ #
22
+ # # d4a8b7307acc2dc8a8833ccfa65426ad28b3ffc9 # https://gitlab.com/gitlab-org/frontend/rfcs/-/issues/60
23
+ #
24
+ # - When adding multiple revisions precede each addition (this could be multiple revisions) with a link to
25
+ # line with word START and link to relevant issue/MR/epic and conclude with line END and link to the
26
+ # same issue/MR/epic
27
+ # Example:
28
+ # # START https://gitlab.com/gitlab-org/issues/12345
29
+ # 6f0bd2d8a1e6cd2e794cd39976e9756e0c85ac66
30
+ # d53974df11dbc22cbea9dc7dcbc9896c25979a27
31
+ # ... <rest of the list>
32
+ # # END https://gitlab.com/gitlab-org/issues/12345
33
+ # - Please append new lines to the end of the file, no matter of real chronological
34
+ # order of revisions
35
+ # - Since this is using hashes for reformatting it might be a good idea to update
36
+ # this file in separate MR when relevant changes already landed in master. By
37
+ # utilizing this manner you will be safe from random rebase/squash issues
38
+ # - Only put full 40-character hashes on this list
39
+
40
+ # START https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/issues/340
41
+ 49e0b4f890c4f38ae586c6b1bdca5ff3b0c04af1
42
+ aba491f68f0d4a6c088deb6cb281755d6c7a7f0b
43
+ # END https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/issues/340
data/.gitlab-ci.yml CHANGED
@@ -5,9 +5,10 @@ stages:
5
5
  - deploy
6
6
 
7
7
  default:
8
- image: ruby:3.0
9
8
  tags:
10
9
  - gitlab-org
10
+
11
+ .ruby-cache: &ruby-cache
11
12
  cache:
12
13
  key:
13
14
  files:
@@ -17,9 +18,13 @@ default:
17
18
  - vendor/ruby
18
19
  - Gemfile.lock
19
20
  policy: pull
21
+
22
+ .use-ruby:
23
+ image: ruby:3.2
24
+ <<: *ruby-cache
20
25
  before_script:
21
26
  - ruby --version
22
- - gem install bundler --no-document --version 2.0.2
27
+ - gem install bundler --no-document
23
28
  - bundle --version
24
29
  - bundle install --jobs $(nproc) --path=vendor --retry 3 --quiet
25
30
  - bundle check
@@ -33,23 +38,11 @@ workflow:
33
38
  # For tags, create a pipeline.
34
39
  - if: '$CI_COMMIT_TAG'
35
40
 
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
41
  ###################
50
42
  ## Prepare stage ##
51
43
  ###################
52
44
  setup-test-env:
45
+ extends: .use-ruby
53
46
  stage: prepare
54
47
  script:
55
48
  - echo "Setup done!"
@@ -63,6 +56,7 @@ setup-test-env:
63
56
  ## Test stage ##
64
57
  ################
65
58
  rubocop:
59
+ extends: .use-ruby
66
60
  stage: test
67
61
  needs: ["setup-test-env"]
68
62
  dependencies: ["setup-test-env"]
@@ -73,43 +67,26 @@ rubocop:
73
67
  paths:
74
68
  - .cache/rubocop_cache/
75
69
 
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
70
  specs:
71
+ extends: .use-ruby
104
72
  needs: ["setup-test-env"]
105
73
  stage: test
106
74
  script:
107
75
  - bundle exec rake spec
76
+ image: $RUBY_IMAGE
77
+ parallel:
78
+ matrix:
79
+ - RUBY_IMAGE:
80
+ - ruby:3.0
81
+ - ruby:3.1
82
+ - ruby:3.2
83
+ - ruby:3.3
108
84
 
109
85
  ##################
110
86
  ## Triage stage ##
111
87
  ##################
112
88
  dry-run:gitlab-triage:
89
+ extends: .use-ruby
113
90
  needs: ["setup-test-env"]
114
91
  stage: triage
115
92
  script:
@@ -129,11 +106,35 @@ dry-run:custom:
129
106
  allow_failure: true
130
107
 
131
108
  include:
132
- - template: Security/Dependency-Scanning.gitlab-ci.yml
133
- - template: Security/License-Scanning.gitlab-ci.yml
134
- - template: Security/SAST.gitlab-ci.yml
135
- - template: Security/Secret-Detection.gitlab-ci.yml
136
- - project: 'gitlab-org/quality/pipeline-common'
137
- file:
138
- - '/ci/danger-review.yml'
139
- - '/ci/gem-release.yml'
109
+ - component: gitlab.com/components/code-quality/code-quality@~latest
110
+ - component: gitlab.com/components/sast/sast@~latest
111
+ - component: gitlab.com/components/secret-detection/secret-detection@~latest
112
+ - component: gitlab.com/gitlab-org/components/danger-review/danger-review@~latest
113
+ - component: gitlab.com/gitlab-org/components/gem-release/gem-release@~latest
114
+ - template: Jobs/Dependency-Scanning.gitlab-ci.yml
115
+
116
+ .component-general-rules: &component-general-rules
117
+ rules:
118
+ - if: '$CI_MERGE_REQUEST_IID'
119
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
120
+
121
+ code_quality:
122
+ # We explicitly set dependencies here as the component sets them to []
123
+ # This allows us to get the cache from the setup job that includes the Gemfile.lock
124
+ dependencies: ["setup-test-env"]
125
+ tags:
126
+ - gitlab-org-docker
127
+ # We explicitly override allow_failure here as the component sets it to true
128
+ # Can be moved to a component input after: https://gitlab.com/components/code-quality/-/merge_requests/8
129
+ allow_failure: false
130
+ <<: *ruby-cache
131
+ <<: *component-general-rules
132
+
133
+ semgrep-sast:
134
+ <<: *component-general-rules
135
+
136
+ gemnasium-dependency_scanning:
137
+ <<: *component-general-rules
138
+
139
+ secret_detection:
140
+ <<: *component-general-rules
data/.rubocop.yml CHANGED
@@ -12,11 +12,42 @@ AllCops:
12
12
  - 'tmp/**/*'
13
13
  CacheRootDirectory: tmp
14
14
 
15
- Rails/Output:
16
- Enabled: false
17
-
18
15
  Layout/LineLength:
19
16
  Max: 152
20
17
 
21
18
  Style/SingleArgumentDig:
22
19
  Enabled: false
20
+
21
+ GitlabSecurity/PublicSend:
22
+ Enabled: true
23
+ Exclude:
24
+ # FIXME: this is not an entirely good practice and we should aim to correct these!
25
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/issues/342
26
+ - 'spec/**/*.rb'
27
+
28
+ # rationale: no easy autocorrection, makes the specs fail.
29
+ # should be possible to fix with some additional work, but
30
+ # the gains do not seem to be worth the effort.
31
+ RSpec/Rails/TravelAround:
32
+ Enabled: false
33
+
34
+ # rationale: we upload via CI - so this is currently not supported in our workflow.
35
+ # context: https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage/-/merge_requests/313#note_1601520801
36
+ Gemspec/RequireMFA:
37
+ Enabled: false
38
+
39
+ # rationale: it's okay to have empty blocks in specs
40
+ Lint/EmptyBlock:
41
+ Exclude:
42
+ - 'spec/**/*.rb'
43
+
44
+ # rationale: these files do not seem overly harmful to violate this rule,
45
+ # but overall, seems good to keep enabled
46
+ RSpec/IndexedLet:
47
+ Exclude:
48
+ - 'spec/integration/select_issues_by_weight_spec.rb'
49
+ - 'spec/integration/select_merge_requests_by_source_branch_spec.rb'
50
+
51
+ # rationale: Maybe we should? For now, let's keep it disabled and revisit at a later point.
52
+ Rails/Output:
53
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,83 +1,65 @@
1
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.
2
+ # `rubocop --auto-gen-config --exclude-limit 10000`
3
+ # on 2024-04-16 16:23:46 UTC using RuboCop version 1.57.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 43
9
+ # Offense count: 67
10
10
  CodeReuse/ActiveRecord:
11
11
  Exclude:
12
12
  - 'lib/gitlab/triage/engine.rb'
13
+ - 'lib/gitlab/triage/filters/base_conditions_filter.rb'
14
+ - 'lib/gitlab/triage/filters/member_conditions_filter.rb'
13
15
  - 'lib/gitlab/triage/graphql_network.rb'
16
+ - 'lib/gitlab/triage/validators/limiter_validator.rb'
17
+ - 'spec/gitlab/triage/action_spec.rb'
14
18
  - 'spec/gitlab/triage/engine_spec.rb'
15
19
  - 'spec/gitlab/triage/graphql_network_spec.rb'
16
20
  - 'spec/gitlab/triage/network_adapters/graphql_adapter_spec.rb'
17
- - 'spec/gitlab/triage/rest_api_network_spec.rb'
18
21
  - 'spec/gitlab/triage/policies/rule_policy_spec.rb'
19
22
  - 'spec/gitlab/triage/resource/label_spec.rb'
20
- - 'spec/support/expect_next_instance_of.rb'
23
+ - 'spec/gitlab/triage/rest_api_network_spec.rb'
21
24
  - 'spec/support/shared_examples/issuable_shared_examples.rb'
22
25
  - 'spec/support/shared_examples/label_command_shared_examples.rb'
23
26
  - 'spec/support/stub_api.rb'
24
27
 
25
28
  # Offense count: 1
26
- # Cop supports --auto-correct.
27
- Cop/LineBreakAroundConditionalBlock:
29
+ Lint/ToEnumArguments:
28
30
  Exclude:
29
31
  - 'lib/gitlab/triage/engine.rb'
30
32
 
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
33
+ # Offense count: 4
64
34
  Performance/MethodObjectAsBlock:
65
35
  Exclude:
66
36
  - 'lib/gitlab/triage/engine.rb'
67
- - 'lib/gitlab/triage/entity_builders/issue_builder.rb'
68
37
  - 'lib/gitlab/triage/expand_condition.rb'
69
38
  - 'lib/gitlab/triage/expand_condition/expansion.rb'
70
39
  - 'lib/gitlab/triage/limiters/date_field_limiter.rb'
71
40
 
72
- # Offense count: 31
73
- # Cop supports --auto-correct.
74
- RSpec/EmptyLineAfterLetBlock:
75
- Enabled: false
76
-
77
- # Offense count: 93
41
+ # Offense count: 167
78
42
  # Configuration parameters: AllowSubject.
79
43
  RSpec/MultipleMemoizedHelpers:
80
- Max: 12
44
+ Max: 10
45
+
46
+ # Offense count: 10
47
+ # Configuration parameters: AllowedPatterns.
48
+ # AllowedPatterns: ^expect_, ^assert_
49
+ RSpec/NoExpectationExample:
50
+ Exclude:
51
+ - 'spec/integration/filter_by_votes_spec.rb'
52
+ - 'spec/integration/generate_summary_spec.rb'
53
+ - 'spec/integration/no_newline_in_titles_spec.rb'
54
+ - 'spec/integration/redact_confidentials_spec.rb'
55
+ - 'spec/integration/summary_policies_spec.rb'
56
+
57
+ # Offense count: 1
58
+ # Configuration parameters: Include.
59
+ # Include: **/*_spec*rb*, **/spec/**/*
60
+ RSpec/SpecFilePathSuffix:
61
+ Exclude:
62
+ - 'spec/integration/issue_action_policy.rb'
81
63
 
82
64
  # Offense count: 12
83
65
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
@@ -89,57 +71,11 @@ RSpec/VerifiedDoubles:
89
71
  - 'spec/support/shared_examples/label_command_shared_examples.rb'
90
72
 
91
73
  # Offense count: 1
92
- # Cop supports --auto-correct.
93
- Rails/IndexBy:
74
+ Style/DocumentDynamicEvalDefinition:
94
75
  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
76
+ - 'lib/gitlab/triage/resource/context.rb'
129
77
 
130
78
  # Offense count: 5
131
79
  Style/OpenStructUse:
132
80
  Exclude:
133
81
  - '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 CHANGED
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.2.3
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.0.5
1
+ ruby 3.2.3
data/Gemfile CHANGED
@@ -1,16 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in gitlab-rubocop.gemspec
4
6
  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
- gem 'lefthook', '~> 1.3', require: false
16
- end
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/gitlab-triage CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'yaml'
4
5
  require_relative '../lib/gitlab/triage/option_parser'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'gitlab/triage/version'
@@ -14,6 +16,7 @@ Gem::Specification.new do |spec|
14
16
  spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
15
17
 
16
18
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
+ spec.metadata["rubygems_mfa_required"] = 'false'
17
20
 
18
21
  spec.metadata["homepage_uri"] = spec.homepage
19
22
  spec.metadata["source_code_uri"] = "https://gitlab.com/gitlab-org/ruby/gems/gitlab-triage"
@@ -22,7 +25,7 @@ Gem::Specification.new do |spec|
22
25
  # Specify which files should be added to the gem when it is released.
23
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
27
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0").reject { |f| f.match?(%r{^(docs?|spec|tmp)/}) }
28
+ `git ls-files -z`.split("\x0").grep_v(%r{^(docs?|spec|tmp)/})
26
29
  end
27
30
  spec.bindir = 'bin'
28
31
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -39,9 +42,16 @@ Gem::Specification.new do |spec|
39
42
  spec.add_dependency 'graphql', '< 2.1.0'
40
43
  spec.add_dependency 'httparty', '~> 0.17'
41
44
 
42
- spec.add_development_dependency 'bundler'
43
- spec.add_development_dependency 'gitlab-styles', '~> 2.8'
44
- spec.add_development_dependency 'rake', '~> 10.2'
45
+ spec.add_development_dependency 'gitlab-dangerfiles', '~> 2.11.0'
46
+ spec.add_development_dependency 'gitlab-styles', '~> 10.0'
47
+ spec.add_development_dependency 'guard-rspec', '~> 4.7.3'
48
+ spec.add_development_dependency 'lefthook', '~> 1.3'
49
+ spec.add_development_dependency 'rake', '~> 13.2'
45
50
  spec.add_development_dependency 'rspec', '~> 3.8'
51
+ # we do not commit the bundle lockfile, so this temporary workaround needs to be
52
+ # present until 2.21.3 or 2.22.x is released
53
+ # See https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles/-/issues/63
54
+ spec.add_development_dependency 'rubocop-rails', '!= 2.21.2'
46
55
  spec.add_development_dependency 'webmock', '~> 3.4'
56
+ spec.add_development_dependency 'yard'
47
57
  end
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module Triage
3
5
  module Action
4
6
  class Base
5
7
  attr_reader :policy, :network
6
8
 
7
- def initialize(policy:, network:)
8
- @policy = policy
9
- @network = network
9
+ def initialize(**args)
10
+ @policy = args[:policy]
11
+ @network = args[:network]
10
12
  end
11
13
  end
12
14
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'action/summarize'
2
4
  require_relative 'action/comment'
3
5
  require_relative 'action/comment_on_summary'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module Triage
3
5
  module APIQueryBuilders
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../param_builders/date_param_builder'
2
4
  require_relative 'base_query_param_builder'
3
5
 
@@ -25,7 +27,7 @@ module Gitlab
25
27
  private
26
28
 
27
29
  def build_param_name(condition_hash)
28
- prefix = condition_hash[:attribute].to_s.sub(/_at\z/, '')
30
+ prefix = condition_hash[:attribute].to_s.delete_suffix('_at')
29
31
  suffix =
30
32
  case condition_hash[:condition].to_sym
31
33
  when :older_than
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_query_param_builder'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_query_param_builder'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  module Triage
3
5
  module CommandBuilders
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_command_builder'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_command_builder'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_command_builder'
2
4
 
3
5
  module Gitlab
@@ -22,7 +24,7 @@ module Gitlab
22
24
 
23
25
  unless Resource::Label.new(label_opts, network: network).exist?
24
26
  raise Resource::Label::LabelDoesntExistError,
25
- "Label `#{label}` doesn't exist!"
27
+ "Label `#{label}` doesn't exist!"
26
28
  end
27
29
  end
28
30
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_command_builder'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_command_builder'
2
4
 
3
5
  module Gitlab
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_command_builder'
2
4
 
3
5
  module Gitlab
@@ -35,7 +35,7 @@ module Gitlab
35
35
  items: "{{items}}",
36
36
  name: "{{name}}"
37
37
  }.freeze
38
- PLACEHOLDER_REGEX = /{{([\w\.]+)}}/.freeze
38
+ PLACEHOLDER_REGEX = /{{([\w.]+)}}/
39
39
 
40
40
  def initialize(
41
41
  items, resource: nil, network: nil, redact_confidentials: true)
@@ -69,7 +69,7 @@ module Gitlab
69
69
  SUPPORTED_PLACEHOLDERS.inject(item) do |comment, (placeholder, template)|
70
70
  next comment unless comment.include?("{{#{placeholder}}}")
71
71
 
72
- path = template[/.*#{PLACEHOLDER_REGEX}.*/, 1]
72
+ path = template[/.*#{PLACEHOLDER_REGEX}.*/o, 1]
73
73
  attributes = extract_attributes(path)
74
74
 
75
75
  formatted_text = attributes.map do |attribute|