Skip to content

Commit

Permalink
Rubocop: Enable various EmptyLine cops (#15194)
Browse files Browse the repository at this point in the history
Disabled:
 * EmptyLineAfterGuardClause
 * EmptyLineAfterMultilineCondition
 * EmptyLinesAroundAccessModifier

Enabled:
 * Layout/EmptyLineAfterMagicComment
 * Layout/EmptyLineBetweenDefs
 * Layout/EmptyLines
 * Layout/EmptyLinesAroundArguments
 * Layout/EmptyLinesAroundAttributeAccessor
 * Layout/EmptyLinesAroundBeginBody
 * Layout/EmptyLinesAroundBlockBody
 * Layout/EmptyLinesAroundExceptionHandlingKeywords
 * Layout/EmptyLinesAroundMethodBody
 * Layout/EmptyLinesAroundModuleBody
  • Loading branch information
roaksoax authored Jul 18, 2023
1 parent d95a0bb commit acd87a6
Show file tree
Hide file tree
Showing 212 changed files with 92 additions and 447 deletions.
54 changes: 27 additions & 27 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,33 @@ Lint/BigDecimalNew:
Enabled: true

#################### Layout ###########################
##### Enabled Cops #####
##### Enabled/Disabled Cops #####
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/EmptyLineAfterMagicComment:
Enabled: true
Layout/EmptyLineAfterMultilineCondition:
Enabled: false
Layout/EmptyLineBetweenDefs:
EnabLEd: true
Layout/EmptyLines:
Enabled: true
Layout/EmptyLinesAroundAccessModifier:
Enabled: false
Layout/EmptyLinesAroundArguments:
Enabled: true
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/EmptyLinesAroundBeginBody:
Enabled: true
Layout/EmptyLinesAroundBlockBody:
Enabled: true
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: true
Layout/EmptyLinesAroundMethodBody:
Enabled: true
Layout/EmptyLinesAroundModuleBody:
Enabled: true
Layout/TrailingWhitespace:
Enabled: true
Layout/TrailingEmptyLines:
Expand Down Expand Up @@ -77,34 +103,8 @@ Layout/ElseAlignment:
Enabled: false
Layout/EmptyComment:
Enabled: false
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/EmptyLineAfterMagicComment:
Enabled: false
Layout/EmptyLineAfterMultilineCondition:
Enabled: false
Layout/EmptyLineBetweenDefs:
Enabled: false
Layout/EmptyLines:
Enabled: false
Layout/EmptyLinesAroundAccessModifier:
Enabled: false
Layout/EmptyLinesAroundArguments:
Enabled: false
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: false
Layout/EmptyLinesAroundBeginBody:
Enabled: false
Layout/EmptyLinesAroundBlockBody:
Enabled: false
Layout/EmptyLinesAroundClassBody:
Enabled: false
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: false
Layout/EmptyLinesAroundMethodBody:
Enabled: false
Layout/EmptyLinesAroundModuleBody:
Enabled: false
Layout/EndAlignment:
Enabled: false
Layout/EndOfLine:
Expand Down
7 changes: 2 additions & 5 deletions ci/test_supported_plugins.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8

# Test the
# - build (rspec),
# Test the
# - build (rspec),
# - packaging (gem build)
# - and deploy (bin/logstash-plugin install)
# of a plugins inside the current Logstash, using its JRuby
Expand Down Expand Up @@ -104,7 +104,6 @@ def install_gem(gem_file)
end
end


# reason could be a symbol, describing the phase that broke:
# :unit_test, :gem_build, :gem_install
FailureDetail = Struct.new(:plugin_name, :reason)
Expand Down Expand Up @@ -267,5 +266,3 @@ def setup_logstash_for_development
else
puts "NO ERROR ON PLUGINS!"
end


2 changes: 0 additions & 2 deletions lib/bootstrap/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def invoke!(options = {})
"BUNDLE_GEMFILE" => LogStash::Environment::GEMFILE_PATH,
"BUNDLE_SILENCE_ROOT_WARNING" => "true",
"BUNDLE_WITHOUT" => options[:without].join(":")}) do

if !debug?
# Will deal with transient network errors
execute_bundler_with_retry(options)
Expand Down Expand Up @@ -311,6 +310,5 @@ def capture_stdout(&block); require 'stringio'
ensure
$stdout = old_stdout
end

end
end
1 change: 0 additions & 1 deletion lib/bootstrap/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def vendor_path(path)
def pattern_path(path)
return ::File.join(LOGSTASH_HOME, "patterns", path)
end

end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def versions(plugin)
require_relative "patches/gems"
Gems.versions(plugin)
end

