seocahill/taxonomy-parser

View on GitHub

Showing 12 of 12 total issues

Method registered has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.registered(app)
      app.get '/discoverable-taxonomy-sets' do
        content_type :api_json
        ApplicationController.discoverable_taxonomy_sets
      end
Severity: Major
Found in routes.rb - About 2 hrs to fix

    Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initialize(id, discoverable_taxonomy_set_id, name, item_type, substitution_group, period_type, abstract, nillable)
    Severity: Major
    Found in lib/models/element.rb - About 1 hr to fix

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

            def process_linkbase(parsed_file)
              parsed_file.search('referenceLink').each do |link|
                nodes = {}
                link.search('referenceArc', 'reference').each do |node|
                  if node.name == 'referenceArc'
      Severity: Minor
      Found in lib/parsers/reference_parser.rb and 1 other location - About 55 mins to fix
      lib/parsers/label_parser.rb on lines 16..24

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

      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

            def process_linkbase(parsed_file)
              parsed_file.search('labelLink').each do |link|
                nodes = {}
                link.search('labelArc', 'label', ).each do |node|
                  if node.name == 'labelArc'
      Severity: Minor
      Found in lib/parsers/label_parser.rb and 1 other location - About 55 mins to fix
      lib/parsers/reference_parser.rb on lines 15..23

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

      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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def initialize(id, discoverable_taxonomy_set_id, definition, role_uri, network)
      Severity: Minor
      Found in lib/models/role_type.rb - About 35 mins to fix

        Method find_domain_members has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def find_domain_members(domains)
                return [] unless domains
                arcrole = "http://xbrl.org/int/dim/arcrole/domain-member"
                domains.flat_map do |domain|
                  children = @def_index[arcrole][:from][domain.element_id]
        Severity: Minor
        Found in lib/parsers/dimension_parser.rb - About 35 mins 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

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

              def parse(current_dts)
                @id = 1
                @bucket = Store.instance.data[:references] = {}
                Dir.glob(File.join(__dir__, "/../../dts_assets/#{current_dts.name}/**/*.xml")).grep(/reference/) do |file|
                  linkbase = Nokogiri::XML(File.open(file))
        Severity: Minor
        Found in lib/parsers/reference_parser.rb and 1 other location - About 35 mins to fix
        lib/parsers/label_parser.rb on lines 6..12

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

        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

              def parse(current_dts)
                @id = 1
                @bucket = Store.instance.data[:labels] = {}
                
                Dir.glob(File.join(__dir__, "/../../dts_assets/#{current_dts.name}/**/*.xml")).grep(/label/) do |file|
        Severity: Minor
        Found in lib/parsers/label_parser.rb and 1 other location - About 35 mins to fix
        lib/parsers/reference_parser.rb on lines 6..11

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

        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

              def parse_and_store_elements
                files = File.join(__dir__, "/../../dts_assets/#{@current_dts.name}/**/*.xsd")
        
                Dir.glob(files).grep_v(/(full|main|minimum)/) do |file|
                  parsed_nodes = Nokogiri::XML(File.open(file)).search("element")
        Severity: Minor
        Found in lib/parsers/element_parser.rb and 1 other location - About 30 mins to fix
        lib/parsers/role_type_parser.rb on lines 14..20

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

        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

              def parse_and_store_role_type_nodes
                files = File.join(__dir__, "/../../dts_assets/#{@current_dts.name}/**/*.xsd")
        
                Dir.glob(files).grep_v(/(full|main|minimum)/) do |file|
                  role_type_nodes = Nokogiri::XML(File.open(file)).search("link|roleType")
        Severity: Minor
        Found in lib/parsers/role_type_parser.rb and 1 other location - About 30 mins to fix
        lib/parsers/element_parser.rb on lines 14..20

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

        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

              def role_types(params)
                role_types = Store.instance.data[:role_types].values_at(*params["filter"]["id"].split(',').map(&:to_i))
                JSONAPI::Serializer.serialize(role_types, is_collection: true).to_json
        Severity: Minor
        Found in lib/application_controller.rb and 1 other location - About 20 mins to fix
        lib/application_controller.rb on lines 73..75

        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

              def dimension_nodes(params)
                dimension_nodes = Store.instance.data[:dimension_nodes].values_at(*params["filter"]["id"].split(',').map(&:to_i))
                JSONAPI::Serializer.serialize(dimension_nodes, is_collection: true).to_json
        Severity: Minor
        Found in lib/application_controller.rb and 1 other location - About 20 mins to fix
        lib/application_controller.rb on lines 16..18

        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

        Severity
        Category
        Status
        Source
        Language