znamenica/dneslov

View on GitHub

Showing 2,171 of 2,171 total issues

Assignment Branch Condition size for fix_year_date is too high. [64.08/30]
Open

   def fix_year_date
      self.year_date =
      case self.year_date
      when /пасха/
         "+0"
Severity: Minor
Found in app/models/memo.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

    Block has too many lines. [76/25]
    Open

          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
                where( describable_type: model.name, describable_id: this.id, kind: "Title" )
    Severity: Minor
    Found in app/models/concerns/with_titles.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

       onYesterdayClick(e) {
          let date = this.pmu.get_date()
    
          date.setDate(date.getDate() - 1)
          this.pmu.set_date(date)
    Severity: Major
    Found in app/components/PickMeUpCalendar.jsx and 1 other location - About 4 hrs to fix
    app/components/PickMeUpCalendar.jsx on lines 298..307

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

       onTomorrowClick(e) {
          let date = this.pmu.get_date()
    
          date.setDate(date.getDate() + 1)
          this.pmu.set_date(date)
    Severity: Major
    Found in app/components/PickMeUpCalendar.jsx and 1 other location - About 4 hrs to fix
    app/components/PickMeUpCalendar.jsx on lines 287..296

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

         static getDerivedStateFromProps(props, state) {
            if (props !== state.prevProps) {
               //let memo = Eventee.getMemo(props)
      
               return {
      Severity: Major
      Found in app/components/Eventee.jsx and 1 other location - About 4 hrs to fix
      app/components/Picture.jsx on lines 59..79

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 123.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

         static getDerivedStateFromProps(props, state) {
            if (props !== state.prevProps) {
               //let memo = Eventee.getMemo(props)
      
               return {
      Severity: Major
      Found in app/components/Picture.jsx and 1 other location - About 4 hrs to fix
      app/components/Eventee.jsx on lines 58..78

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 123.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Block has too many lines. [71/25]
        Open

           scope :with_memoes, -> context do
              as = table.table_alias || table.name
              language_codes = [ context[:locales] ].flatten
              cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
        
        
        Severity: Minor
        Found in app/models/memory.rb by rubocop

        This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export function matchLanguages(objectIn) {
           let languages = [], object = objectIn || {}
        
           Object.entries(object).forEach(([key, value]) => {
              languages.push(value.language_code)
        Severity: Major
        Found in app/components/matchers.jsx and 1 other location - About 4 hrs to fix
        app/components/matchers.jsx on lines 219..228

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 117.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export function matchAlphabeths(objectIn) {
           let alphabeths = [], object = objectIn || {}
        
           Object.entries(object).forEach(([key, value]) => {
              alphabeths.push(value.alphabeth_code)
        Severity: Major
        Found in app/components/matchers.jsx and 1 other location - About 4 hrs to fix
        app/components/matchers.jsx on lines 208..217

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 117.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

           onChange(e) {
              console.log("[onChange] <<<")
              let object = valueToObject(this.props.name, e.target.value),
                  ce = new CustomEvent('dneslov-update-path', { detail: { value: object, path: this.props.name }})
        
        
        Severity: Major
        Found in app/components/TextArea.jsx and 1 other location - About 4 hrs to fix
        app/components/TextField.jsx on lines 55..63

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 116.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

           onChange(e) {
              console.log("[onChange] <<<")
              let object = valueToObject(this.props.name, e.target.value),
                  ce = new CustomEvent('dneslov-update-path', { detail: { value: object, path: this.props.name }})
        
        
        Severity: Major
        Found in app/components/TextField.jsx and 1 other location - About 4 hrs to fix
        app/components/TextArea.jsx on lines 68..76

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 116.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

          Assignment Branch Condition size for included is too high. [49.81/30]
          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

          This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

          Method has too many lines. [33/15]
          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

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          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

            Block has too many lines. [66/25]
            Open

               scope :with_memoes, -> context do
                  language_codes = [ context[:locales] ].flatten
                  cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
            
                  selector = "COALESCE((WITH __memoes AS (
            Severity: Minor
            Found in app/models/event.rb by rubocop

            This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

            Severity
            Category
            Status
            Source
            Language