Showing 141 of 177 total issues
Method handle
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle(data, event = Event.new, headers)
url = interpolated(event.payload)[:post_url]
case method
when 'get', 'delete'
Function map_marker
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.map_marker = function (map, options) {
let marker;
if (options == null) {
options = {};
}
Method included
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(mod)
mod.module_exec do
include HasAuthors
include HasEnclosure
include HasLinks
Method check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check
memory[:ids] ||= []
memory[:last_liked] ||= 0
# Request Likes of blog_name after the last stored timestamp (or default of 0)
- 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 handle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def handle(data, event = Event.new, headers)
url = interpolated(event.payload)[:post_url]
case method
when 'get', 'delete'
- 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 included
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(mod)
mod.module_exec do
sax_config.top_level_elements['link'].clear
sax_config.collection_elements['link'].clear
Method validate_options
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_options
unless options['post_url'].present?
errors.add(:base, "post_url is a required field")
end
Method generate_diff
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def generate_diff
@agent_diffs = (parsed_data['agents'] || []).map.with_index do |agent_data, index|
# AgentDiff is defined at the end of this file.
agent_diff = AgentDiff.new(agent_data, parsed_data['schema_version'])
if existing_scenario
- 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 validate_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_options
if options['mode'].blank? || !['read', 'write'].include?(options['mode'])
errors.add(:base, "The 'mode' option is required and must be set to 'read' or 'write'")
end
if options['bucket'].blank?
- 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 validate_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_options
errors.add(:base, 'auth_token is required') unless options['auth_token'].present?
errors.add(:base, 'chat_id is required') unless options['chat_id'].present?
errors.add(:base,
'caption should be 1024 characters or less') if interpolated['caption'].present? && interpolated['caption'].length > 1024 && (!interpolated['long_message'].present? || interpolated['long_message'] != 'split')
- 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 nav_link
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def nav_link(name, path, options = {}, &block)
content = link_to(name, path, options)
active = current_page?(path)
if block
# Passing a block signifies that the link is a header of a hover
- 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 buildAce
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildAce() {
return $(".ace-editor").each(function () {
if (!$(this).data("initialized")) {
const $this = $(this);
$this.data("initialized", true);
Method receive
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receive(incoming_events)
# if there are too many, dump a bunch to avoid getting rate limited
if incoming_events.count > 20
incoming_events = incoming_events.first(20)
end
Method form_configurable
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def form_configurable(name, *args)
options = args.extract_options!.reverse_merge(roles: [], type: :string)
if args.all?(Symbol)
options.assert_valid_keys([:type, :roles, :values, :ace, :cache_response, :html_options])
Function showDynamicModal
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
static showDynamicModal(content, param) {
if (content == null) {
content = "";
}
if (param == null) {
Method receive_event
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def receive_event(event)
interpolate_with event do
messages_send = TELEGRAM_ACTIONS.count do |field, _method|
payload = event.payload[field]
next unless payload.present?
- 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 validate_options
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_options
errors.add(:base, "username is required") unless options[:username].present?
errors.add(:base, "number is required") unless options[:number].present?
errors.add(:base, "history is required") unless options[:history].present?
errors.add(
- 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 receive
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def receive(incoming_events)
tweets = tweets_from_events(incoming_events)
begin
twitter.favorite(tweets) if favorite?
- 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 handle_data
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_data(body, url, existing_payload)
# Beware, url may be a URI object, string or nil
doc = parse(body)
Method create
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
attrs = agent_params
if agent = current_user.agents.find_by(id: params[:agent_id])
# POST /agents/:id/dry_run
if attrs.present?