Showing 99 of 2,171 total issues
Method convert_icon_links_into_images
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_icon_links_into_images
uri = URI.join(Rails.application.routes.url_helpers.root_url, "/api/v1/images/create.json")
links = Link.where(type: ["IconLink", "PhotoLink"]).find_each do |l|
url = Addressable::URI.parse(l.url).normalize.to_s
Method load
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def load
unassigned = Resource.unassigned.image
objects =
unassigned.map do |r|
info = Memory.find_by(short_name: r[:props]['short_name'])
- 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 fix_links_for_calendary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fix_links_for_calendary string, slug
cal = Calendary.by_slug(slug).first
Link.transaction do
Link.where("url ~* ?", string).where(info_type: "Memory").map do |x|
- 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 render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
console.log("[render] * props:", this.props, "state: ", this.state)
console.debug("[componentDidMount1]render ** ", this.getErrorText(this.props.value))
return (
Function matchBound
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
matchBound(date, forward, backward, strictDay, strictMonth, weekDayIn, weekDay, easter, year, baseDateRef) {
let cond = false,
condDate,
baseDate = baseDateRef["date"],
condString = `${weekDayIn && "+weekDayIn == weekDay" || "true"} && date ${baseDate && "<=" || ">="} condDate`
- 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 find
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def find *args
if self.respond_to?( :default_key )
new_args = args.flatten.reject { |a| a.blank? }
rel = self.where(self.default_key => new_args)
if rel.size < new_args.size
- 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 getPathsFromState
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function getPathsFromState(state) {
console.debug("[getPathsFromState] <<<", state)
console.debug("[getPathsFromState] **", state.calendarySlug, state.memory?.slug, state.eventee, state.gallery)
let calendarySlug = state.query.c?.split(",").length == 1 && state.query.c ||
state.query.c?.split(",")?.length == 0 && state.calendarySlug || null,
- 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 info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def info file
imageinfo = `identify "#{esc(file)}" 2>&1`.strip
fileinfo = `file -- "#{esc(file)}" 2>&1`.strip
unless /(?<type>GIF|JPEG|WEBP|PNG|BMP3?) (?<width>\d+)x(?<height>\d+)/ =~ imageinfo
- 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 render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
console.debug("[render] **", { 'this.props': this.props, 'this.state': this.state })
return (
!this.state.errored && <div
Function getErrorText
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
getErrorText(value_in, context_in = {}) {
let context = merge(this.props.validation_context || {}, context_in),
errors = [],
value = value_in || ''
Function onSuccessLoad
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
onSuccessLoad(response) {
let new_records, new_page, new_state, records = response.data
console.log("[onSuccessLoad] > response", response)
console.log("[onSuccessLoad] > records", records)
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
console.log("[render] > this.props", this.props)
return (
<div className='col s12'>
Method validate_each
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
options.each do |(type, sub_options)|
value_in =
case type
when :width, :height
Method load
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load
unassigned = Resource.unassigned.image
objects =
unassigned.map do |r|
info = Memory.find_by(short_name: r[:props]['short_name'])
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
console.log("[render] > props:", this.props)
return (
<div className='row'
Method fix_links_for_calendary
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fix_links_for_calendary string, slug
cal = Calendary.by_slug(slug).first
Link.transaction do
Link.where("url ~* ?", string).where(info_type: "Memory").map do |x|
Consider simplifying this complex logical expression. Open
if (!this.triggered || humanized_value &&
(!humanized_value.includes(this.triggered) &&
!this.triggered.includes(humanized_value) ||
this.data && (this.data.total > Object.keys(this.data.list).length &&
humanized_value.includes(this.triggered) ||
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
console.log("[render] > props:", this.props, "state:", this.state)
return (
<li
Method validate_each
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
o = plain_options
code = record.alphabeth_code.to_s.to_sym
res = Languageble::MATCH_TABLE[ code ]
if res
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
console.log("[render] * this.props", this.props)
return (
<div className='row calendary'>