znamenica/dneslov

View on GitHub

Showing 99 of 2,171 total issues

Method included has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

   def self.included base
      base.class_eval do
         has_many :descriptions, -> { where(type: :Description) }, as: :describable, dependent: :delete_all do
            def for language_codes
               where(language_code: language_codes).first
Severity: Minor
Found in app/models/concerns/with_descriptions.rb - About 45 mins to fix

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 makeNote has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function makeNote(value, locales, source = 'notes', filter = null) {
   let notes = locales.map((locale) => {
      return value[source].reduce((res, text) => {
         return res ||
            locale === text.language_code &&
Severity: Minor
Found in app/components/makers.jsx - About 45 mins to fix

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 matchValidJson has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function matchValidJson(text) {
   if (text) {
      switch (text.constructor.name) {
         case "String":
            try {
Severity: Minor
Found in app/components/matchers.jsx - About 45 mins to fix

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 copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

   def copy source, target, type, kind, scheme
Severity: Minor
Found in app/services/image_sync_service.rb - About 35 mins to fix

    Method validates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

       def validates scheme
          scheme[:attrs].each do |a|
             duped = duped(a)
    
             error("Invalid height of image file #{a[:source]}") if a[:kind] == :invalid
    Severity: Minor
    Found in app/services/image_sync_service.rb - About 35 mins to fix

    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_root_in_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def fix_root_in_names
             Name.all.each do |name|
                line = [ name ]
                last = name
    
    
    Severity: Minor
    Found in app/lib/tasks.rb - About 35 mins to fix

    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 targets= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

       def targets= value
          if value.kind_of?( Array )
             new_value = value.map do |v|
                if v.kind_of?(String) && v =~ /^\^(.*)/
                   Memory.where(short_name: $1).first
    Severity: Minor
    Found in app/models/scriptum/canto.rb - About 35 mins to fix

    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 year_date_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

       def year_date_for year
          case year_date
          when /(?<sign>[+-])(?<indent>.*)/
             mul = sign == '-' && -1 || 1
             WhenEaster::EasterCalendar.find_greek_easter_date(year.to_i) + (mul * indent.to_i).days
    Severity: Minor
    Found in app/models/memo.rb - About 35 mins to fix

    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 onChange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

       onChange(e) {
          let humanized_value = e.target.value
    
          console.log("[onChange] * update to", humanized_value)
          this.updateTo(humanized_value, false)
    Severity: Minor
    Found in app/components/DynamicField.jsx - About 35 mins to fix

    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 proceed_joins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

       def proceed_joins joins, default_type = :inner
          joins.reduce({}) do |res, join|
             _outer = false
    
             name =
    Severity: Minor
    Found in app/models/concerns/total_size.rb - About 35 mins to fix

    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 filterMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    Array.prototype.filterMap = function(func) {
       return this.reduce(([res, index], key) => {
          if (func && func.constructor.name === "Function") {
             let value = func(key, index)
    
    
    Severity: Minor
    Found in app/assets/javascripts/ext.js - About 35 mins to fix

    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 draw_memoes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

       def draw_memoes
          grouped.each do |(date, date_memoes)|
             memo = date_memoes.reject { |m| m.descriptions.empty? }.first
             next if !memo
    
    
    Severity: Minor
    Found in app/services/pdf_book_service.rb - About 25 mins to fix

    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 yearDateFromDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function yearDateFromDate(date_in) {
       console.debug("[yearDateFromDate] <<<", date_in)
    
       let date, yearDate
    
    
    Severity: Minor
    Found in app/components/support.jsx - About 25 mins to fix

    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 onSuccessLoad has a Cognitive Complexity of 6 (exceeds 5 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)
    Severity: Minor
    Found in app/components/Records.jsx - About 25 mins to fix

    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 activeClassFor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

       activeClassFor(memo) {
          if (this.indexActiveMemo() >= 0) {
             if (memo.calendary_slug == this.props.defaultCalendarySlug) {
                return "active"
             }
    Severity: Minor
    Found in app/components/Description.jsx - About 25 mins to fix

    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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

       def initialize source: nil, targets: [], asset_path: nil, storage: nil
          @source = source # path
          @targets = targets # paths
          @asset_path = asset_path || '/images'
          @storage = Rails.root.join(storage || 'public/images')
    Severity: Minor
    Found in app/services/image_sync_service.rb - About 25 mins to fix

    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 getFirstName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

       static getFirstName(props, namesIn) {
          let preprios = [
             'благословенное',
             'схимное',
             'иноческое',
    Severity: Minor
    Found in app/components/Name.jsx - About 25 mins to fix

    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 renderValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

       renderValue() {
          if (this.props.value) {
             switch (this.props.value.constructor.name) {
                case "String":
                   try {
    Severity: Minor
    Found in app/components/JsonEditor.jsx - About 25 mins to fix

    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 populateTo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    String.prototype.populateTo = function(string) {
       let from = this.charCodeAt(0),
           to = string.charCodeAt(0),
           res = []
    
    
    Severity: Minor
    Found in app/assets/javascripts/ext.js - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language