diff --git a/ee/app/graphql/ee/types/user_interface.rb b/ee/app/graphql/ee/types/user_interface.rb index f09268fe22abf3a96e17dcb3b9025ce101b00920..465608e612bb0c4525aea2b8d2f769060af79de6 100644 --- a/ee/app/graphql/ee/types/user_interface.rb +++ b/ee/app/graphql/ee/types/user_interface.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# noinspection RubyClassModuleNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ module EE module Types module UserInterface diff --git a/ee/app/graphql/mutations/remote_development/workspaces/create.rb b/ee/app/graphql/mutations/remote_development/workspaces/create.rb index 55c145a71d7373540c4be5cbcd3910bbed7ca3f8..c890bc54bb48553e62ec04c5588aeead3b3b7431 100644 --- a/ee/app/graphql/mutations/remote_development/workspaces/create.rb +++ b/ee/app/graphql/mutations/remote_development/workspaces/create.rb @@ -3,7 +3,6 @@ module Mutations module RemoteDevelopment module Workspaces - # noinspection RubyMismatchedArgumentType class Create < BaseMutation graphql_name 'WorkspaceCreate' diff --git a/ee/app/models/remote_development/remote_development_agent_config.rb b/ee/app/models/remote_development/remote_development_agent_config.rb index 6233570b0b0458f88850e1afe2e3c6cdc8f5e204..ada852523b76a2ed653c1464ec5b2cbef9e2cd96 100644 --- a/ee/app/models/remote_development/remote_development_agent_config.rb +++ b/ee/app/models/remote_development/remote_development_agent_config.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module RemoteDevelopment - # noinspection RailsParamDefResolve + # noinspection RailsParamDefResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31540 class RemoteDevelopmentAgentConfig < ApplicationRecord # NOTE: See the following comment for the reasoning behind the `RemoteDevelopment` prefix of this table/model: # https://gitlab.com/gitlab-org/gitlab/-/issues/410045#note_1385602915 @@ -16,7 +16,7 @@ class RemoteDevelopmentAgentConfig < ApplicationRecord # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/409772 - Make this a type:enum validates :enabled, inclusion: { in: [true], message: 'is currently immutable, and must be set to true' } - # noinspection RubyResolve + # noinspection RubyResolve - likely due to https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31540 before_validation :prevent_dns_zone_update, if: ->(record) { record.persisted? && record.dns_zone_changed? } private diff --git a/ee/app/models/remote_development/workspace.rb b/ee/app/models/remote_development/workspace.rb index cc242f7e5e839718c0caba654701eb4262a52f6b..9cea9ca10803cd1bd6d6c966f7f2ddef33687707 100644 --- a/ee/app/models/remote_development/workspace.rb +++ b/ee/app/models/remote_development/workspace.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true module RemoteDevelopment - # noinspection RailsParamDefResolve,RubyResolve + # noinspection RailsParamDefResolve, RubyResolve - likely due to https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31540 + # noinspection RubyConstantNamingConvention,RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ class Workspace < ApplicationRecord include Sortable include RemoteDevelopment::Workspaces::States @@ -37,7 +38,7 @@ class Workspace < ApplicationRecord validates :max_hours_before_termination, numericality: { less_than_or_equal_to: MAX_HOURS_BEFORE_TERMINATION_LIMIT } scope :with_desired_state_updated_more_recently_than_last_response_to_agent, -> do - # noinspection SqlResolve + # noinspection SqlResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 where('desired_state_updated_at >= responded_to_agent_at').or(where(responded_to_agent_at: nil)) end diff --git a/ee/app/policies/remote_development/workspace_policy.rb b/ee/app/policies/remote_development/workspace_policy.rb index c74361008bf1a6510ce58180737a458b1afd0efb..5ad9a99b33257148cd1ea1a3d9fe0ff9ae2a9216 100644 --- a/ee/app/policies/remote_development/workspace_policy.rb +++ b/ee/app/policies/remote_development/workspace_policy.rb @@ -1,15 +1,14 @@ # frozen_string_literal: true module RemoteDevelopment + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-25400 class WorkspacePolicy < BasePolicy delegate { subject.project } condition(:workspace_owner) { user.id == workspace&.user_id } - # noinspection RubyResolve rule { workspace_owner & can?(:developer_access) }.enable :update_workspace - # noinspection RubyResolve rule { workspace_owner }.enable :read_workspace def workspace diff --git a/ee/lib/remote_development/message_support.rb b/ee/lib/remote_development/message_support.rb index 091f36e616e73d8501abe5f77e8d7dc537863399..9647a46e8a06fdc01f23f27cc5ad646bac40a433 100644 --- a/ee/lib/remote_development/message_support.rb +++ b/ee/lib/remote_development/message_support.rb @@ -3,6 +3,7 @@ require 'active_model/errors' module RemoteDevelopment + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ module MessageSupport # @param [RemoteDevelopment::Message] message # @param [Symbol] reason diff --git a/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb b/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb index 842722256038c778f535bb932310e7c011e6a874..ad7600cc05b72355e43163fba26206d819296fd4 100644 --- a/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb +++ b/ee/lib/remote_development/workspaces/create/pre_flatten_devfile_validator.rb @@ -3,6 +3,7 @@ module RemoteDevelopment module Workspaces module Create + # noinspection RubyConstantNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ class PreFlattenDevfileValidator include Messages diff --git a/ee/lib/remote_development/workspaces/reconcile/actual_state_calculator.rb b/ee/lib/remote_development/workspaces/reconcile/actual_state_calculator.rb index 3a2383828a317c50fbad2000dd49c50c21a48531..385f1391228098cdf601e2a6370d754fb9aaf390 100644 --- a/ee/lib/remote_development/workspaces/reconcile/actual_state_calculator.rb +++ b/ee/lib/remote_development/workspaces/reconcile/actual_state_calculator.rb @@ -3,6 +3,7 @@ module RemoteDevelopment module Workspaces module Reconcile + # noinspection RubyConstantNamingConvention,RubyParameterNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ class ActualStateCalculator include States diff --git a/ee/lib/remote_development/workspaces/reconcile/agent_info.rb b/ee/lib/remote_development/workspaces/reconcile/agent_info.rb index 9cb6feb7cd07601a88b4849ed4ace5c858f23dc0..e05188c3fea9eda90edb2ad0b3416bd35b6ae74f 100644 --- a/ee/lib/remote_development/workspaces/reconcile/agent_info.rb +++ b/ee/lib/remote_development/workspaces/reconcile/agent_info.rb @@ -3,6 +3,7 @@ module RemoteDevelopment module Workspaces module Reconcile + # noinspection RubyParameterNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ class AgentInfo attr_reader :name, :namespace, :actual_state, :deployment_resource_version diff --git a/ee/lib/remote_development/workspaces/reconcile/desired_config_generator.rb b/ee/lib/remote_development/workspaces/reconcile/desired_config_generator.rb index c89814a6b15ea19232c7eee96dfa797efd23fac9..ca28bf1008265adf7d595a3610fad5e984a23f45 100644 --- a/ee/lib/remote_development/workspaces/reconcile/desired_config_generator.rb +++ b/ee/lib/remote_development/workspaces/reconcile/desired_config_generator.rb @@ -3,7 +3,8 @@ module RemoteDevelopment module Workspaces module Reconcile - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ class DesiredConfigGenerator include States @@ -57,7 +58,6 @@ def get_workspace_replicas(desired_state:) 0 end - # noinspection RubyInstanceMethodNamingConvention # @param [String] name # @param [String] namespace # @param [String] agent_id diff --git a/ee/lib/remote_development/workspaces/reconcile/devfile_parser.rb b/ee/lib/remote_development/workspaces/reconcile/devfile_parser.rb index 72ef1f5f590eab72ecbd93f7565a6c7e11eb72f0..0ad8b87678ad980da08bb2949b9d845523fb437c 100644 --- a/ee/lib/remote_development/workspaces/reconcile/devfile_parser.rb +++ b/ee/lib/remote_development/workspaces/reconcile/devfile_parser.rb @@ -5,6 +5,7 @@ module RemoteDevelopment module Workspaces module Reconcile + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ class DevfileParser # @param [String] processed_devfile # @param [String] name diff --git a/ee/lib/remote_development/workspaces/reconcile/reconcile_processor.rb b/ee/lib/remote_development/workspaces/reconcile/reconcile_processor.rb index bfec94b0b9f7702702452a202b1b9422810fc2a0..c05159d2f3e0483e1c791662bf16910c5072edf0 100644 --- a/ee/lib/remote_development/workspaces/reconcile/reconcile_processor.rb +++ b/ee/lib/remote_development/workspaces/reconcile/reconcile_processor.rb @@ -1,9 +1,12 @@ # frozen_string_literal: true -# noinspection RubyResolve module RemoteDevelopment module Workspaces module Reconcile + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 + # rubocop:disable Layout/LineLength + # noinspection RubyInstanceMethodNamingConvention,RubyLocalVariableNamingConvention,RubyParameterNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ + # rubocop:enable Layout/LineLength class ReconcileProcessor include UpdateType @@ -105,7 +108,6 @@ def process(agent:, workspace_agent_infos:, update_type:) # Update the responded_to_agent_at at this point, after we have already done all the calculations # related to state. Do it outside of the loop so it will be a single query, and also so that they # will all have the same timestamp. - # noinspection RailsParamDefResolve workspaces_to_return_in_rails_infos_query.touch_all(:responded_to_agent_at) payload = { workspace_rails_infos: workspace_rails_infos } diff --git a/ee/spec/factories/remote_development/remote_development_agent_configs.rb b/ee/spec/factories/remote_development/remote_development_agent_configs.rb index 4a43f089e1df4fd86559b0ea28f7244280dbd493..411443e489e13c8e6810565e9f1119ab44dabf5e 100644 --- a/ee/spec/factories/remote_development/remote_development_agent_configs.rb +++ b/ee/spec/factories/remote_development/remote_development_agent_configs.rb @@ -4,7 +4,6 @@ factory :remote_development_agent_config, class: 'RemoteDevelopment::RemoteDevelopmentAgentConfig' do agent factory: :cluster_agent enabled { true } - # noinspection RubyResolve dns_zone { 'workspaces.localdev.me' } end end diff --git a/ee/spec/factories/remote_development/workspaces.rb b/ee/spec/factories/remote_development/workspaces.rb index 57aa5deb9a77efeb1a6d48192380c03d89c23159..6e726ed155cc657eabf7d3c33c8ecd20947e8e1b 100644 --- a/ee/spec/factories/remote_development/workspaces.rb +++ b/ee/spec/factories/remote_development/workspaces.rb @@ -2,7 +2,6 @@ FactoryBot.define do factory :workspace, class: 'RemoteDevelopment::Workspace' do - # noinspection RailsParamDefResolve project factory: [:project, :public, :in_group] user agent factory: [:ee_cluster_agent, :with_remote_development_agent_config] @@ -15,7 +14,7 @@ actual_state { RemoteDevelopment::Workspaces::States::STOPPED } deployment_resource_version { 2 } editor { 'webide' } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 max_hours_before_termination { 24 } # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/409779 @@ -23,33 +22,30 @@ # so we can interpolate it here and ensure it is consistent? url { "https://60001-#{name}.workspaces.localdev.me" } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 devfile_ref { 'main' } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 devfile_path { '.devfile.yaml' } - # noinspection RubyResolve devfile do - # noinspection RubyMismatchedArgumentType - File.read(Rails.root.join('ee/spec/fixtures/remote_development/example.devfile.yaml')) + File.read(Rails.root.join('ee/spec/fixtures/remote_development/example.devfile.yaml').to_s) end - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 processed_devfile do - # noinspection RubyMismatchedArgumentType - File.read(Rails.root.join('ee/spec/fixtures/remote_development/example.processed-devfile.yaml')) + File.read(Rails.root.join('ee/spec/fixtures/remote_development/example.processed-devfile.yaml').to_s) end transient do random_string { SecureRandom.alphanumeric(6).downcase } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 skip_realistic_after_create_timestamp_updates { false } end # Use this trait if you want to directly control any timestamp fields when invoking the factory. trait :without_realistic_after_create_timestamp_updates do transient do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 skip_realistic_after_create_timestamp_updates { true } end end @@ -61,9 +57,9 @@ end after(:create) do |workspace, evaluator| - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 if evaluator.skip_realistic_after_create_timestamp_updates - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 # Set responded_to_agent_at to a non-nil value unless it has already been set workspace.update!(responded_to_agent_at: workspace.updated_at) unless workspace.responded_to_agent_at else @@ -94,7 +90,7 @@ trait :unprovisioned do desired_state { RemoteDevelopment::Workspaces::States::RUNNING } actual_state { RemoteDevelopment::Workspaces::States::CREATION_REQUESTED } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 responded_to_agent_at { nil } deployment_resource_version { nil } end diff --git a/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb b/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb index 8c76427b768cb7fc1b7490d0784ab23e42f12a91..5a46b7fe5a95ce762ff07df43e756ecbb1896e94 100644 --- a/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb +++ b/ee/spec/features/remote_development/workspaces_dropdown_group_spec.rb @@ -82,6 +82,7 @@ it 'allows navigating to the new workspace page' do click_link 'New workspace' + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 expect(page).to have_current_path("#{new_remote_development_workspace_path}?project=#{project.full_path}") expect(page).to have_css('button', text: project.name_with_namespace) end @@ -104,6 +105,7 @@ expect(page).to have_button('Stopping', disabled: true) end + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def expect_workspace_state_indicator(state) expect(page).to have_selector("svg[data-testid='workspace-state-indicator'][title='#{state}']") end @@ -117,6 +119,7 @@ def expect_workspace_state_indicator(state) end describe 'when viewing blob page' do + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 let(:subject) { project_blob_path(project, "#{project.default_branch}/#{devfile_path}") } it_behaves_like 'views and manages workspaces in workspaces dropdown group' diff --git a/ee/spec/features/remote_development/workspaces_spec.rb b/ee/spec/features/remote_development/workspaces_spec.rb index 47945c76b9fc01c24a2a0c59add919318a47e2a4..dce636085a2bce6d7f792ed0c28eb17b39ff0676 100644 --- a/ee/spec/features/remote_development/workspaces_spec.rb +++ b/ee/spec/features/remote_development/workspaces_spec.rb @@ -46,7 +46,7 @@ # NAVIGATE TO WORKSPACES PAGE - # noinspection RubyResolve + # noinspection RubyResolve - likely related to this, but for routes: https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 visit remote_development_workspaces_path wait_for_requests @@ -274,10 +274,12 @@ def simulate_fourth_poll(id:, name:, namespace:) expect(info.fetch(:config_to_apply)).to be_nil end + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def expect_workspace_state_indicator(state) expect(page).to have_selector("svg[data-testid='workspace-state-indicator'][title='#{state}']") end + # noinspection RubyParameterNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def simulate_agentk_reconcile_post(workspace_agent_infos:) post_params = { update_type: 'partial', diff --git a/ee/spec/finders/remote_development/workspaces_finder_spec.rb b/ee/spec/finders/remote_development/workspaces_finder_spec.rb index 71a8955aa07f21b9a2855a0fa5f54ad6c990606c..c94df4d2d4d32966ee3cd40b279012e736eb099a 100644 --- a/ee/spec/finders/remote_development/workspaces_finder_spec.rb +++ b/ee/spec/finders/remote_development/workspaces_finder_spec.rb @@ -38,39 +38,39 @@ # However, doing so results in a dangerbot warning that is difficult to suppress # Unfortunatly there isn't an exact-order array matcher that doesn't result in a dangerbot warning. expect(workspaces.length).to eq(2) - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 expect(workspaces.first).to eq(workspace_b) - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 expect(workspaces.last).to eq(workspace_a) end end context 'with id in params' do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 let(:params) { { ids: [workspace_a.id] } } it "returns only current user's workspaces matching the specified IDs" do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 expect(subject).to contain_exactly(workspace_a) end end context 'with project_ids in params' do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 let(:params) { { project_ids: [project_a.id] } } it "returns only current user's workspaces matching the specified project IDs" do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 expect(subject).to contain_exactly(workspace_a) end end context 'with include_actual_states in params' do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 let(:params) { { include_actual_states: [::RemoteDevelopment::Workspaces::States::RUNNING] } } it "returns only current user's workspaces not matching the specified actual_states" do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 expect(subject).to contain_exactly(workspace_a) end end @@ -78,7 +78,7 @@ context 'without current user' do subject { described_class.new(nil, params).execute } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 let(:params) { { ids: [workspace_a.id] } } it 'returns none' do diff --git a/ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb b/ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb index 23eae71f3a3f29cff7215d62ef0f51a0ff4a8a5a..a1d67339800305c6df268bec7c70287f0b3d1c4d 100644 --- a/ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb +++ b/ee/spec/lib/remote_development/workspaces/create/project_cloner_component_injector_spec.rb @@ -37,8 +37,8 @@ it "injects the project cloner component" do components = subject.dig(:processed_devfile, "components") project_cloner_component = components.find { |component| component.fetch("name") == component_name } - expected_processed_devfile_components = expected_processed_devfile.fetch("components") - expected_volume_component = expected_processed_devfile_components.find do |component| + expected_components = expected_processed_devfile.fetch("components") + expected_volume_component = expected_components.find do |component| component.fetch("name") == component_name end expect(project_cloner_component).to eq(expected_volume_component) diff --git a/ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb b/ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb index 4714b13652654baeba1f4aafb8730d9521f1c32d..bf5da313168b0475d78e6165548f2e688f139d8c 100644 --- a/ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb +++ b/ee/spec/lib/remote_development/workspaces/create/volume_component_injector_spec.rb @@ -29,8 +29,8 @@ it "injects the workspace volume component" do components = subject.dig(:processed_devfile, "components") volume_component = components.find { |component| component.fetch("name") == component_name } - expected_processed_devfile_components = expected_processed_devfile.fetch("components") - expected_volume_component = expected_processed_devfile_components.find do |component| + expected_components = expected_processed_devfile.fetch("components") + expected_volume_component = expected_components.find do |component| component.fetch("name") == component_name end expect(volume_component).to eq(expected_volume_component) diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/devfile_parser_spec.rb b/ee/spec/lib/remote_development/workspaces/reconcile/devfile_parser_spec.rb index bbd7ca91c22b2d069d1879ea733f271b0e61d215..c875dc707ab4210db5c4618377982de48f8f7286 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/devfile_parser_spec.rb +++ b/ee/spec/lib/remote_development/workspaces/reconcile/devfile_parser_spec.rb @@ -49,7 +49,6 @@ user: user ) - # noinspection RubyResolve expect(workspace_resources).to eq(expected_workspace_resources) end end diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_scenarios_spec.rb b/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_scenarios_spec.rb index e38c368d0277b2158149e13348c0b5a3454ff851..bec1bda0c85d64177cffeb3510975b3b2de23e14 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_scenarios_spec.rb +++ b/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_scenarios_spec.rb @@ -139,11 +139,12 @@ # rubocop:enable Layout/LineLength, Style/TrailingCommaInArrayLiteral with_them do + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31544 + # noinspection RubyInstanceMethodNamingConvention,RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ it 'behaves as expected' do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31544 expected_db_expectations_length = (initial_db_state ? 1 : 0) + (user_desired_state_update ? 1 : 0) + agent_actual_state_updates.length - # noinspection RubyResolve expect(db_expectations.length).to eq(expected_db_expectations_length) workspace = nil @@ -151,7 +152,7 @@ initial_resource_version = '1' # Handle initial db state, if necessary - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31544 if initial_db_state workspace = create( :workspace, @@ -167,10 +168,10 @@ end # handle user desired state update, if necessary - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31544 if user_desired_state_update if workspace - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31544 workspace.update!(desired_state: user_desired_state_update.to_s.camelize) else workspace = create(:workspace, :unprovisioned) @@ -185,7 +186,8 @@ raise 'Must have workspace by now, either from initial_db_state or user_desired_state_update' unless workspace # Handle agent updates - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31544 + # noinspection RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ agent_actual_state_updates.each_with_index do |actual_state_update_fixture_args, response_expectations_index| update_type = RemoteDevelopment::Workspaces::Reconcile::UpdateType::PARTIAL deployment_resource_version_from_agent ||= initial_resource_version diff --git a/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_spec.rb b/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_spec.rb index 6b67d6ed5550d9abb0e1f558916de5f7b267706c..09bbabefb465cd3ec4cbd6ec72479d7767d134d7 100644 --- a/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_spec.rb +++ b/ee/spec/lib/remote_development/workspaces/reconcile/reconcile_processor_spec.rb @@ -130,19 +130,18 @@ # NOTE: rubocop:disable RSpec/ExpectInHook could be avoided with a helper method or custom expectation, # but this works for now. # rubocop:disable RSpec/ExpectInHook + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 before do # Ensure that both desired_state_updated_at and responded_to_agent_at are before Time.current, # so that we can test for any necessary differences after processing updates them - # noinspection RubyResolve expect(workspace.desired_state_updated_at).to be_before(Time.current) - # noinspection RubyResolve expect(workspace.responded_to_agent_at).to be_before(Time.current) end + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 after do # After processing, the responded_to_agent_at should always have been updated workspace.reload - # noinspection RubyResolve expect(workspace.responded_to_agent_at) .not_to be_before(workspace.desired_state_updated_at) end @@ -150,8 +149,8 @@ context 'when desired_state matches actual_state' do # rubocop:disable RSpec/ExpectInHook + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 before do - # noinspection RubyResolve expect(workspace.responded_to_agent_at) .to be_after(workspace.desired_state_updated_at) end @@ -216,13 +215,11 @@ end end + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 context 'when desired_state does not match actual_state' do - # noinspection RubyResolve let(:deployment_resource_version_from_agent) { workspace.deployment_resource_version } - # noinspection RubyResolve let(:owning_inventory) { "#{workspace.name}-workspace-inventory" } - # noinspection RubyResolve let(:expected_config_to_apply) do create_config_to_apply( workspace_id: workspace.id, @@ -240,16 +237,17 @@ # rubocop:disable RSpec/ExpectInHook before do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 expect(workspace.responded_to_agent_at) .to be_before(workspace.desired_state_updated_at) end # rubocop:enable RSpec/ExpectInHook + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 context 'when desired_state is Running' do let(:desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - # noinspection RubyResolve + # noinspection RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ it 'returns proper workspace_rails_info entry with config_to_apply' do # verify initial states in db (sanity check of match between factory and fixtures) expect(workspace.desired_state).to eq(desired_state) @@ -270,7 +268,6 @@ .to eq(expected_deployment_resource_version) # test the config to apply first to get a more specific diff if it fails - # noinspection RubyResolve provisioned_workspace_rails_info = workspace_rails_infos.detect { |info| info.fetch(:name) == workspace.name } expect(provisioned_workspace_rails_info.fetch(:config_to_apply)) @@ -285,7 +282,7 @@ let(:desired_state) { RemoteDevelopment::Workspaces::States::TERMINATED } let(:expected_value_for_started) { false } - # noinspection RubyResolve + # noinspection RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ it 'returns proper workspace_rails_info entry with config_to_apply' do # verify initial states in db (sanity check of match between factory and fixtures) expect(workspace.desired_state).to eq(desired_state) @@ -306,7 +303,6 @@ .to eq(expected_deployment_resource_version) # test the config to apply first to get a more specific diff if it fails - # noinspection RubyResolve provisioned_workspace_rails_info = workspace_rails_infos.detect { |info| info.fetch(:name) == workspace.name } expect(provisioned_workspace_rails_info.fetch(:config_to_apply)) @@ -321,7 +317,7 @@ let(:desired_state) { RemoteDevelopment::Workspaces::States::RESTART_REQUESTED } let(:expected_desired_state) { RemoteDevelopment::Workspaces::States::RUNNING } - # noinspection RubyResolve + # noinspection RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ it 'changes desired_state to Running' do # verify initial states in db (sanity check of match between factory and fixtures) expect(workspace.desired_state).to eq(desired_state) @@ -339,7 +335,6 @@ expect(workspace.desired_state).to eq(expected_desired_state) # test the config to apply first to get a more specific diff if it fails - # noinspection RubyResolve provisioned_workspace_rails_info = workspace_rails_infos.detect { |info| info.fetch(:name) == workspace.name } expect(provisioned_workspace_rails_info[:config_to_apply]) @@ -407,10 +402,10 @@ let(:workspace_agent_infos) { [] } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 let(:owning_inventory) { "#{unprovisioned_workspace.name}-workspace-inventory" } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 let(:expected_config_to_apply) do create_config_to_apply( workspace_id: unprovisioned_workspace.id, @@ -424,7 +419,7 @@ ) end - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 let(:expected_unprovisioned_workspace_rails_info) do { name: unprovisioned_workspace.name, @@ -438,7 +433,8 @@ let(:expected_workspace_rails_infos) { [expected_unprovisioned_workspace_rails_info] } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 + # noinspection RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ it 'returns proper workspace_rails_info entry' do # verify initial states in db (sanity check of match between factory and fixtures) expect(unprovisioned_workspace.desired_state).to eq(desired_state) @@ -454,7 +450,7 @@ expect(workspace_rails_infos.length).to eq(1) # test the config to apply first to get a more specific diff if it fails - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 unprovisioned_workspace_rails_info = workspace_rails_infos.detect { |info| info.fetch(:name) == unprovisioned_workspace.name } expect(unprovisioned_workspace_rails_info.fetch(:config_to_apply)) diff --git a/ee/spec/models/remote_development/remote_development_agent_config_spec.rb b/ee/spec/models/remote_development/remote_development_agent_config_spec.rb index b119fb30e8ade695a679831441a3813df3762d6d..e760bc52783490703e8cfde6789fa57cb9742b36 100644 --- a/ee/spec/models/remote_development/remote_development_agent_config_spec.rb +++ b/ee/spec/models/remote_development/remote_development_agent_config_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe RemoteDevelopment::RemoteDevelopmentAgentConfig, feature_category: :remote_development do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31543 let_it_be_with_reload(:agent) { create(:ee_cluster_agent, :with_remote_development_agent_config) } subject { agent.remote_development_agent_config } diff --git a/ee/spec/models/remote_development/workspace_spec.rb b/ee/spec/models/remote_development/workspace_spec.rb index f7f70673816b48dbcc8ac1205f4187d4a5067549..456879240a857674308f822fecc6146bd7d24297 100644 --- a/ee/spec/models/remote_development/workspace_spec.rb +++ b/ee/spec/models/remote_development/workspace_spec.rb @@ -45,7 +45,7 @@ it 'sets desired_state_updated_at' do subject.save! - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 expect(subject.desired_state_updated_at).to eq(Time.current) end end @@ -53,7 +53,7 @@ describe 'when updating desired_state' do it 'sets desired_state_updated_at' do expect { subject.update!(desired_state: ::RemoteDevelopment::Workspaces::States::RUNNING) }.to change { - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 subject.desired_state_updated_at } end @@ -62,7 +62,7 @@ describe 'when updating a field other than desired_state' do it 'does not set desired_state_updated_at' do expect { subject.update!(actual_state: ::RemoteDevelopment::Workspaces::States::RUNNING) }.not_to change { - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 subject.desired_state_updated_at } end @@ -70,13 +70,11 @@ end describe 'validations' do + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 it 'validates max_hours_before_termination is no more than 120' do - # noinspection RubyResolve subject.max_hours_before_termination = described_class::MAX_HOURS_BEFORE_TERMINATION_LIMIT - # noinspection RubyResolve expect(subject).to be_valid - # noinspection RubyResolve subject.max_hours_before_termination = described_class::MAX_HOURS_BEFORE_TERMINATION_LIMIT + 1 expect(subject).not_to be_valid end diff --git a/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb b/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb index f5dd75628d2ecb1994fc4a364c6da155e053d544..ac2a3544a5ebec231a14914609172bff833b8da4 100644 --- a/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb +++ b/ee/spec/requests/api/graphql/mutations/remote_development/workspaces/create_spec.rb @@ -46,7 +46,7 @@ let_it_be(:created_workspace, refind: true) { create(:workspace, user: user) } - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 let(:stub_service_payload) { { workspace: created_workspace } } let(:stub_service_response) do ServiceResponse.success(payload: stub_service_payload) @@ -74,7 +74,7 @@ def mutation_response expect_graphql_errors_to_be_empty - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 expect(mutation_response.fetch('workspace')['name']).to eq(created_workspace['name']) end diff --git a/ee/spec/requests/api/graphql/remote_development/workspace_by_id_spec.rb b/ee/spec/requests/api/graphql/remote_development/workspace_by_id_spec.rb index 1ded73232296819e952182d96622b7a2fb19c895..3ced4bd1922a670749cf93f67b5390ef06c396ea 100644 --- a/ee/spec/requests/api/graphql/remote_development/workspace_by_id_spec.rb +++ b/ee/spec/requests/api/graphql/remote_development/workspace_by_id_spec.rb @@ -28,7 +28,6 @@ it_behaves_like 'a working graphql query' - # noinspection RubyResolve it { expect(subject['name']).to eq(workspace.name) } context 'when the user is not authorized' do diff --git a/ee/spec/requests/api/graphql/remote_development/workspaces_by_ids_spec.rb b/ee/spec/requests/api/graphql/remote_development/workspaces_by_ids_spec.rb index 564b70665213305e284ff84a36f1f1d967ae1f64..9e60592bfe532369ae28e93858b7abf41be55fe1 100644 --- a/ee/spec/requests/api/graphql/remote_development/workspaces_by_ids_spec.rb +++ b/ee/spec/requests/api/graphql/remote_development/workspaces_by_ids_spec.rb @@ -31,13 +31,13 @@ it_behaves_like 'a working graphql query' - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 it { is_expected.to match_array(a_hash_including('name' => workspace.name)) } - # noinspection RubyResolve context 'when the user requests a workspace that they are not authorized for' do let_it_be(:other_workspace) { create(:workspace) } - # noinspection RubyResolve + + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 let(:ids) do [ workspace.to_global_id.to_s, @@ -46,7 +46,7 @@ end it 'does not contain fields for the other workspace' do - # noinspection RubyResolve + # noinspection RubyResolve - https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/tracked-jetbrains-issues/#ruby-31542 expect(subject).to match_array(a_hash_including('name' => workspace.name)) end end diff --git a/ee/spec/requests/api/markdown_snapshot_spec.rb b/ee/spec/requests/api/markdown_snapshot_spec.rb index c50139dbb11bf16f26d6562c3ce073c144ac9284..60d3e06cdc8c67a9ac89d30c731cb41f6683f811 100644 --- a/ee/spec/requests/api/markdown_snapshot_spec.rb +++ b/ee/spec/requests/api/markdown_snapshot_spec.rb @@ -5,6 +5,5 @@ # See https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#markdown-snapshot-testing # for documentation on this spec. RSpec.describe API::Markdown, 'Snapshot', feature_category: :team_planning do - # noinspection RailsParamDefResolve (RubyMine can't find the shared context from this file location) include_context 'with API::Markdown Snapshot shared context', ee_only: true end diff --git a/ee/spec/support/helpers/remote_development/railway_oriented_programming_helpers.rb b/ee/spec/support/helpers/remote_development/railway_oriented_programming_helpers.rb index c359126b8d657d75d49141956f7ea0ec7a5ea424..80d66cdb8027a65f1c810258e743010924af9c71 100644 --- a/ee/spec/support/helpers/remote_development/railway_oriented_programming_helpers.rb +++ b/ee/spec/support/helpers/remote_development/railway_oriented_programming_helpers.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module RemoteDevelopment + # noinspection RubyClassModuleNamingConvention, RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ module RailwayOrientedProgrammingHelpers # NOTE: Depends upon `initial_value` being defined in the including spec def stub_methods_to_return_ok_result(*methods) diff --git a/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb b/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb index 7b1e38e111bf8b4b95e1b3e31ca234e8cd925e33..a6b6edf143fdf9061c75b3b2c4d84878b1fe70d3 100644 --- a/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb +++ b/ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb @@ -1,10 +1,12 @@ # frozen_string_literal: true RSpec.shared_context 'with remote development shared fixtures' do - # noinspection RubyDeadCode # rubocop:disable Metrics/ParameterLists # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/PerceivedComplexity + # rubocop:disable Layout/LineLength + # noinspection RubyInstanceMethodNamingConvention, RubyLocalVariableNamingConvention, RubyParameterNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ + # rubocop:enable Layout/LineLength def create_workspace_agent_info( workspace_id:, workspace_name:, @@ -53,7 +55,7 @@ def create_workspace_agent_info( host_template_environment_variable = get_workspace_host_template_env_var(workspace_name, dns_zone) root_url = Gitlab::Routing.url_helpers.root_url - # rubocop:disable Lint/UnreachableCode, Lint/DuplicateBranch + # rubocop:disable Lint/DuplicateBranch status = case [previous_actual_state, current_actual_state, workspace_exists] in [RemoteDevelopment::Workspaces::States::CREATION_REQUESTED, RemoteDevelopment::Workspaces::States::STARTING, _] @@ -226,31 +228,31 @@ def create_workspace_agent_info( raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError in [_, RemoteDevelopment::Workspaces::States::FAILED, _] raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError - <<~STATUS_YAML - conditions: - - lastTransitionTime: "2023-03-06T14:36:31Z" - lastUpdateTime: "2023-03-08T11:16:35Z" - message: ReplicaSet "#{workspace_name}-hash" has successfully progressed. - reason: NewReplicaSetAvailable - status: "True" - type: Progressing - - lastTransitionTime: "2023-03-08T11:16:55Z" - lastUpdateTime: "2023-03-08T11:16:55Z" - message: Deployment does not have minimum availability. - reason: MinimumReplicasUnavailable - status: "False" - type: Available - replicas: 1 - unavailableReplicas: 1 - updatedReplicas: 1 - STATUS_YAML + # <<~STATUS_YAML + # conditions: + # - lastTransitionTime: "2023-03-06T14:36:31Z" + # lastUpdateTime: "2023-03-08T11:16:35Z" + # message: ReplicaSet "#{workspace_name}-hash" has successfully progressed. + # reason: NewReplicaSetAvailable + # status: "True" + # type: Progressing + # - lastTransitionTime: "2023-03-08T11:16:55Z" + # lastUpdateTime: "2023-03-08T11:16:55Z" + # message: Deployment does not have minimum availability. + # reason: MinimumReplicasUnavailable + # status: "False" + # type: Available + # replicas: 1 + # unavailableReplicas: 1 + # updatedReplicas: 1 + # STATUS_YAML else msg = 'Unsupported state transition passed for create_workspace_agent_info fixture creation: ' \ "actual_state: #{previous_actual_state} -> #{current_actual_state}, " \ "existing_workspace: #{workspace_exists}" raise RemoteDevelopment::AgentInfoStatusFixtureNotImplementedError, msg end - # rubocop:enable Lint/UnreachableCode, Lint/DuplicateBranch + # rubocop:enable Lint/DuplicateBranch latest_k8s_deployment_info = <<~RESOURCES_YAML apiVersion: apps/v1 @@ -411,6 +413,7 @@ def create_workspace_agent_info( # rubocop:enable Metrics/CyclomaticComplexity # rubocop:enable Metrics/PerceivedComplexity + # noinspection RubyParameterNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def create_workspace_rails_info( name:, namespace:, @@ -430,6 +433,7 @@ def create_workspace_rails_info( end # rubocop:disable Metrics/ParameterLists + # noinspection RubyLocalVariableNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def create_config_to_apply( workspace_id:, workspace_name:, @@ -666,10 +670,12 @@ def create_config_to_apply( end # rubocop:enable Metrics/ParameterLists + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def get_workspace_host_template_annotation(workspace_name, dns_zone) %("{{.port}}-#{workspace_name}.#{dns_zone}") end + # noinspection RubyInstanceMethodNamingConvention - See https://handbook.gitlab.com/handbook/tools-and-tips/editors-and-ides/jetbrains-ides/code-inspection/why-are-there-noinspection-comments/ def get_workspace_host_template_env_var(workspace_name, dns_zone) %("${PORT}-#{workspace_name}.#{dns_zone}") end @@ -691,7 +697,6 @@ def example_processed_devfile # TODO: Rename this method and all methods which use it to end in `_yaml`, to clearly distinguish between # a String YAML representation of a devfile, and a devfile which has been converted to a Hash. def read_devfile(filename) - # noinspection RubyMismatchedArgumentType - File.read(Rails.root.join('ee/spec/fixtures/remote_development', filename)) + File.read(Rails.root.join('ee/spec/fixtures/remote_development', filename).to_s) end end diff --git a/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter.rb b/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter.rb index a34ae909c826a693051ed2e353faafcd12c69098..05eb88468c721c340143a4bbc9207c466f5a7ab6 100644 --- a/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter.rb +++ b/lib/gitlab/usage_data_counters/ipynb_diff_activity_counter.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -# noinspection RubyConstantNamingConvention module Gitlab module UsageDataCounters module IpynbDiffActivityCounter diff --git a/scripts/lib/glfm/render_static_html.rb b/scripts/lib/glfm/render_static_html.rb index bf7865c4d95acec95e5346cb4896a27916215e9c..ef2dc071c38f76cd6d6a703ea0fa384c0f93d305 100644 --- a/scripts/lib/glfm/render_static_html.rb +++ b/scripts/lib/glfm/render_static_html.rb @@ -29,7 +29,6 @@ include Glfm::Constants include Glfm::Shared - # noinspection RailsParamDefResolve (RubyMine can't find the shared context from this file location) include_context 'with GLFM example snapshot fixtures' it do @@ -49,7 +48,6 @@ api_url = metadata_hash.dig(name, :api_request_override_path) || (api "/markdown") post api_url, params: { text: markdown, gfm: true } - # noinspection RubyResolve expect(response).to be_successful returned_html_value = diff --git a/scripts/lib/glfm/shared.rb b/scripts/lib/glfm/shared.rb index 56cb2f95d6aeddfc0efaaeb057b48b1d7d7ad868..a17f4b30271564ee6f219a7fbe65d42a7a4c8fc3 100644 --- a/scripts/lib/glfm/shared.rb +++ b/scripts/lib/glfm/shared.rb @@ -29,7 +29,6 @@ def output(string) end def run_external_cmd(cmd) - # noinspection RubyMismatchedArgumentType rails_root = File.expand_path('../../../', __dir__) # See https://stackoverflow.com/a/20001569/25192 diff --git a/scripts/lib/glfm/update_example_snapshots.rb b/scripts/lib/glfm/update_example_snapshots.rb index 8f817d0173ebbba8266b50c242a55d8c7e8dda85..793f7521283911e0d2cef4971d340efda6e5367a 100644 --- a/scripts/lib/glfm/update_example_snapshots.rb +++ b/scripts/lib/glfm/update_example_snapshots.rb @@ -358,7 +358,6 @@ def generate_and_write_for_all_examples( glfm_examples_statuses[name][:already_printed] = true # Copy over the existing example only if it exists and preserve_existing is true, otherwise omit this example - # noinspection RubyScope hash[name] = existing_hash[name] if existing_hash[name] next diff --git a/scripts/lib/glfm/update_specification.rb b/scripts/lib/glfm/update_specification.rb index ef6f24d5a778e8d328b7b133f51be9e4bc2230e3..0effea833781a0063e69f9732361cde838690dc9 100644 --- a/scripts/lib/glfm/update_specification.rb +++ b/scripts/lib/glfm/update_specification.rb @@ -123,7 +123,6 @@ def update_ghfm_spec_md validate_expected_spec_version!(ghfm_spec_lines[2]) # Reset IO stream and re-read into a single string for easy writing - # noinspection RubyNilAnalysis ghfm_spec_txt_uri_io.seek(0) ghfm_spec_string = ghfm_spec_txt_uri_io.read raise "Unable to read string from #{GHFM_SPEC_TXT_URI}" unless ghfm_spec_string @@ -268,9 +267,7 @@ def generate_spec_html_files(spec_txt_string, snapshot_spec_md_string, ghfm_spec end # NOTE: body, title, and version are used by the ERB binding. - # noinspection RubyUnusedLocalVariable def add_styling_to_specification_html(body:, title:, version:) - # noinspection RubyMismatchedArgumentType ERB.new(File.read(File.expand_path('specification_html_template.erb', __dir__))).result(binding) end diff --git a/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb b/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb index ef8872ecbb0d0ea519338d1babc9899f905944bf..ddfde8eb464c6d0285de02c355e5f4c989b83de3 100644 --- a/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb +++ b/scripts/lib/glfm/verify_all_generated_files_are_up_to_date.rb @@ -25,9 +25,7 @@ def process output("Running `yarn install --frozen-lockfile` to ensure `yarn check-dependencies` doesn't fail...") run_external_cmd('yarn install --frozen-lockfile') - # noinspection RubyMismatchedArgumentType update_specification_script = File.expand_path('../../glfm/update-specification.rb', __dir__) - # noinspection RubyMismatchedArgumentType update_example_snapshots_script = File.expand_path('../../glfm/update-example-snapshots.rb', __dir__) output("Running `#{update_specification_script}`...") diff --git a/spec/frontend/content_editor/markdown_snapshot_spec.js b/spec/frontend/content_editor/markdown_snapshot_spec.js index 49b466fd7f532d21de0737bcc6712ba32fd7126b..5253b475ea5ae8d1eff47569d6b6c600344ffa74 100644 --- a/spec/frontend/content_editor/markdown_snapshot_spec.js +++ b/spec/frontend/content_editor/markdown_snapshot_spec.js @@ -64,7 +64,6 @@ describe('markdown example snapshots in ContentEditor', () => { const expectedHtml = expectedHtmlExamples[name].wysiwyg; const { html: actualHtml } = actualHtmlAndJsonExamples[name]; - // noinspection JSUnresolvedFunction (required to avoid RubyMine type inspection warning, because custom matchers auto-imported via Jest test setup are not automatically resolved - see https://youtrack.jetbrains.com/issue/WEB-42350/matcher-for-jest-is-not-recognized-but-it-is-runable) expect(actualHtml).toMatchExpectedForMarkdown( 'HTML', name, @@ -82,7 +81,6 @@ describe('markdown example snapshots in ContentEditor', () => { const expectedJson = expectedProseMirrorJsonExamples[name]; const { json: actualJson } = actualHtmlAndJsonExamples[name]; - // noinspection JSUnresolvedFunction expect(actualJson).toMatchExpectedForMarkdown( 'JSON', name, diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index c3076a2c359f44ff36b589a71f0b28dfc5256ae5..92a49d6a19678076d51eb88e8e4d588b8578fec9 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -676,7 +676,6 @@ def kube_deployment(name: "kube-deployment", environment_slug: "production", pro } end - # noinspection RubyStringKeysInHashInspection def knative_06_service(name: 'kubetest', namespace: 'default', domain: 'example.com', description: 'a knative service', environment: 'production', cluster_id: 9) { "apiVersion" => "serving.knative.dev/v1alpha1", "kind" => "Service", @@ -736,7 +735,6 @@ def knative_06_service(name: 'kubetest', namespace: 'default', domain: 'example. "podcount" => 0 } end - # noinspection RubyStringKeysInHashInspection def knative_07_service(name: 'kubetest', namespace: 'default', domain: 'example.com', description: 'a knative service', environment: 'production', cluster_id: 5) { "apiVersion" => "serving.knative.dev/v1alpha1", "kind" => "Service", @@ -788,7 +786,6 @@ def knative_07_service(name: 'kubetest', namespace: 'default', domain: 'example. "podcount" => 0 } end - # noinspection RubyStringKeysInHashInspection def knative_09_service(name: 'kubetest', namespace: 'default', domain: 'example.com', description: 'a knative service', environment: 'production', cluster_id: 5) { "apiVersion" => "serving.knative.dev/v1alpha1", "kind" => "Service", @@ -840,7 +837,6 @@ def knative_09_service(name: 'kubetest', namespace: 'default', domain: 'example. "podcount" => 0 } end - # noinspection RubyStringKeysInHashInspection def knative_05_service(name: 'kubetest', namespace: 'default', domain: 'example.com', description: 'a knative service', environment: 'production', cluster_id: 8) { "apiVersion" => "serving.knative.dev/v1alpha1", "kind" => "Service", diff --git a/spec/support/shared_contexts/glfm/api_markdown_snapshot_shared_context.rb b/spec/support/shared_contexts/glfm/api_markdown_snapshot_shared_context.rb index 3623fa0850d8fdb6140963840f155e42cfa46f30..a0d91d813ae5f0a588171505fea24aa5a0e315fd 100644 --- a/spec/support/shared_contexts/glfm/api_markdown_snapshot_shared_context.rb +++ b/spec/support/shared_contexts/glfm/api_markdown_snapshot_shared_context.rb @@ -29,7 +29,6 @@ let(:normalizations) { normalizations_by_example_name.dig(name, :html, :static, :snapshot) } it "verifies conversion of GLFM to HTML", :unlimited_max_formatted_output_length do - # noinspection RubyResolve normalized_html = normalize_html(html, normalizations) api_url = metadata_by_example_name&.dig(name, :api_request_override_path) || (api "/markdown") diff --git a/spec/support/shared_examples/requests/api/graphql/remote_development_shared_examples.rb b/spec/support/shared_examples/requests/api/graphql/remote_development_shared_examples.rb index 7c32c7bf2a936d8c98102d94aa789e8bc783bc9c..83e22945361a3e0860ec3d325ac8bf243ad39c19 100644 --- a/spec/support/shared_examples/requests/api/graphql/remote_development_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/graphql/remote_development_shared_examples.rb @@ -10,9 +10,7 @@ it_behaves_like 'a working graphql query' - # noinspection RubyResolve it { is_expected.to match_array(a_hash_including('name' => workspace.name)) } - # noinspection RubyResolve context 'when user is not authorized' do let(:current_user) { create(:user) }