Brunomm/br_nfe

View on GitHub

Showing 28 of 56 total issues

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

    module Product
        module Nfe
            module ItemTax
                class Cofins < BrNfe::ActiveModelBase
                    # CÓDIGO DA SITUAÇÃO TRIBUTÁRIA do COFINS
Severity: Major
Found in lib/br_nfe/product/nfe/item_tax/cofins.rb and 1 other location - About 1 day to fix
lib/br_nfe/product/nfe/item_tax/pis.rb on lines 2..133

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

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

    module Product
        module Nfe
            module ItemTax
                class Pis < BrNfe::ActiveModelBase
                    # CÓDIGO DA SITUAÇÃO TRIBUTÁRIA do PIS
Severity: Major
Found in lib/br_nfe/product/nfe/item_tax/pis.rb and 1 other location - About 1 day to fix
lib/br_nfe/product/nfe/item_tax/cofins.rb on lines 2..133

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

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

    module Product
        module Nfe
            module ItemTax
                class PisSt < BrNfe::ActiveModelBase
                    # VALOR DA BASE DE CÁLCULO DO PIS ST
Severity: Major
Found in lib/br_nfe/product/nfe/item_tax/pis_st.rb and 1 other location - About 2 hrs to fix
lib/br_nfe/product/nfe/item_tax/cofins_st.rb on lines 2..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 81.

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

    module Product
        module Nfe
            module ItemTax
                class CofinsSt < BrNfe::ActiveModelBase
                    # VALOR DA BASE DE CÁLCULO DO COFINS ST
Severity: Major
Found in lib/br_nfe/product/nfe/item_tax/cofins_st.rb and 1 other location - About 2 hrs to fix
lib/br_nfe/product/nfe/item_tax/pis_st.rb on lines 2..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 81.

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 set_pis
                        @item.pis do |pis|
                            pis.codigo_cst         = @xml.css( @path[:pis][:codigo_cst]        ).text
                            pis.total_base_calculo = @xml.css( @path[:pis][:total_base_calculo]).text.to_f
                            pis.aliquota           = @xml.css( @path[:pis][:aliquota]          ).text.to_f
Severity: Major
Found in lib/br_nfe/product/reader/item.rb and 1 other location - About 1 hr to fix
lib/br_nfe/product/reader/item.rb on lines 124..131

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

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 set_cofins
                        @item.cofins do |cofins|
                            cofins.codigo_cst         = @xml.css( @path[:cofins][:codigo_cst]        ).text
                            cofins.total_base_calculo = @xml.css( @path[:cofins][:total_base_calculo]).text.to_f
                            cofins.aliquota           = @xml.css( @path[:cofins][:aliquota]          ).text.to_f
Severity: Major
Found in lib/br_nfe/product/reader/item.rb and 1 other location - About 1 hr to fix
lib/br_nfe/product/reader/item.rb on lines 114..121

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

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

    module Service
        module Thema
            module V1
                class ConsultaNfsPorRps < BrNfe::Service::Thema::V1::Base
                    include BrNfe::Service::Concerns::Rules::ConsultaNfsPorRps
Severity: Major
Found in lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb and 1 other location - About 1 hr to fix
lib/br_nfe/service/thema/v1/consulta_nfse.rb on lines 2..43

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

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

    module Service
        module Thema
            module V1
                class ConsultaNfse < BrNfe::Service::Thema::V1::Base
                    include BrNfe::Service::Concerns::Rules::ConsultaNfse
Severity: Major
Found in lib/br_nfe/service/thema/v1/consulta_nfse.rb and 1 other location - About 1 hr to fix
lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb on lines 2..50

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

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

    module Service
        module Betha
            module V1
                class ConsultaNfse < BrNfe::Service::Betha::V1::Gateway
                    include BrNfe::Service::Concerns::Rules::ConsultaNfse
Severity: Major
Found in lib/br_nfe/service/betha/v1/consulta_nfse.rb and 1 other location - About 1 hr to fix
lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb on lines 2..34

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

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

    module Service
        module Betha
            module V1
                class ConsultaNfsPorRps < BrNfe::Service::Betha::V1::Gateway
                    include BrNfe::Service::Concerns::Rules::ConsultaNfsPorRps
Severity: Major
Found in lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb and 1 other location - About 1 hr to fix
lib/br_nfe/service/betha/v1/consulta_nfse.rb on lines 2..35

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

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 set_pis_st
                        @item.pis_st do |pis|
                            pis.total_base_calculo = @xml.css( @path[:pis_st][:total_base_calculo]).text.to_f
                            pis.aliquota           = @xml.css( @path[:pis_st][:aliquota]          ).text.to_f
                            pis.total              = @xml.css( @path[:pis_st][:total]             ).text.to_f
