Showing 79 of 79 total issues
Method _matches
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _matches
begin
io = File.open(path)
reader = FileReverseReader.new(io)
parserd_chunks = []
Method to_config
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_config
name = case plugin_type
when "input"
"source"
when "output"
Method define_all_attributes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def define_all_attributes(section_name)
registry = case section_name
when :buffer
Fluent::Plugin::BUFFER_REGISTRY
when :storage
- 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 check_permission
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_permission(column)
path = send(column)
return if path.blank? # if empty, presence: true will catch it
begin
- 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 register_plugin
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def register_plugin(type, name)
self.plugin_type = type
self.plugin_name = name
if ["filter", "output"].include?(type)
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_attributes(attributes)
base_klasses = config_definition.keys
sections, params = attributes.partition do |key, _section_attributes|
base_klasses.any? do |base_klass|
config_definition.dig(base_klass, key.to_sym, :section) || config_definition.dig(key.to_sym, :section)
Similar blocks of code found in 2 locations. Consider refactoring. Open
beforeMount: function() {
this.pluginType = this.$el.attributes.pluginType.nodeValue;
this.pluginName = this.$el.attributes.pluginName.nodeValue;
},
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
beforeMount: function() {
this.logUrl = this.$el.attributes.logUrl.nodeValue;
this.initialAutoReload = this.$el.attributes.initialAutoReload.nodeValue;
},
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 64.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method delete_element
has a Cognitive Complexity of 12 (exceeds 5 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|
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_attributes(attributes)
base_klasses = config_definition.keys
sections, params = attributes.partition do |key, _section_attributes|
base_klasses.any? do |base_klass|
config_definition.dig(base_klass, key.to_sym, :section) || config_definition.dig(key.to_sym, :section)
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
"formats": function(newValue, oldValue) {
console.log(`watch formats: ${newValue}`);
this.$emit("change-formats", {
"format_firstline": this.formatFirstline,
"formats": this.formats
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
"formatFirstLine": function(newValue, oldValue) {
console.log(`watch formatFirstLine: ${newValue}`);
this.$emit("change-formats", {
"format_firstline": this.formatFirstline,
"formats": this.formats
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method dump_parsed_config
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dump_parsed_config(parsed_config)
content = "".dup
sources = parsed_config["source"] || []
filters = parsed_config["filter"] || []
matches = parsed_config["match"] || []
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