ikuseiGmbH/smart-village-app-cms

View on GitHub

Showing 1,158 of 1,254 total issues

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

  $('#nested-restrictions').nestedForm({
    forms: '.nested-restriction-form',
    adder: '#nested-add-restriction',
    ...defaultNestedFormsOptions,
    beforeAddForm: ($container) => {
Severity: Major
Found in app/javascript/partials/_nested_forms.js and 4 other locations - About 1 hr to fix
app/javascript/partials/_nested_forms.js on lines 33..40
app/javascript/partials/_nested_forms.js on lines 42..49
app/javascript/partials/_nested_forms.js on lines 51..58
app/javascript/partials/_nested_forms.js on lines 60..67

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

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

  $('#nested-contacts').nestedForm({
    forms: '.nested-contact-form',
    adder: '#nested-add-contacts',
    ...defaultNestedFormsOptions,
    beforeAddForm: ($container) => {
Severity: Major
Found in app/javascript/partials/_nested_forms.js and 4 other locations - About 1 hr to fix
app/javascript/partials/_nested_forms.js on lines 33..40
app/javascript/partials/_nested_forms.js on lines 42..49
app/javascript/partials/_nested_forms.js on lines 60..67
app/javascript/partials/_nested_forms.js on lines 69..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 59.

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 validate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

formTree.prototype.validate = function(noErrorDisplay) {

  var values = jsonform.getFormValue(this.domRoot);
  var errors = false;

Severity: Minor
Found in lib/jsonform.js - About 1 hr to fix

    Function initLeafletMapTour has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function initLeafletMapTour(id) {
      let center = CENTER_OF_GERMANY;
      let zoom = DEFAULT_ZOOM_LEVEL;
    
      const tourCoordinates = JSON.parse(
    Severity: Minor
    Found in app/javascript/partials/_leaflet_map.js - About 1 hr to fix

      Function initClassicEditor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const initClassicEditor = (htmlEditor, rich = false) => {
        ClassicEditor.create(
          htmlEditor,
          !rich && {
            toolbar: [
      Severity: Minor
      Found in app/javascript/packs/application.js - About 1 hr to fix

        Function updateTabs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              var updateTabs = function (selIdx) {
                var tabs = '';
                var activateFirstTab = false;
                if (selIdx === undefined) {
                  selIdx = $('> .tabbable > .nav-tabs .active', $nodeid).data('idx');
        Severity: Minor
        Found in lib/jsonform.js - About 1 hr to fix

          Function getPreviousNumberOfItems has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          formNode.prototype.getPreviousNumberOfItems = function (values, arrayPath) {
            var key = null;
            var arrayValue = null;
            var childNumbers = null;
            var idx = 0;
          Severity: Minor
          Found in lib/jsonform.js - About 1 hr to fix

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

                'template': '<div>' +
                  '<input type="hidden" name="<%= node.name %>" id="<%= node.id %>" value="<%= value %>" />' +
                  '<div class="dropdown">' +
                  '<a class="btn<% if (buttonClass && node.value) { %> <%= buttonClass %><% } else { %> btn-default<% } %>" data-toggle="dropdown" href="#"<% if (node.value) { %> style="max-width:<%= width %>px;max-height:<%= height %>px"<% } %>>' +
                    '<% if (node.value) { %><img src="<% if (!node.value.match(/^https?:/)) { %><%= prefix %><% } %><%= node.value %><%= suffix %>" alt="" /><% } else { %><%= buttonTitle %><% } %>' +
            Severity: Major
            Found in lib/jsonform.js and 2 other locations - About 1 hr to fix
            lib/jsonform.js on lines 716..729
            lib/jsonform.js on lines 1203..1216

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

            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

                'template': '<fieldset class="tab-container <%= elt.htmlClass?elt.htmlClass:"" %>">' +
                  '<% if (node.legend) { %><legend><%= node.legend %></legend><% } %>' +
                  '<% if (node.formElement.key) { %><input type="hidden" id="<%= node.id %>" name="<%= node.name %>" value="<%= escape(value) %>" /><% } else { %>' +
                    '<a id="<%= node.id %>"></a><% } %>' +
                  '<div class="tabbable">' +
            Severity: Major
            Found in lib/jsonform.js and 2 other locations - About 1 hr to fix
            lib/jsonform.js on lines 644..657
            lib/jsonform.js on lines 716..729

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

            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

                'template': '<div>' +
                  '<input type="hidden" name="<%= node.name %>" id="<%= node.id %>" value="<%= value %>" />' +
                  '<div class="dropdown">' +
                  '<a class="btn<% if (buttonClass && node.value) { %> <%= buttonClass %><% } %>" data-toggle="dropdown" href="#"<% if (node.value) { %> style="max-width:<%= width %>px;max-height:<%= height %>px"<% } %>>' +
                    '<% if (node.value) { %><i class="icon-<%= node.value %>" /><% } else { %><%= buttonTitle %><% } %>' +
            Severity: Major
            Found in lib/jsonform.js and 2 other locations - About 1 hr to fix
            lib/jsonform.js on lines 644..657
            lib/jsonform.js on lines 1203..1216

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

            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

                    !!_.find(keys, function (key) {
                      return (referencedKey.indexOf(key + '.') === 0) ||
                        (referencedKey.indexOf(key + '[]') === 0);
                    });
            Severity: Major
            Found in lib/jsonform-split.js and 1 other location - About 1 hr to fix
            lib/jsonform-split.js on lines 136..139

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

            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

                    !_.find(keys, function (key) {
                      return (referencedKey.indexOf(key + '.') === 0) ||
                        (referencedKey.indexOf(key + '[]') === 0);
                    });
            Severity: Major
            Found in lib/jsonform-split.js and 1 other location - About 1 hr to fix
            lib/jsonform-split.js on lines 109..112

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

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

                  content_block_params.each do |_key, content_block|
                    next if content_block.blank?
            
                    if content_block[:media_contents].present?
                      media_contents = []
            Severity: Major
            Found in app/controllers/jobs_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/news_items_controller.rb on lines 235..252
            app/controllers/offers_controller.rb on lines 186..203

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

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

                  content_block_params.each do |_key, content_block|
                    next if content_block.blank?
            
                    if content_block[:media_contents].present?
                      media_contents = []
            Severity: Major
            Found in app/controllers/news_items_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/jobs_controller.rb on lines 214..231
            app/controllers/offers_controller.rb on lines 186..203

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

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

                  content_block_params.each do |_key, content_block|
                    next if content_block.blank?
            
                    if content_block[:media_contents].present?
                      media_contents = []
            Severity: Major
            Found in app/controllers/offers_controller.rb and 2 other locations - About 1 hr to fix
            app/controllers/jobs_controller.rb on lines 214..231
            app/controllers/news_items_controller.rb on lines 235..252

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

            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

            Complex method ApplicationController#verify_current_user (28.7)
            Open

              def verify_current_user
                return redirect_to log_in_path if session["current_user"].blank?
            
                user_data = {
                  email: session["current_user"]["email"],

            Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

            You can read more about ABC metrics or the flog tool

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

                    var img = (evt.target.nodeName.toLowerCase() === 'img') ?
                      $(evt.target) :
                      $(evt.target).find('img');
            Severity: Major
            Found in lib/jsonform.js and 1 other location - About 1 hr to fix
            lib/jsonform.js on lines 753..755

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

            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

                    var i = (evt.target.nodeName.toLowerCase() === 'i') ?
                      $(evt.target) :
                      $(evt.target).find('i');
            Severity: Major
            Found in lib/jsonform.js and 1 other location - About 1 hr to fix
            lib/jsonform.js on lines 685..687

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

            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 submit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            formTree.prototype.submit = function(evt) {
            
              var stopEvent = function() {
                if (evt) {
                  evt.preventDefault();
            Severity: Minor
            Found in lib/jsonform.js - About 1 hr to fix

              Function resetValues has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              formNode.prototype.resetValues = function () {
                var params = null;
                var idx = 0;
              
                // Reset value
              Severity: Minor
              Found in lib/jsonform.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language