znamenica/dneslov

View on GitHub

Showing 2,171 of 2,171 total issues

Class has too many lines. [129/100]
Open

class Subject < ActiveRecord::Base
   extend TotalSize
   include WithDescriptions
   include WithLinks

Severity: Minor
Found in app/models/subject.rb by rubocop

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

Class has too many lines. [120/100]
Open

class Name < ActiveRecord::Base
   extend TotalSize
   include Languageble
   include WithDescriptions
   include WithLinks
Severity: Minor
Found in app/models/name.rb by rubocop

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

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

export function makeDescription(value, locales, source = 'descriptions', filter = null) {
   let descriptions = locales.map((locale) => {
      return value[source].reduce((res, text) => {
         return res ||
            locale === text.language_code &&
Severity: Major
Found in app/components/makers.jsx and 2 other locations - About 1 day to fix
app/components/makers.jsx on lines 3..20
app/components/makers.jsx on lines 22..39

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 222.

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 3 locations. Consider refactoring.
Open

export function makeTweet(value, locales, source = 'tweets', filter = null) {
   let tweets = locales.map((locale) => {
      return value[source].reduce((res, text) => {
         return res ||
            locale === text.language_code &&
Severity: Major
Found in app/components/makers.jsx and 2 other locations - About 1 day to fix
app/components/makers.jsx on lines 22..39
app/components/makers.jsx on lines 88..105

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 222.

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 3 locations. 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: Major
Found in app/components/makers.jsx and 2 other locations - About 1 day to fix
app/components/makers.jsx on lines 3..20
app/components/makers.jsx on lines 88..105

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 222.

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

Method has too many lines. [78/15]
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: Minor
Found in app/models/concerns/with_titles.rb by rubocop

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 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

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

       static propTypes = {
          happened_at: PropTypes.string.isRequired,
          defaultCalendarySlug: PropTypes.string,
          specifiedCalendarySlug: PropTypes.string,
          memory: PropTypes.object.isRequired,
    Severity: Major
    Found in app/components/Eventee.jsx and 1 other location - About 7 hrs to fix
    app/components/Picture.jsx on lines 36..55

    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 191.

    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 propTypes = {
          happened_at: PropTypes.string.isRequired,
          defaultCalendarySlug: PropTypes.string,
          specifiedCalendarySlug: PropTypes.string,
          memory: PropTypes.object.isRequired,
    Severity: Major
    Found in app/components/Picture.jsx and 1 other location - About 7 hrs to fix
    app/components/Eventee.jsx on lines 35..54

    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 191.

    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

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

       scope :with_events, -> context do
          as = table.table_alias || table.name
          language_codes = [context[:locales]].flatten
          alphabeth_codes = Languageble.alphabeth_list_for( language_codes ).flatten
          selector = self.select_values.dup
    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.

    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

      Method has too many lines. [60/15]
      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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

      export function makeTitle(value, locales, source = 'titles', filter = null) {
         let titles = locales.map((locale) => {
            return value[source].reduce((res, text) => {
               return res ||
                  locale === text.language_code &&
      Severity: Major
      Found in app/components/makers.jsx and 1 other location - About 6 hrs to fix
      app/components/makers.jsx on lines 41..54

      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 169.

      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 makeName(value, locales, source = 'names', filter = null) {
         let names = locales.map((locale) => {
            return value[source].reduce((res, text) => {
               return res ||
                  locale === text.language_code &&
      Severity: Major
      Found in app/components/makers.jsx and 1 other location - About 6 hrs to fix
      app/components/makers.jsx on lines 57..70

      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 169.

      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 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

        Assignment Branch Condition size for included is too high. [71.87/30]
        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: Minor
        Found in app/models/concerns/with_titles.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

        Method has too many lines. [54/15]
        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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

           scope :with_names, -> (context) do
              language_codes = [context[:locales]].flatten
        =begin
        with recursive t(level,path,id,name_id,bind_kind_name,bond_to_id,root_id,name_alphabeth_code,name_language_code,name_text,state_code,mode,feasible) as (
                with recursive tt(level,path,id,name_id,bind_kind_name,bond_to_id,root_id,name_alphabeth_code,name_language_code,name_text,state_code,mode,feasible) as (SELECT 0,nm.text,n.id,n.name_id,n.bind_kind_name,n.bond_to_id,n.root_id,nm.alphabeth_code,nm.language_code,nm.text,mn.state_code,mn.mode,mn.feasible FROM nomina n JOIN names nm ON nm.id = n.name_id JOIN memory_names mn ON mn.nomen_id = n.id WHERE  mn.memory_id = 2989 UNION SELECT level + 1, path || ' > ' || nm.text, n.id,n.name_id,n.bind_kind_name,n.bond_to_id,n.root_id,nm.alphabeth_code,nm.language_code,nm.text,tt.state_code,tt.mode,tt.feasible FROM nomina n JOIN tt ON n.root_id = tt.root_id AND  tt.bond_to_id = n.name_id JOIN names nm ON nm.id = n.name_id JOIN names nm_t ON nm_t.id = tt.name_id AND nm_t.language_code <> nm.language_code LEFT OUTER JOIN memory_names mn ON n.root_id = mn.nomen_id AND mn.memory_id = 2989 ) select * from tt
        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.

        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

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

        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.

        Severity
        Category
        Status
        Source
        Language