Skip to content
Snippets Groups Projects
Verified Commit 9a783aff authored by David Dieulivol's avatar David Dieulivol :speech_balloon:
Browse files

Add automated fixes for rubocop offenses

parent 991d1bb7
No related branches found
No related tags found
Loading
Showing
with 72 additions and 672 deletions
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-09-23 10:30:00 UTC using RuboCop version 1.36.0.
# on 2022-10-05 13:52:42 UTC using RuboCop version 1.36.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
......@@ -11,17 +11,6 @@ Cop/AvoidReturnFromBlocks:
Exclude:
- 'lib/flaky_report.rb'
# Offense count: 1
Cop/LineBreakAfterGuardClauses:
Exclude:
- 'triage/triage/job.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Cop/LineBreakAroundConditionalBlock:
Exclude:
- 'lib/schedule/manager.rb'
# Offense count: 5
Fips/MD5:
Exclude:
......@@ -31,226 +20,9 @@ Fips/MD5:
- 'triage/processor/community/command_mr_request_review.rb'
- 'triage/triage/percentage_rollout.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Fips/OpenSSL:
Exclude:
- 'triage/rack/authenticator.rb'
# Offense count: 19
# Offense count: 22
GitlabSecurity/PublicSend:
Exclude:
- 'spec/**/*'
- 'lib/add_legal_disclaimer_to_epic.rb'
- 'lib/generate/group_policy.rb'
- 'lib/generate/stage_policy.rb'
- 'lib/lazy_heat_map.rb'
- 'lib/schedule/manager.rb'
- 'lib/schedule/variant.rb'
- 'lib/stale_resources_helper.rb'
- 'lib/versioned_milestone.rb'
- 'triage/job/keep_cache_warm_job.rb'
- 'triage/triage.rb'
- 'triage/triage/event.rb'
- 'triage/triage/unique_comment.rb'
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_argument, with_fixed_indentation
Layout/ArgumentAlignment:
Exclude:
- 'spec/processor/appsec/approved_by_appsec_spec.rb'
- 'spec/processor/appsec/appsec_approval_label_added_spec.rb'
- 'spec/processor/appsec/ping_appsec_on_approval_spec.rb'
- 'triage/processor/label_inference.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleAlignWith.
# SupportedStylesAlignWith: either, start_of_block, start_of_line
Layout/BlockAlignment:
Exclude:
- 'spec/processor/merge_request_ci_title_label_spec.rb'
# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
Layout/ClosingHeredocIndentation:
Exclude:
- 'spec/processor/appsec/approved_by_appsec_spec.rb'
- 'spec/processor/appsec/appsec_approval_label_added_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment.
Layout/CommentIndentation:
Exclude:
- 'spec/spec_helper.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Layout/ElseAlignment:
Exclude:
- 'lib/group_definition.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'triage/triage/job.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLines:
Exclude:
- 'spec/processor/breaking_change_comment_spec.rb'
- 'spec/triage/related_issue_finder_spec.rb'
# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'lib/schedule/manager.rb'
- 'spec/lib/missed_resource_helper_spec.rb'
- 'spec/lib/resource_helper_spec.rb'
- 'spec/processor/customer_label_spec.rb'
- 'spec/triage/event_spec.rb'
- 'spec/triage/reactive_command_spec.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
Layout/EmptyLinesAroundClassBody:
Exclude:
- 'triage/processor/community/code_review_experience_feedback.rb'
- 'triage/rack/request_logger.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleAlignWith, Severity.
# SupportedStylesAlignWith: keyword, variable, start_of_line
Layout/EndAlignment:
Exclude:
- 'lib/group_definition.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
Layout/ExtraSpacing:
Exclude:
- 'spec/lib/slo_breach_helper_spec.rb'
- 'triage/processor/community/code_review_experience_feedback.rb'
- 'triage/processor/pajamas_missing_workflow_label_or_weight.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
Layout/FirstArgumentIndentation:
Exclude:
- 'lib/devops_labels.rb'
- 'spec/processor/pajamas_missing_workflow_label_or_weight_spec.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: normal, indented_internal_methods
Layout/IndentationConsistency:
Exclude:
- 'spec/processor/availability_priority_spec.rb'
- 'spec/processor/merge_request_ci_title_label_spec.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
Layout/IndentationWidth:
Exclude:
- 'lib/group_definition.rb'
- 'lib/group_triage_helper.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineArrayBraceLayout:
Exclude:
- 'triage/processor/copy_security_issue_labels.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/MultilineBlockLayout:
Exclude:
- 'spec/lib/tee_stream_spec.rb'
# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented
Layout/MultilineOperationIndentation:
Exclude:
- 'lib/devops_labels.rb'
- 'triage/processor/community/automated_review_request_doc.rb'
- 'triage/processor/merge_request_ci_title_label.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Layout/SpaceAfterComma:
Exclude:
- 'lib/devops_labels.rb'
- 'triage/processor/copy_security_issue_labels.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Layout/SpaceAroundOperators:
Exclude:
- 'triage/processor/community/code_review_experience_feedback.rb'
- 'triage/processor/pajamas_missing_workflow_label_or_weight.rb'
# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: require_no_space, require_space
Layout/SpaceInLambdaLiteral:
Exclude:
- 'spec/triage/percentage_rollout_spec.rb'
- 'triage/triage/sucker_punch.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBrackets: space, no_space
Layout/SpaceInsideArrayLiteralBrackets:
Exclude:
- 'spec/processor/appsec/revoke_appsec_approval_spec.rb'
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, compact, no_space
Layout/SpaceInsideParens:
Exclude:
- 'spec/lib/report_verifier_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, no_space
Layout/SpaceInsideStringInterpolation:
Exclude:
- 'spec/processor/deprecated_label_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'lib/generate/group_policy.rb'
Enabled: false
# Offense count: 2
# Configuration parameters: AllowedMethods.
......@@ -266,26 +38,6 @@ Lint/InterpolationCheck:
Exclude:
- 'spec/lib/report_verifier_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/LiteralInInterpolation:
Exclude:
- 'spec/lib/schedule/manager_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods.
# AllowedMethods: present?, blank?, presence, try, try!, in?
Lint/SafeNavigationChain:
Exclude:
- 'triage/processor/apply_type_label_from_related_issue.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/ScriptPermission:
Exclude:
- 'lib/flaky_report_analyzer.rb'
# Offense count: 1
Lint/UselessAssignment:
Exclude:
......@@ -306,12 +58,6 @@ Metrics/CyclomaticComplexity:
Metrics/PerceivedComplexity:
Max: 25
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Naming/BinaryOperatorParameterName:
Exclude:
- 'triage/processor/label_inference.rb'
# Offense count: 2
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, db, id, in, io, ip, of, on, os, pp, to
......@@ -329,22 +75,6 @@ Naming/PredicateName:
Exclude:
- 'triage/processor/pajamas_missing_workflow_label_or_weight.rb'
# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: PreferredName.
Naming/RescuedExceptionsVariableName:
Exclude:
- 'triage/job/processor_job.rb'
- 'triage/processor/community/command_mr_label.rb'
- 'triage/rack/error_handler.rb'
- 'triage/rack/webhook_event.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Performance/ConstantRegexp:
Exclude:
- 'spec/triage/reactive_command_spec.rb'
# Offense count: 7
Performance/MethodObjectAsBlock:
Exclude:
......@@ -352,26 +82,6 @@ Performance/MethodObjectAsBlock:
- 'lib/generate/ci_job.rb'
- 'spec/lib/versioned_milestone_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: MaxKeyValuePairs.
Performance/RedundantMerge:
Exclude:
- 'lib/www_gitlab_com.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: OnlySumOrWithInitialValue.
Performance/Sum:
Exclude:
- 'spec/lib/untriaged_helper_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterExampleGroup:
Exclude:
- 'spec/processor/remind_merged_mr_deviating_from_guidelines_spec.rb'
# Offense count: 14
RSpec/ExpectInHook:
Exclude:
......@@ -381,22 +91,6 @@ RSpec/ExpectInHook:
- 'spec/processor/pajamas_missing_workflow_label_or_weight_spec.rb'
- 'spec/triage/job_spec.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
RSpec/HooksBeforeExamples:
Exclude:
- 'spec/processor/new_pipeline_on_approval_spec.rb'
- 'spec/processor/pajamas_missing_workflow_label_or_weight_spec.rb'
- 'spec/processor/type_label_nudger_spec.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: is_expected, should
RSpec/ImplicitExpect:
Exclude:
- 'spec/lib/report_verifier_spec.rb'
# Offense count: 1
RSpec/LeakyConstantDeclaration:
Exclude:
......@@ -412,21 +106,6 @@ RSpec/RepeatedIncludeExample:
Exclude:
- 'spec/processor/pajamas_missing_workflow_label_or_weight_spec.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
RSpec/ScatteredLet:
Exclude:
- 'spec/lib/report_verifier_spec.rb'
- 'spec/triage/percentage_rollout_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: constant, string
RSpec/VerifiedDoubleReference:
Exclude:
- 'spec/processor/community/label_leading_organization_spec.rb'
# Offense count: 42
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
......@@ -438,276 +117,14 @@ Security/YAMLLoad:
Exclude:
- 'lib/www_gitlab_com.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: separated, grouped
Style/AccessorGrouping:
Exclude:
- 'lib/schedule/variant.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# AllowedMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/lib/slo_breach_helper_spec.rb'
# Offense count: 2
Style/CombinableLoops:
Exclude:
- 'spec/processor/label_inference_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- 'lib/priority_mapping_helper.rb'
# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'spec/lib/labels_helper_spec.rb'
- 'spec/lib/slo_breach_helper_spec.rb'
- 'spec/triage/job_spec.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/ExplicitBlockArgument:
Exclude:
- 'lib/flaky_report.rb'
- 'spec/triage/unique_comment_spec.rb'
# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedVars.
Style/FetchEnvVar:
Exclude:
- 'lib/flaky_report.rb'
- 'lib/idle_mr_helper.rb'
- 'triage/processor/community/automated_review_request_ux.rb'
- 'triage/processor/community/command_mr_feedback.rb'
- 'triage/processor/community/customer_contribution_notifier.rb'
- 'triage/processor/ux_mrs.rb'
# Offense count: 9
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Guardfile'
- 'lib/flaky_report_analyzer.rb'
- 'lib/schedule/manager.rb'
- 'lib/schedule/variant.rb'
- 'lib/tee_stream.rb'
- 'spec/job/trigger_pipeline_on_approval_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/triage_spec.rb'
- 'triage/resources/user.rb'
# Offense count: 3
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
Style/GuardClause:
Exclude:
- 'lib/generate/ci_job.rb'
- 'lib/priority_mapping_helper.rb'
- 'lib/schedule/manager.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
Style/HashEachMethods:
Exclude:
- 'spec/processor/deprecated_label_spec.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/IdenticalConditionalBranches:
Exclude:
- 'lib/schedule/manager.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowIfModifier.
Style/IfInsideElse:
Exclude:
- 'lib/devops_labels.rb'
- 'lib/priority_mapping_helper.rb'
# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'lib/flaky_report_analyzer.rb'
- 'lib/missed_resource_helper.rb'
- 'lib/priority_mapping_helper.rb'
- 'lib/stage_definition.rb'
- 'lib/tee_stream.rb'
- 'triage/rack/attach_request_id.rb'
- 'triage/triage/event.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifierOfIfUnless:
Exclude:
- 'lib/team_member_select_helper.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
Exclude:
- 'triage/processor/community/thank_contribution.rb'
- 'triage/triage/sucker_punch.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Style/MethodCallWithoutArgsParentheses:
Exclude:
- 'spec/lib/slo_breach_helper_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/MultilineWhenThen:
Exclude:
- 'lib/flaky_report.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/NestedModifier:
Exclude:
- 'lib/team_member_select_helper.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedOctalStyle.
# SupportedOctalStyles: zero_with_o, zero_only
Style/NumericLiteralPrefix:
Exclude:
- 'spec/lib/resource_helper_spec.rb'
- 'spec/lib/slo_breach_helper_spec.rb'
- 'spec/lib/versioned_milestone_spec.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'lib/www_gitlab_com.rb'
- 'triage/triage/job.rb'
# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Exclude:
- 'lib/group_triage_helper.rb'
- 'lib/lazy_heat_map.rb'
- 'lib/missed_resource_helper.rb'
- 'lib/missing_milestone_helper.rb'
- 'triage/processor/availability_priority.rb'
- 'triage/processor/label_jihu_contribution.rb'
- 'triage/processor/merge_request_ci_title_label.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantFreeze:
Exclude:
- 'lib/lazy_heat_map.rb'
- 'triage/processor/breaking_change_comment.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'triage/processor/remind_merged_mr_deviating_from_guidelines.rb'
# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantSelf:
Exclude:
- 'lib/devops_labels.rb'
- 'lib/schedule/variant.rb'
- 'triage/processor/label_inference.rb'
- 'triage/triage/processor.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/RedundantSort:
Exclude:
- 'lib/lazy_heat_map.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'spec/triage/reactive_command_spec.rb'
- 'triage/triage/documentation_code_owner.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Exclude:
- 'triage/job/processor_job.rb'
- 'triage/rack/error_handler.rb'
- 'triage/triage/handler.rb'
# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowModifier.
Style/SoleNestedConditional:
Exclude:
- 'lib/group_definition.rb'
- 'lib/priority_mapping_helper.rb'
- 'lib/team_member_select_helper.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: RequireEnglish, EnforcedStyle.
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
Style/SpecialGlobalVars:
Exclude:
- 'triage/triage/gcp_log_formatter.rb'
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/flaky_report.rb'
# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/StructInheritance:
Exclude:
- 'triage/rack/attach_logger.rb'
- 'triage/rack/attach_request_id.rb'
- 'triage/rack/authenticator.rb'
- 'triage/rack/error_handler.rb'
- 'triage/rack/request_logger.rb'
- 'triage/rack/webhook_event.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArguments:
Exclude:
- 'spec/processor/copy_security_issue_labels_spec.rb'
# frozen_string_literal: true
guard :rspec, cmd: 'bundle exec rspec --force-color -f doc' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)
......
......@@ -59,7 +59,7 @@ class DevopsLabels
def self.category_labels_per_group
@category_labels_per_group ||=
WwwGitLabCom.categories.each_with_object(Hash.new { |h,k| h[k] = [] }) do |(_, attrs), memo|
WwwGitLabCom.categories.each_with_object(Hash.new { |h, k| h[k] = [] }) do |(_, attrs), memo|
group_key = attrs['group']
memo[group_key] << attrs['label']
memo[group_key].concat(attrs.fetch('feature_labels', []))
......@@ -74,7 +74,7 @@ class DevopsLabels
def self.category_labels
@category_labels ||=
category_labels_per_group.values.flatten +
CATEGORIES_PER_DEPARTMENT.values.flatten
CATEGORIES_PER_DEPARTMENT.values.flatten
end
def self.department_labels
......@@ -129,7 +129,7 @@ class DevopsLabels
extend self
LabelsInferenceResult = Class.new(Struct.new(
:new_labels, :matching_labels, :silent_new_labels)) do
:new_labels, :matching_labels, :silent_new_labels)) do
def any?
new_labels.any?
end
......@@ -169,11 +169,11 @@ class DevopsLabels
matching_labels = label_inference_results.map(&:matching_labels)
silent_new_labels = label_inference_results.map(&:silent_new_labels)
self.new(new_labels, matching_labels, silent_new_labels)
new(new_labels, matching_labels, silent_new_labels)
end
def self.empty
self.new
new
end
private
......@@ -427,12 +427,10 @@ class DevopsLabels
else
infer_group_from_category
end
elsif has_group_label?
infer_stage_and_category_from_group
else
if has_group_label?
infer_stage_and_category_from_group
else
infer_stage_and_group_from_category
end
infer_stage_and_group_from_category
end
end
......@@ -514,7 +512,7 @@ class DevopsLabels
# https://docs.gitlab.com/ee/development/contributing/issue_workflow.html#naming-and-color-convention-1
return label_inference_result if
section_from_group && section_from_stage &&
section_from_group != section_from_stage
section_from_group != section_from_stage
section_name, matching_label =
if section_from_group
......
......@@ -22,12 +22,12 @@ class FlakyReport
config.endpoint = COM_GITLAB_API
end
def self.latest_flaky_report(project_path:, token:, debug: ENV['DEBUG'])
def self.latest_flaky_report(project_path:, token:, debug: ENV.fetch('DEBUG', nil))
new(project_path: project_path, token: token, debug: debug)
.latest_flaky_report
end
def initialize(project_path:, token:, debug: ENV['DEBUG'])
def initialize(project_path:, token:, debug: ENV.fetch('DEBUG', nil))
raise ArgumentError, 'An API token is needed!' if token.nil?
@project_path = project_path
......@@ -64,10 +64,8 @@ class FlakyReport
client.pipelines(project_path, username: GITLAB_BOT_USERNAME, status: 'success', per_page: 1).first
end
def pipeline_jobs(pipeline)
client.pipeline_jobs(project_path, pipeline.id, per_page: 100).auto_paginate do |job|
yield job
end
def pipeline_jobs(pipeline, &block)
client.pipeline_jobs(project_path, pipeline.id, per_page: 100).auto_paginate(&block)
end
def project_job(job)
......@@ -99,16 +97,16 @@ class FlakyReport
[].tap do |issue_content|
with_latest_flaky_report(job) do |latest_flaky_report|
issue_content << '### Top 20 flaky tests sorted by occurrences per file'
issue_content << ("```\n" + FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :file, limit: 20) + "\n```")
issue_content << ("```\n#{FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :file, limit: 20)}\n```")
issue_content << '### Number of flaky tests per type'
issue_content << ("```\n" + FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :type, limit: 20) + "\n```")
issue_content << ("```\n#{FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :type, limit: 20)}\n```")
issue_content << '### Flaky tests per day for the last 20 days'
issue_content << ("```\n" + FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :date, limit: 20) + "\n```")
issue_content << ("```\n#{FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :date, limit: 20)}\n```")
issue_content << '### Top 20 flaky test examples sorted by number of reports'
issue_content << ("```\n" + FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :example_id_reports, limit: 20) + "\n```")
issue_content << ("```\n#{FlakyReportAnalyzer.new(latest_flaky_report.path).print_report(group_by: :example_id_reports, limit: 20)}\n```")
end
end.join("\n\n")
end
......@@ -122,7 +120,7 @@ class FlakyReport
http.request(request) do |response|
case response
when Net::HTTPSuccess then
when Net::HTTPSuccess
Tempfile.create('latest_flaky_report') do |f|
f.write(response.body)
f.flush # This is required when testing
......
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'date'
......@@ -7,9 +8,7 @@ class FlakyReportAnalyzer
attr_reader :report_file
def initialize(report_file)
unless report_file
raise ArgumentError, 'Please provide a JSON flaky specs report file with the -f/--report-file option!'
end
raise ArgumentError, 'Please provide a JSON flaky specs report file with the -f/--report-file option!' unless report_file
@report_file = report_file
end
......
......@@ -16,7 +16,7 @@ module Generate
GroupDefinition::DATA.each do |name, definition|
next if options.only && !options.only.include?(name)
next if definition['ignore_templates']&.include?(options.template)
group_method_name = "group_#{name}".tr('-', '_')
......
......@@ -31,12 +31,12 @@ module GroupDefinition
stage_definition = STAGE_DATA.find { |stage, definition| definition['groups'].include?(name) }
stage = if definition['stage_label']
{ 'label' => definition['stage_label'] }
elsif stage_definition
stage_definition[1]
else
{}
end
{ 'label' => definition['stage_label'] }
elsif stage_definition
stage_definition[1]
else
{}
end
result = {
assignees:
......@@ -47,10 +47,8 @@ module GroupDefinition
default_labeling: definition.fetch('default_labeling', {})
}
if fields.nil? || fields.include?('extra_mentions')
if extra_mentions = definition['extra_mentions']
result[:mentions] = (result[:assignees] + extra_mentions).uniq
end
if (fields.nil? || fields.include?('extra_mentions')) && extra_mentions = definition['extra_mentions']
result[:mentions] = (result[:assignees] + extra_mentions).uniq
end
result
......
......@@ -37,7 +37,7 @@ module GroupTriageHelperContext
end
def report_title(group_name)
"#{Date.today.iso8601} - Triage report for \"#{group_name}\" - #{source_name(network.options.source, network.options.source_id)}"
"#{Date.today.iso8601} - Triage report for \"#{group_name}\" - #{source_name(network.options.source, network.options.source_id)}"
end
def source_name(type, path)
......@@ -172,7 +172,7 @@ module GroupTriageHelperContext
end
def infradev_all_issues_heatmap
titled_heatmap("### Heatmap for all ~infradev issues")
titled_heatmap("### Heatmap for all ~infradev issues")
end
def infradev_overdue_issues_summary
......@@ -365,7 +365,7 @@ module GroupTriageHelperContext
strings.map do |string|
body =
if quote
%{"#{string}"}
%("#{string}")
else
string
end
......
......@@ -17,8 +17,8 @@ module IdleMrHelper
def stale_resources_helper(resource)
StaleResources.new(
project_path: ENV['TRIAGE_SOURCE_PATH'],
token: ENV['GITLAB_BOT_AUTOMATED_TRIAGE_TOKEN'],
project_path: ENV.fetch('TRIAGE_SOURCE_PATH', nil),
token: ENV.fetch('GITLAB_BOT_AUTOMATED_TRIAGE_TOKEN', nil),
project_id: resource[:project_id],
resource_iid: resource[:iid],
resource_type: :merge_request
......
......@@ -5,8 +5,8 @@ require 'cgi'
class LazyHeatMap
PRIORITY_LABELS = %w[priority::1 priority::2 priority::3 priority::4].freeze
SEVERITY_LABELS = %w[severity::1 severity::2 severity::3 severity::4].freeze
WITHOUT_PRIORITY_STRING = 'No priority'.freeze
WITHOUT_SEVERITY_STRING = 'No severity'.freeze
WITHOUT_PRIORITY_STRING = 'No priority'
WITHOUT_SEVERITY_STRING = 'No severity'
PRIORITY_TITLES = [*PRIORITY_LABELS, WITHOUT_PRIORITY_STRING].freeze
SEVERITY_TITLES = [*SEVERITY_LABELS, WITHOUT_SEVERITY_STRING].freeze
......@@ -49,14 +49,14 @@ class LazyHeatMap
def generate_heat_map
grouped_by_priority = @resources.group_by do |resource|
# Pick highest one
resource[:labels].grep(/\Apriority::\d\z/).sort.first || WITHOUT_PRIORITY_STRING
resource[:labels].grep(/\Apriority::\d\z/).min || WITHOUT_PRIORITY_STRING
end
grouped_by_priority = pad_and_sort(grouped_by_priority, PRIORITY_TITLES)
grouped_by_priority.transform_values do |with_same_priority|
grouped_by_severity = with_same_priority.group_by do |resource|
resource[:labels].grep(/\Aseverity::\d\z/).sort.first || WITHOUT_SEVERITY_STRING
resource[:labels].grep(/\Aseverity::\d\z/).min || WITHOUT_SEVERITY_STRING
end
pad_and_sort(grouped_by_severity, SEVERITY_TITLES)
......@@ -110,7 +110,7 @@ class LazyHeatMap
if [WITHOUT_SEVERITY_STRING, WITHOUT_PRIORITY_STRING].include?(header_label)
header_label
else
%{~"#{header_label}"}
%(~"#{header_label}")
end
end
......
......@@ -15,12 +15,10 @@ module MissedResourceHelper
def add_missed_labels(milestone_title, labels)
result = [
%{/label ~"missed:#{milestone_title}"}
%(/label ~"missed:#{milestone_title}")
]
if labels.index('Deliverable')
result << '/label ~"missed-deliverable"'
end
result << '/label ~"missed-deliverable"' if labels.index('Deliverable')
result.join("\n")
end
......@@ -28,7 +26,7 @@ module MissedResourceHelper
def move_to_current_milestone
current_milestone_title = VersionedMilestone.new(self).current.title
%{/milestone %"#{current_milestone_title}"}
%(/milestone %"#{current_milestone_title}")
end
private
......
......@@ -7,7 +7,7 @@ module MissingMilestoneHelper
milestone = milestone_for_merge_request(merge_request)
return unless milestone
%{/milestone %"#{milestone.title}"}
%(/milestone %"#{milestone.title}")
end
private
......
......@@ -60,15 +60,13 @@ module PriorityMappingHelper
if has_severity?
if has_no_priority?
if merge_request_functionality_related?
priority_label = MR_SEVERITY_PRIORITY_MAP[severity]
else
priority_label = SEVERITY_PRIORITY_MAP[severity]
end
else
if merge_request_functionality_related? && priority_override?(MR_SEVERITY_PRIORITY_MAP[severity])
priority_label = MR_SEVERITY_PRIORITY_MAP[severity]
end
priority_label = if merge_request_functionality_related?
MR_SEVERITY_PRIORITY_MAP[severity]
else
SEVERITY_PRIORITY_MAP[severity]
end
elsif merge_request_functionality_related? && priority_override?(MR_SEVERITY_PRIORITY_MAP[severity])
priority_label = MR_SEVERITY_PRIORITY_MAP[severity]
end
end
......@@ -80,9 +78,7 @@ module PriorityMappingHelper
end
def override_comment(new_priority)
if priority_override?(new_priority)
MR_PRIORITY_OVERRIDE_COMMENT if merge_request_functionality_related?
end
MR_PRIORITY_OVERRIDE_COMMENT if priority_override?(new_priority) && merge_request_functionality_related?
end
def severity
......
# frozen_string_literal: true
require 'yaml'
require 'optparse'
......@@ -7,7 +8,7 @@ require 'gitlab'
require_relative 'variant'
class ReadOnlyComClient
COM_GITLAB_API = 'https://gitlab.com/api/v4'.freeze
COM_GITLAB_API = 'https://gitlab.com/api/v4'
Gitlab.configure do |config|
config.endpoint = COM_GITLAB_API
......@@ -130,8 +131,8 @@ module Schedule
end
end
PROJECT_PATH = 'gitlab-org/quality/triage-ops'.freeze
BYPASSING_VARIABLES_PREFIX = 'BYPASSING_'.freeze
PROJECT_PATH = 'gitlab-org/quality/triage-ops'
BYPASSING_VARIABLES_PREFIX = 'BYPASSING_'
InvalidPipelineScheduleIdError = Class.new(ArgumentError)
InvalidDryRunScheduleName = Class.new(ArgumentError)
......@@ -246,14 +247,15 @@ module Schedule
if remote_schedule
info "ℹ️ Schedule ##{remote_schedule.id} `#{remote_schedule.description}` was found. ℹ️"
sync_attributes!(remote_schedule, schedule_variant)
sync_variables!(remote_schedule, schedule_variant)
else
create_params = schedule_variant.create_params
info "🏗 Schedule `#{schedule_variant.description}` wasn't found, we'll create it. 🏗"
remote_schedule = api_client.create_pipeline_schedule(create_params)
sync_variables!(remote_schedule, schedule_variant)
end
sync_variables!(remote_schedule, schedule_variant)
info ''
end
end
......@@ -303,7 +305,6 @@ module Schedule
remote_schedules
.reject { |remote_schedule| find_pipeline_schedule(schedules_specification, remote_schedule, raise_on_unknown_id: false) }
.each do |remote_schedule|
info "⚠️ Schedule ##{remote_schedule.id} `#{remote_schedule.description}` isn't a managed schedule, it will be disabled. ⚠️"
api_client.edit_pipeline_schedule(remote_schedule, { active: false })
......
# frozen_string_literal: true
module Schedule
class Variant
PIPELINE_SCHEDULE_ATTRS = %i[description ref cron cron_timezone active].freeze
......@@ -8,9 +9,7 @@ module Schedule
active: true
}.freeze
attr_reader(*PIPELINE_SCHEDULE_ATTRS)
attr_reader :id, :variables, :project_path, :documentation
attr_reader(*PIPELINE_SCHEDULE_ATTRS, :id, :variables, :project_path, :documentation)
def initialize(project_path, base_config, variant_config)
@project_path = project_path
......@@ -30,7 +29,7 @@ module Schedule
def create_params
PIPELINE_SCHEDULE_ATTRS.each_with_object({}) do |attr, params|
params[attr] = self.public_send(attr)
params[attr] = public_send(attr)
end.sort.to_h
end
......
......@@ -22,8 +22,6 @@ module ResourceNotesHelper
def resource_notes
path = resource[:type] == 'issues' ? 'issue_notes' : 'merge_request_notes'
# rubocop:disable GitlabSecurity/PublicSend
@resource_notes ||= Triage.api_client.public_send(path, project_id, resource_iid, per_page: 100).auto_paginate
# rubocop:enable GitlabSecurity/PublicSend
end
end
......@@ -46,9 +46,7 @@ module StageDefinition
if fields.nil? || fields.include?('extra_mentions')
extra_mentions = assignables['extra_mentions']
if extra_mentions
result[:mentions] = (result[:assignees] + extra_mentions).uniq
end
result[:mentions] = (result[:assignees] + extra_mentions).uniq if extra_mentions
end
result
......
......@@ -108,9 +108,9 @@ module TeamMemberSelectHelper
def select_team_member_usernames(include_unavailable: true, include_ooo: true)
WwwGitLabCom.team_from_www.each_with_object([]) do |(username, data), memo|
next if unavailable?(username) unless include_unavailable
next if !include_unavailable && unavailable?(username)
next if out_of_office?(username) unless include_ooo
next if !include_ooo && out_of_office?(username)
memo << "@#{username}" if yield(data)
end
......
# frozen_string_literal: true
require 'open3'
require 'stringio'
......@@ -22,9 +23,7 @@ module TeeStream
end
def exec(cmd, out: $stdout, err: $stderr)
unless cmd.is_a?(Array)
raise ArgumentError, 'System command must be an array of strings'
end
raise ArgumentError, 'System command must be an array of strings' unless cmd.is_a?(Array)
Open3.popen3(*cmd) do |stdin, cmd_stdout, cmd_stderr, wait_thr|
stdin.close
......
......@@ -43,7 +43,7 @@ class WwwGitLabCom
def self.team_from_www
cache.get_or_set(:team_from_www) do
data = fetch_yml(WWW_GITLAB_COM_TEAM_YML).each_with_object({}) do |item, memo|
memo.merge!({ item['gitlab'] => item })
memo[item['gitlab']] = item
end
MiniCache::Data.new(data, expires_in: DATA_CACHE_DEFAULT_EXPIRATION)
end
......@@ -75,7 +75,7 @@ class WwwGitLabCom
def self.with_retries(attempts: 3)
yield
rescue Errno::ECONNRESET, OpenSSL::SSL::SSLError, Net::OpenTimeout
retry if (attempts -= 1) > 0
retry if (attempts -= 1).positive?
raise
end
private_class_method :with_retries
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment