znamenica/dneslov

View on GitHub

Showing 2,171 of 2,171 total issues

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

            language_code: {
               kind: 'dynamic',
               title: 'Язык',
               display_scheme: '12-4-2-2',
               pathname: 'short_subjects',
Severity: Major
Found in app/components/memoryMeta.jsx and 2 other locations - About 3 hrs to fix
app/components/calendaryMeta.jsx on lines 282..298
app/components/memoryMeta.jsx on lines 356..372

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

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

            alphabeth_code: {
               kind: 'dynamic',
               title: 'Азбука',
               display_scheme: '12-4-2-2',
               pathname: 'short_subjects',
Severity: Major
Found in app/components/calendaryMeta.jsx and 2 other locations - About 3 hrs to fix
app/components/memoryMeta.jsx on lines 339..355
app/components/memoryMeta.jsx on lines 356..372

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

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

            alphabeth_code: {
               kind: 'dynamic',
               title: 'Азбука',
               display_scheme: '12-4-2-2',
               pathname: 'short_subjects',
Severity: Major
Found in app/components/memoryMeta.jsx and 2 other locations - About 3 hrs to fix
app/components/calendaryMeta.jsx on lines 282..298
app/components/memoryMeta.jsx on lines 339..355

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

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

       params = Object.entries(query).reduce((line, [key, value]) => {
         console.log("[getUrlsFrom] *", "key:", key, "value:", value, "query:", line)
         if (value && value.length > 0) {
            let part = key + "=" + encodeURIComponent(value)
            return line && line + "&" + part || part
Severity: Major
Found in app/components/support.jsx and 1 other location - About 2 hrs to fix
app/components/support.jsx on lines 71..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 94.

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

       params = Object.entries(state.query).reduce((line, [key, value]) => {
         console.log("[getPathsFromState] *", "key:", key, "value:", value, "query:", line)
         if (value && value.length > 0) {
            let part = key + "=" + encodeURIComponent(value)
            return line && line + "&" + part || part
Severity: Major
Found in app/components/support.jsx and 1 other location - About 2 hrs to fix
app/components/support.jsx on lines 101..109

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

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. [25/15]
Open

   def self.included base
      base.class_eval do
         scope :with_locale_names, -> context do
            join_name = table.table_alias || table.name
            language_codes = [ context[:locales] ].flatten

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.

Cyclomatic complexity for fix_year_date is too high. [16/6]
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 cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [25/15]
Open

   def fastday_generate
      memoes = []

      MAP.each do |scheme|
         event = Event.where(memory_id: Slug.where(text: scheme.slug).first.sluggable.id,
Severity: Minor
Found in app/services/memo_service.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.

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

      slug: {
         kind: 'block',
         meta: {
            id: {
               kind: 'hidden',
Severity: Major
Found in app/components/memoryMeta.jsx and 2 other locations - About 2 hrs to fix
app/components/calendaryMeta.jsx on lines 45..65
app/components/orderMeta.jsx on lines 44..64

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

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

      slug: {
         kind: 'block',
         meta: {
            id: {
               kind: 'hidden',
Severity: Major
Found in app/components/calendaryMeta.jsx and 2 other locations - About 2 hrs to fix
app/components/memoryMeta.jsx on lines 46..66
app/components/orderMeta.jsx on lines 44..64

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

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

      slug: {
         kind: 'block',
         meta: {
            id: {
               kind: 'hidden',
Severity: Major
Found in app/components/orderMeta.jsx and 2 other locations - About 2 hrs to fix
app/components/calendaryMeta.jsx on lines 45..65
app/components/memoryMeta.jsx on lines 46..66

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

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

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

       scope :with_memoried_memoes, -> 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/scriptum.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

    Number.prototype.populateDownTo = function(number) {
       let count = number - self,
           array = new Array()
    
       if (count < 0) {
    Severity: Major
    Found in app/assets/javascripts/ext.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/ext.js on lines 18..29

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

    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

    Number.prototype.populateTo = function(number) {
       let count = number - self,
           array = new Array()
    
       if (count > 0) {
    Severity: Major
    Found in app/assets/javascripts/ext.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/ext.js on lines 5..16

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

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

        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
          Severity
          Category
          Status
          Source
          Language