znamenica/dneslov

View on GitHub

Showing 99 of 2,171 total issues

File PickMeUpCalendar.jsx has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component } from 'react'
import * as Pickmeup from 'pickmeup/js/pickmeup.js'
import { merge } from 'merge-anything'
import {julianEaster, orthodoxEaster} from 'date-easter'
import PropTypes from 'prop-types'
Severity: Minor
Found in app/components/PickMeUpCalendar.jsx - About 3 hrs to fix

    File nameMeta.jsx has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File scriptumMeta.jsx has 281 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { matchLanguages, matchAlphabeths, matchLetters, matchEmptyObject, matchCodes, matchEmptyCollection } from 'matchers'
      
      export const scriptumMeta = {
         default: "text", //TODO (value) => { return value.text || value.ref_title || value.title },
         remoteNames: 'scripta',
      Severity: Minor
      Found in app/components/scriptumMeta.jsx - About 2 hrs to fix

        Function rendered has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

           let rendered = Object.getOwnPropertyNames(mapped).map(name => {
              let visibleIf = mapped[name]['visible_if'], visible = true
        
              switch(visibleIf && visibleIf.constructor.name) {
              case 'Object':
        Severity: Major
        Found in app/components/render.jsx - About 2 hrs to fix

          Function render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

             render() {
                console.log("[Dashboard] * state", this.state)
          
                return (
                   [<header>
          Severity: Major
          Found in app/components/Dashboard.jsx - About 2 hrs to fix

            Function dateFor has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

               static dateFor(yearDate, msDate, style) {
                  console.debug("[dateFor] <<<", yearDate, msDate, style)
            
                  let dateIn = new Date(msDate || Date.now()),
                      yearIn = dateIn.getFullYear(),
            Severity: Minor
            Found in app/components/EventSpans.jsx - About 2 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 parse_instance_attrs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse_instance_attrs model_name, attrs, key
                     model = model_name.constantize
                     children =
                        attrs.map do |x, value|
                           (value.is_a?(Array) || value.is_a?(Hash)) && x || nil
            Severity: Minor
            Found in lib/concerns/redisable.rb - About 2 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 included has 60 lines of code (exceeds 25 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: Major
            Found in app/models/concerns/with_descriptions.rb - About 2 hrs to fix

              Function matchCodes has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function matchCodes(eIn, context) {
                 let e = eIn || {}
              
                 const language_tree = {
                    ру: ['РУ', 'РО'],
              Severity: Major
              Found in app/components/matchers.jsx - About 2 hrs to fix

                Function render has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                   render() {
                      console.log("[render] *", { 'this.props': this.props, 'this.state': this.state })
                
                      return (
                         <div className='row'>
                Severity: Major
                Found in app/components/Eventee.jsx - About 2 hrs to fix

                  Function render has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                     render() {
                        console.log("[render] *", { 'this.props': this.props, 'this.state': this.state })
                  
                        return (
                           <div className='row'>
                  Severity: Major
                  Found in app/components/Picture.jsx - About 2 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                          } else if (m[3]) {
                             year = this.fixedYearForYearDate(m[3], yearIn),
                             datePre = new Date(Date.parse((m[3].concat("." + year)).split('.').reverse().join('-'))),
                             gapIn = parseInt(m[5]) - datePre.getDay()
                    
                    
                    Severity: Critical
                    Found in app/components/EventSpans.jsx - About 2 hrs to fix

                      PickMeUpCalendar has 22 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default class PickMeUpCalendar extends Component {
                         static defaultProps = {
                            withDate: null,
                            calendarStyle: 'neojulian',
                            calendary: {},
                      Severity: Minor
                      Found in app/components/PickMeUpCalendar.jsx - About 2 hrs to fix

                        Method validate_each has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                           def validate_each(record, attribute, value)
                              # if a local link just return true
                              return true if value =~ %r{^/}
                        
                              response = Net::HTTP.get_response(URI(value && Addressable::URI.encode(value)))
                        Severity: Minor
                        Found in app/validators/uri_validator.rb - About 2 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 fix_year_date has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                           def fix_year_date
                              self.year_date =
                              case self.year_date
                              when /пасха/
                                 "+0"
                        Severity: Major
                        Found in app/models/memo.rb - About 2 hrs to fix

                          File subjectMeta.jsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { matchLanguages, matchAlphabeths, matchLetters, matchEmptyObject,
                                   matchCodes, matchEmptyCollection, matchValidJson } from 'matchers'
                          import { makeName, makeDescription } from 'makers'
                          import UrlRegexp from 'UrlRegexp'
                          
                          
                          Severity: Minor
                          Found in app/components/subjectMeta.jsx - About 2 hrs to fix

                            Method validate_each has a Cognitive Complexity of 16 (exceeds 5 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
                            Severity: Minor
                            Found in app/validators/alphabeth_validator.rb - About 2 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

                            Function render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                               render() {
                                  console.log('props', this.props)
                            
                                  return (
                                     [<header>
                            Severity: Major
                            Found in app/components/About.jsx - About 2 hrs to fix

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

                                 def self.included base
                                    base.class_eval do
                                       has_many :links, as: :info, dependent: :destroy
                              
                                       scope :with_links, -> context do
                              Severity: Minor
                              Found in app/models/concerns/with_links.rb - About 2 hrs to fix

                                Function render has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                   render() {
                                      console.log("[render] * this.props:", this.props, "this.state:", this.state)
                                
                                      return [
                                         <div>
                                Severity: Minor
                                Found in app/components/Records.jsx - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language