Brunomm/br_nfe

View on GitHub

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

Class Base has 49 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base < BrNfe::ActiveModelBase
        include BrNfe::Association::HaveEmitente

        attr_accessor :certificate_pkcs12_password
        attr_accessor :certificate_pkcs12_path
Severity: Minor
Found in lib/br_nfe/base.rb - About 6 hrs to fix

    File nota_fiscal.rb has 375 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module BrNfe
        module Product
            class NotaFiscal  < BrNfe::ActiveModelBase
                # include BrNfe::Association::HaveCondicaoPagamento
    
    
    Severity: Minor
    Found in lib/br_nfe/product/nota_fiscal.rb - About 5 hrs to fix

      File br_nfe.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'br_nfe/version'
      require 'active_model'
      require 'active_support/core_ext/class'
      require 'active_support/core_ext/enumerable'
      require 'active_support/core_ext/object'
      Severity: Minor
      Found in lib/br_nfe.rb - About 3 hrs to fix

        File invoice_build.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module BrNfe
            module Service
                module Response
                    module Build
                        class InvoiceBuild  < BrNfe::Service::Response::Build::Base
        Severity: Minor
        Found in lib/br_nfe/service/response/build/invoice_build.rb - About 3 hrs to fix

          Class Base has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

                          class Base < BrNfe::ActiveModelBase
                              attr_accessor :savon_response
                              attr_accessor :operation
          
                              def original_xml
          Severity: Minor
          Found in lib/br_nfe/product/response/build/base.rb - About 3 hrs to fix

            Class Base has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

                        class Base < BrNfe::Base
                            include NfXmlValue
            
                            # Versão da NF-e que irá pegar as configurações
                            attr_accessor :nfe_version
            Severity: Minor
            Found in lib/br_nfe/product/operation/base.rb - About 3 hrs to fix

              Method default_values has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                                      def default_values
                                          super.merge({
                                              # invoices_path:                                       response_invoices_path,
                                              invoice_numero_nf_path:                              response_invoice_numero_nf_path,
                                              invoice_codigo_verificacao_path:                     response_invoice_codigo_verificacao_path,
              Severity: Major
              Found in lib/br_nfe/service/response/build/invoice_build.rb - About 2 hrs to fix

                Class NotaFiscal has 23 methods (exceeds 20 allowed). Consider refactoring.
                Open

                        class NotaFiscal  < BrNfe::ActiveModelBase
                            # include BrNfe::Association::HaveCondicaoPagamento
                
                            # Identificação do emitente da NF-e
                            # Versão do XML
                Severity: Minor
                Found in lib/br_nfe/product/nota_fiscal.rb - About 2 hrs to fix

                  Method has_one has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                                  def has_one attr_name, class_name, *args
                                      options = {null: true, inverse_of: :reference}.merge(args.extract_options!)
                  
                                      define_method attr_name do |&block|
                                          block.call(send("#{attr_name}_force_instance")) if block
                  Severity: Minor
                  Found in lib/br_nfe/active_model/has_one.rb - About 2 hrs to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language