znamenica/dneslov

View on GitHub

Showing 99 of 2,171 total issues

File memory.rb has 629 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Memory < ActiveRecord::Base
   extend TotalSize
   extend DefaultKey
   extend Informatible
   include WithTitles
Severity: Major
Found in app/models/memory.rb - About 1 day to fix

    File memoryMeta.jsx has 607 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { matchLanguages, matchAlphabeths, matchLetters, matchEmptyObject, matchCodes, matchEmptyCollection, matchValidUrl } from 'matchers'
    import { makeCouncil, makeDate, makeDescription } from 'makers'
    
    export const memoryMeta = {
       default: 'short_name',
    Severity: Major
    Found in app/components/memoryMeta.jsx - About 1 day to fix

      File memo.rb has 535 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'when_easter'
      
      # class Memo содержит сведения о помине какой-либо памяти в календаре,
      # таким образом связывая память и календарь. Может быть либо прямым обычным помином,
      # содержащим поле годовой даты year_date, либо соборным помином, таким
      Severity: Major
      Found in app/models/memo.rb - About 1 day to fix

        File languageble.rb has 458 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Languageble
           extend ActiveSupport::Concern
        
           OLD_RUSSIAN_CAPITAL = 'А-ЬЮЄЅІЇѠѢѤѦѨѪѬѮѰѲѴѸѺꙀꙂꙆꙈꙊꙐꙒꙖ'
           OLD_RUSSIAN_STROKE = 'а-ьюєѕіїѡѣѥѧѩѫѭѯѱѳѵѹѻꙁꙃꙇꙉꙋꙑꙓꙗ'
        Severity: Minor
        Found in app/models/concerns/languageble.rb - About 7 hrs to fix

          File memoMeta.jsx has 444 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { matchLanguages, matchAlphabeths, matchLetters, matchEmptyObject, matchCodes, matchEmptyCollection } from 'matchers'
          import UrlRegexp from 'UrlRegexp'
          
          export const memoMeta = {
             default: 'memory',
          Severity: Minor
          Found in app/components/memoMeta.jsx - About 6 hrs to fix

            Method total_size has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

               def total_size
                  model = self.name.constantize
                  rela = self.except(:limit, :offset)
                  return totals(rela) #TODO
                  pure = rela.except(:group, :order, :select, :joins, :left_outer_joins)
            Severity: Minor
            Found in app/models/concerns/total_size.rb - About 5 hrs 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

            File event.rb has 377 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class Event < ActiveRecord::Base
               extend Informatible
               extend TotalSize
               include WithTitles
               include WithDescriptions
            Severity: Minor
            Found in app/models/event.rb - About 5 hrs to fix

              File DynamicField.jsx has 352 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Component } from 'react'
              import PropTypes from 'prop-types'
              import { mixin, flow } from 'lodash-decorators'
              import { Autocomplete } from 'materialize-css'
              import axios from 'axios'
              Severity: Minor
              Found in app/components/DynamicField.jsx - About 4 hrs to fix

                Function matchLetters has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function matchLetters(textIn, context) {
                   let res = false, text = textIn || ""
                
                   console.debug("[matchLetters] ** text:", text, "context:", context)
                
                
                Severity: Major
                Found in app/components/matchers.jsx - About 4 hrs to fix

                  File calendaryMeta.jsx has 332 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { matchLanguages, matchAlphabeths, matchLetters, matchEmptyObject, matchCodes, matchEmptyCollection, matchValidJson, matchValidUrl } from 'matchers'
                  import { makeTitle } from 'makers'
                  import UrlRegexp from 'UrlRegexp'
                  
                  export const calendaryMeta = {
                  Severity: Minor
                  Found in app/components/calendaryMeta.jsx - About 4 hrs to fix

                    File orderMeta.jsx has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { matchLanguages, matchAlphabeths, matchLetters, matchEmptyObject,
                             matchCodes, matchEmptyCollection } from 'matchers'
                    import { makeTweet, makeNote, makeDescription } from 'makers'
                    import UrlRegexp from 'UrlRegexp'
                    
                    
                    Severity: Minor
                    Found in app/components/orderMeta.jsx - About 3 hrs to fix

                      Function renderElement has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function renderElement(element, meta) {
                         console.debug("[renderElement] << element:", element, "meta:", meta)
                      
                         let mapped = Object.getOwnPropertyNames(meta).reduce((metaResult, nameIn) => {
                            let forIn = meta[nameIn].for,
                      Severity: Minor
                      Found in app/components/render.jsx - About 3 hrs 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 validate_each has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                         def validate_each(record, attribute, value)
                            options.each do |(type, sub_options)|
                               value_in =
                                  case type
                                  when :width, :height
                      Severity: Minor
                      Found in app/validators/size_validator.rb - About 3 hrs 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

                      Class CommonController has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Admin::CommonController < ApplicationController
                         include ::Auth
                         include ::Pundit::Authorization
                      
                         before_action :authenticate_user!, except: %i(dashboard)
                      Severity: Minor
                      Found in app/controllers/admin/common_controller.rb - About 3 hrs to fix

                        DynamicField has 29 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        @mixin(Subscribed)
                        @mixin(Validation)
                        @mixin(ValueToObject)
                        @mixin(RepathTo)
                        export default class DynamicField extends Component {
                        Severity: Minor
                        Found in app/components/DynamicField.jsx - About 3 hrs to fix

                          Class ImageSyncService has 29 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class ImageSyncService
                             attr_reader :targets, :source, :storage, :asset_path
                          
                             def initialize source: nil, targets: [], asset_path: nil, storage: nil
                                @source = source # path
                          Severity: Minor
                          Found in app/services/image_sync_service.rb - About 3 hrs to fix

                            Function renderElement has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function renderElement(element, meta) {
                               console.debug("[renderElement] << element:", element, "meta:", meta)
                            
                               let mapped = Object.getOwnPropertyNames(meta).reduce((metaResult, nameIn) => {
                                  let forIn = meta[nameIn].for,
                            Severity: Major
                            Found in app/components/render.jsx - About 3 hrs to fix

                              Method total_size has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                 def total_size
                                    model = self.name.constantize
                                    rela = self.except(:limit, :offset)
                                    return totals(rela) #TODO
                                    pure = rela.except(:group, :order, :select, :joins, :left_outer_joins)
                              Severity: Major
                              Found in app/models/concerns/total_size.rb - About 3 hrs to fix

                                Method included has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                   def self.included base
                                      base.class_eval do
                                         has_many :titles, -> { title }, as: :describable, class_name: :Title
                                         has_many :default_titles, -> { distinct }, through: :kind, source: :names, class_name: :Appellation
                                         has_many :all_titles, ->(this) do
                                Severity: Major
                                Found in app/models/concerns/with_titles.rb - About 3 hrs to fix

                                  Method convert_icon_links_into_images has a Cognitive Complexity of 22 (exceeds 5 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
                                  Severity: Minor
                                  Found in app/lib/tasks.rb - About 3 hrs 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