Showing 52 of 79 total issues
Method _matches
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _matches
return [] if %i(json csv tsv ltsv).include?(@plugin_name)
begin
io = File.open(path)
reader = FileReverseReader.new(io)
Method delete_element
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_element(name, arg, element)
if name == "label"
label_section = fl_config.elements(name: name, arg: arg).first
original_size = label_section.elements.size
remaining_elements = label_section.elements.reject do |e|
Function preview
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
preview: function() {
console.log("preview!!!!");
if (this.previewAjax && this.previewAjax.state() === "pending") {
this.previewAjax.abort && this.previewAjax.abort();
}
Method parse_section
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_section(name, definition)
config_section(name, **definition.slice(:required, :multi, :alias)) do
if %i(buffer storage parse format).include?(name)
define_all_attributes(name)
else
Method logged_errors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def logged_errors(&block)
return [] unless File.exist?(log_file)
buf = []
io = File.open(log_file)
reader = ::FileReverseReader.new(io)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function created
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
created: function(){
let timer;
let self = this;
let currentInterval = POLLING_INTERVAL;
let fetch = function(){
Method config_param
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def config_param(name, type = ActiveModel::Type::Value.new, **options)
# NOTE: We cannot overwrite types defined by ActiveModel in config/initializers/types.rb
if type == :time
type = Fluentd::Setting::Type::Time.new
end
Method define_all_attributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_all_attributes(section_name)
registry = case section_name
when :buffer
Fluent::Plugin::BUFFER_REGISTRY
when :storage
Method register_plugin
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def register_plugin(type, name)
self.plugin_type = type
self.plugin_name = name
if ["filter", "output"].include?(type)
Function mounted
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
mounted: function() {
if (this.option.type === "enum") {
this.selectedValue = this.option.default;
} else if (this.option.type === "bool") {
this.checkboxValue = this.option.default;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_attributes(attributes)
sections, params = attributes.partition do |key, _|
self._sections.key?(key.to_sym)
end
elements = sections.map do |key, section_params|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method group_by_label
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def group_by_label
hash = Hash.new{|h, k| h[k] = {} }
sources.each do |source|
label = source["@label"] || source["label"]
if label
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method to_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_config
name = case plugin_type
when "input"
"source"
when "output"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method tail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def tail(limit = nil)
return [] unless File.exists?(log_file)
limit = limit.to_i rescue 0
limit = limit.zero? ? Settings.default_log_tail_count : limit
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse_config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_config(content)
scanner = StringScanner.new(content)
contents = Hash.new {|h, k| h[k] = [] }
until scanner.eos? do
started = scanner.pos
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _matches
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _matches
begin
io = File.open(path)
reader = FileReverseReader.new(io)
parserd_chunks = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method load_plugin_config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_plugin_config
dumped_config = {}
plugin_class.ancestors.reverse_each do |klass|
next unless klass.respond_to?(:dump_config_definition)
dumped_config_definition = klass.dump_config_definition
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method each_line
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each_line(&block)
#read from the end of file
io.seek(0, IO::SEEK_END)
buf = ""
loop do
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method tree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tree
Dir.glob("#{root_dir == "/" ? "/" : "#{root_dir}/"}*").map do |file|
{
:path => file,
:is_dir => File.directory?(file),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return element