ikuseiGmbH/smart-village-app-converter-xml2json

View on GitHub
app/models/record/event_record.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method parse_media_content has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_media_content(event)
    image_data = []

    if event.at_xpath("IMAGELINK_XL").try(:text).present?
      image_data << {
Severity: Minor
Found in app/models/record/event_record.rb - About 1 hr to fix

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

      def load_xml_data
        url = Rails.application.credentials.event_source[:url]
        pem = Rails.application.credentials.tmb_auth[:pem]
        password = Rails.application.credentials.tmb_auth[:password]
        result = ApiRequestService.new(url).get_request(false, pem, password)
    Severity: Major
    Found in app/models/record/event_record.rb and 1 other location - About 1 hr to fix
    app/models/record/poi_record.rb on lines 9..19

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

    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

        {
          phone: event.at_xpath("E_LOC_TEL").try(:text),
          fax: event.at_xpath("E_LOC_FAX").try(:text),
          email: event.at_xpath("E_LOC_EMAIL").try(:text),
          web_urls: [
    Severity: Minor
    Found in app/models/record/event_record.rb and 1 other location - About 20 mins to fix
    app/models/record/event_record.rb on lines 156..165

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

    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

          contact: {
            phone: event.at_xpath("E_KONTAKT_TEL").try(:text),
            fax: event.at_xpath("E_KONTAKT_FAX").try(:text),
            email: event.at_xpath("E_KONTAKT_EMAIL").try(:text),
            web_urls: [
    Severity: Minor
    Found in app/models/record/event_record.rb and 1 other location - About 20 mins to fix
    app/models/record/event_record.rb on lines 132..141

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

    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

        if event.at_xpath("IMAGELINK_3_XL").try(:text).present?
          image_data << {
            content_type: "image",
            source_url: {
              url: event.at_xpath("IMAGELINK_3_XL").try(:text)
    Severity: Minor
    Found in app/models/record/event_record.rb and 2 other locations - About 15 mins to fix
    app/models/record/event_record.rb on lines 180..186
    app/models/record/event_record.rb on lines 190..196

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

    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

        if event.at_xpath("IMAGELINK_XL").try(:text).present?
          image_data << {
            content_type: "image",
            source_url: {
              url: event.at_xpath("IMAGELINK_XL").try(:text)
    Severity: Minor
    Found in app/models/record/event_record.rb and 2 other locations - About 15 mins to fix
    app/models/record/event_record.rb on lines 190..196
    app/models/record/event_record.rb on lines 200..206

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

    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

        if event.at_xpath("IMAGELINK_2_XL").try(:text).present?
          image_data << {
            content_type: "image",
            source_url: {
              url: event.at_xpath("IMAGELINK_2_XL").try(:text)
    Severity: Minor
    Found in app/models/record/event_record.rb and 2 other locations - About 15 mins to fix
    app/models/record/event_record.rb on lines 180..186
    app/models/record/event_record.rb on lines 200..206

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

    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

          address: {
            addition: event.at_xpath("E_KONTAKT_NAME").try(:text),
            street: event.at_xpath("E_KONTAKT_STRASSE").try(:text),
            zip: event.at_xpath("E_KONTAKT_PLZ").try(:text),
            city: event.at_xpath("E_KONTAKT_ORT").try(:text)
    Severity: Minor
    Found in app/models/record/event_record.rb and 2 other locations - About 15 mins to fix
    app/models/record/event_record.rb on lines 117..122
    app/models/record/poi_record.rb on lines 301..306

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

    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

        return_value = {
          addition: event.at_xpath("E_LOC_NAME").try(:text),
          street: event.at_xpath("E_LOC_STRASSE").try(:text),
          zip: event.at_xpath("E_LOC_PLZ").try(:text),
          city: event.at_xpath("E_LOC_ORT").try(:text)
    Severity: Minor
    Found in app/models/record/event_record.rb and 2 other locations - About 15 mins to fix
    app/models/record/event_record.rb on lines 150..155
    app/models/record/poi_record.rb on lines 301..306

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

    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

    There are no issues that match your filters.

    Category
    Status