Severity: Major
Found in lib/br_nfe/product/reader/item.rb and 1 other location - About 1 hr to fix
lib/br_nfe/product/reader/item.rb on lines 202..208

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

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 set_cofins_st
                        @item.cofins_st do |pis|
                            pis.total_base_calculo = @xml.css( @path[:cofins_st][:total_base_calculo]).text.to_f
                            pis.aliquota           = @xml.css( @path[:cofins_st][:aliquota]          ).text.to_f
                            pis.total              = @xml.css( @path[:cofins_st][:total]             ).text.to_f
Severity: Major
Found in lib/br_nfe/product/reader/item.rb and 1 other location - About 1 hr to fix
lib/br_nfe/product/reader/item.rb on lines 192..198

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

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

    module Association
        module HaveCondicaoPagamento
            def condicao_pagamento
                yield(condicao_pagamento || new_condicao_pagamento) if block_given?
                @condicao_pagamento.is_a?(BrNfe.condicao_pagamento_class) ? @condicao_pagamento : nil
Severity: Major
Found in lib/br_nfe/association/have_condicao_pagamento.rb and 1 other location - About 1 hr to fix
lib/br_nfe/service/association/have_intermediario.rb on lines 3..21

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

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

        module Association
            module HaveIntermediario
                def intermediario
                    yield(intermediario || new_intermediario) if block_given?
                    @intermediario.is_a?(BrNfe.intermediario_service_class) ? @intermediario : nil
Severity: Major
Found in lib/br_nfe/service/association/have_intermediario.rb and 1 other location - About 1 hr to fix
lib/br_nfe/association/have_condicao_pagamento.rb on lines 2..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 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

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

    module Service
        module Response
            module Build
                class ConsultaLoteRps  < BrNfe::Service::Response::Build::InvoiceBuild
                    def default_values
Severity: Minor
Found in lib/br_nfe/service/response/build/consulta_lote_rps.rb and 1 other location - About 55 mins to fix
lib/br_nfe/service/response/build/consulta_nfse.rb on lines 3..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 45.

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

    module Service
        module Response
            module Build
                class ConsultaNfse  < BrNfe::Service::Response::Build::InvoiceBuild
                    def default_values
Severity: Minor
Found in lib/br_nfe/service/response/build/consulta_nfse.rb and 1 other location - About 55 mins to fix
lib/br_nfe/service/response/build/consulta_lote_rps.rb on lines 3..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 45.

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 build_endereco_entrega!
                    if @xml_nfe.css(path[:endereco_entrega][:root]).present?
                        @invoice.endereco_entrega_cpf_cnpj = @xml_nfe.css(path[:endereco_entrega][:cnpj]).text
                        @invoice.endereco_entrega_cpf_cnpj = @xml_nfe.css(path[:endereco_entrega][:cpf]).text unless @invoice.endereco_entrega_cpf_cnpj.present?
                        @invoice.endereco_entrega = EnderecoRetiradaEntrega.new(@xml_nfe, path[:endereco_entrega])
Severity: Minor
Found in lib/br_nfe/product/reader/nfe.rb and 1 other location - About 55 mins to fix
lib/br_nfe/product/reader/nfe.rb on lines 127..131

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 build_endereco_retirada!
                    if @xml_nfe.css(path[:endereco_retirada][:root]).present?
                        @invoice.endereco_retirada_cpf_cnpj = @xml_nfe.css(path[:endereco_retirada][:cnpj]).text
                        @invoice.endereco_retirada_cpf_cnpj = @xml_nfe.css(path[:endereco_retirada][:cpf]).text unless @invoice.endereco_retirada_cpf_cnpj.present?
                        @invoice.endereco_retirada = EnderecoRetiradaEntrega.new(@xml_nfe, path[:endereco_retirada])
Severity: Minor
Found in lib/br_nfe/product/reader/nfe.rb and 1 other location - About 55 mins to fix
lib/br_nfe/product/reader/nfe.rb on lines 135..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 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

    module Association
        module HaveEmitente
            
            def emitente
                yield emitente if block_given?
Severity: Minor
Found in lib/br_nfe/association/have_emitente.rb and 1 other location - About 50 mins to fix
lib/br_nfe/association/have_destinatario.rb on lines 2..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 42.

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

    module Association
        module HaveDestinatario
            def destinatario
                yield(destinatario) if block_given?
                @destinatario.is_a?(destinatario_class) ? @destinatario : @destinatario = destinatario_class.new()
Severity: Minor
Found in lib/br_nfe/association/have_destinatario.rb and 1 other location - About 50 mins to fix
lib/br_nfe/association/have_emitente.rb on lines 2..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 42.

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