# Take a gem package and extract it to a specific target
# @param [String] Gem file, this must be a path
# @param [String, String] Return a Gem::Package and the installed path
Expand All @@ -51,6 +52,5 @@ def unpack(file, path)

return [package, target_path]
end

end
end
3 changes: 0 additions & 3 deletions lib/bootstrap/util/compress.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
require "stud/temporary"

module LogStash

class CompressError < StandardError; end

module Util
module Zip

extend self

# Extract a zip file into a destination directory.
Expand Down Expand Up @@ -61,7 +59,6 @@ def compress(dir, target)
end

module Tar

extend self

# Extract a tar.gz file into a destination directory.
Expand Down
1 change: 0 additions & 1 deletion lib/pluginmanager/bundler/logstash_injector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
require "rubygems/specification"
require "pathname"


# This class cannot be in the logstash namespace, because of the way the DSL
# class interact with the other libraries
module Bundler
Expand Down
1 change: 0 additions & 1 deletion lib/pluginmanager/bundler/logstash_uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def dependants_gems(gem_name)

def uninstall!(gem_name)
unfreeze_gemfile do

dependencies_from = dependants_gems(gem_name)

if dependencies_from.size > 0
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class PluginNotFoundError < PluginManagerError; end
class UnpackablePluginError < PluginManagerError; end
class FileNotFoundError < PluginManagerError; end
class InvalidPackError < PluginManagerError; end

class InstallError < PluginManagerError
attr_reader :original_exception

Expand Down
1 change: 0 additions & 1 deletion lib/pluginmanager/proxy_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
require "stud/temporary"
require "jar-dependencies"


# This is a bit of a hack, to make sure that all of our call pass to a specific proxies.
# We do this before any jar-dependences check is done, meaning we have to silence him.
module Jars
Expand Down
3 changes: 0 additions & 3 deletions lib/pluginmanager/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
require "yaml"

module LogStash::PluginManager

def self.load_aliases_definitions(path = File.expand_path('plugin_aliases.yml', __dir__))
content = IO.read(path)

Expand Down Expand Up @@ -58,7 +57,6 @@ class ValidationError < StandardError; end
# @option options [Array<String>] :rubygems_source Gem sources to lookup for the verification
# @return [Boolean] true if valid logstash plugin gem name & version or a .gem file
def self.logstash_plugin?(plugin, version = nil, options={})

if plugin_file?(plugin)
begin
return logstash_plugin_gem_spec?(plugin_file_spec(plugin))
Expand Down Expand Up @@ -174,7 +172,6 @@ def self.which_integration_plugin_provides(name, gemfile)
# @param plugin_list [Array] array of [plugin name, version] tuples
# @return [Array] array of [plugin name, version, ...] tuples when duplicate names have been merged and non duplicate version requirements added
def self.merge_duplicates(plugin_list)

# quick & dirty naive dedup for now
# TODO: properly merge versions requirements
plugin_list.uniq(&:first)
Expand Down
2 changes: 0 additions & 2 deletions lib/pluginmanager/x_pack_interceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
# under the License.

module LogStash; module PluginManager

# Centralised messaging about installing and removing x-pack, which is no longer a plugin, but
# part of the distribution.
module XPackInterceptor

module Install
extend self

Expand Down
1 change: 1 addition & 0 deletions logstash-core-plugin-api/logstash-core-plugin-api.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- encoding: utf-8 -*-

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Expand Down
1 change: 0 additions & 1 deletion logstash-core/lib/logstash/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ def shutdown_pipelines
resolve_actions_and_converge_state([]) # We stop all the pipeline, so we converge to a empty state
end


def setting(key)
@settings.get(key)
end
Expand Down
1 change: 0 additions & 1 deletion logstash-core/lib/logstash/api/command_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
require "logstash/api/commands/node"
require "logstash/api/commands/default_metadata"


module LogStash
module Api
class CommandFactory
Expand Down
1 change: 0 additions & 1 deletion logstash-core/lib/logstash/codecs/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.


require "logstash/plugin"

# This is the base class for logstash codecs.
Expand Down
2 changes: 1 addition & 1 deletion logstash-core/lib/logstash/compiler/lscl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def expr
end

class Plugins < Node; end

class Plugin < Node
def expr
expr_attributes = self.map_expr_attributes
Expand Down Expand Up @@ -337,7 +338,6 @@ def expr

all_elements = [first_element, *rest_elements]


res = if all_elements.size == 1
elem = all_elements.first
if elem.is_a?(Selector)
Expand Down
Loading

0 comments on commit acd87a6

Please sign in to comment.