4 - Remove NFC-e Prawn renderer, now unused by facil123 - #281
Open
pnzrfst wants to merge 3 commits into
Open
Conversation
facil123's ThermoPrinter migration (facil123 #23233, PRs #23279/#23319) moved
all NFC-e DANFE generation off this gem, and its two remaining call sites
already migrated to BrDanfe::Helper.address (added in the prior release).
Nothing in the org references DanfeLib::Nfce, NfceLib::*, or Helper.nfe?'s
dispatch branch anymore, so this deletes the whole Prawn NFC-e renderer,
its specs, and its fixtures.
Helper.nfe? is kept: it's also used as a guard inside DanfeLib::Nfe#generate,
unrelated to the NFC-e dispatch being removed here.
Adds an explicit `require 'bigdecimal'` to lib/br_danfe.rb: NfeLib::Infadic
uses BigDecimal but never required it itself — it only worked because the
now-deleted nfce_lib/total_list.rb happened to require it as a side effect
of this gem's blanket `Dir[...].each { require }` loader.
Closes #279
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Aug 18, 2026
…-danfe' into remove-nfce-pdf-renderer-contract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR empilhado
Parte contract do expand/contract iniciado em #280. Base deste PR é a branch de #280 — depois que #280 mergear, a base passa a ser
master.Contexto
Fecha #279. facil123 unificou toda a geração de DANFE de NFC-e no ThermoPrinter (facil123 #23233, PRs #23279/#23319) e seus dois últimos call sites que dependiam desta gem (
ThermoPrinter::Print::Nfce::HeadereFiscalInfo) já migraram paraBrDanfe::Helper.address(adicionado em #280). Não sobra nenhum consumidor deDanfeLib::Nfce,NfceLib::*ou do branch de dispatch NFC-e emDanfe.create_danfe.Pré-condição para merge: só faz sentido mergear isso depois que #280 estiver mergeado E facil123 tiver de fato trocado os dois call sites para
BrDanfe::Helper.address(confirmar via busca porNfceLibno facil123 antes de mergear).O que muda
lib/br_danfe/danfe_lib/nfce.rbelib/br_danfe/danfe_lib/nfce_lib/(todos os 9 arquivos, incluindohelper.rb— já redundante, sua função vive emBrDanfe::Helper.addressdesde 3 - Add BrDanfe::Helper.address ahead of NFC-e renderer removal #280) — removidos.lib/br_danfe/danfe.rb#create_danfe— sempre retornaDanfeLib::Nfe.new(xmls), sem branch por tipo de documento.spec/br_danfe/danfe_lib/nfce*,spec/fixtures/nfce/) — removidos.lib/br_danfe/version.rb— bump2.2.0→3.0.0(major — remove API pública:DanfeLib::Nfce,NfceLib::*).O que NÃO muda
BrDanfe::Helper.nfe?— mantido. Diferente do que a issue Remover código de PDF de NFC-e da gem (sem consumidor após #23233) #279 original presumia, esse método tem um segundo chamador não relacionado ao dispatch: um guard dentro deDanfeLib::Nfe#generate(nfe.rb:31) que interrompe o processamento de um lote de XMLs se um deles não for NF-e. Confirmado rodando a suite completa com o método removido: 23 falhas em specs de NF-e.DanfeLib::Nfe,DanfeLib::Base,BrDanfe::Cce,BrDanfe::Mdfe,BrDanfe::QrCode,BrDanfe::XML— inalterados.Achado extra: dependência oculta de
bigdecimalNfeLib::Infadic(código NF-e, não tocado pela issue) usaBigDecimal(...)sem nunca ter feitorequire 'bigdecimal'. Isso só funcionava porque onfce_lib/total_list.rb, agora removido, tinha umrequire 'bigdecimal'que — por causa do loader desta gem (Dir[...].each { require }, que é global independente de onde a linha está) — carregavabigdecimalpara a gem inteira como efeito colateral.Verifiquei isolando a causa: na
masteratual, sem nenhuma outra mudança, remover sónfce_lib/total_list.rbjá reproduz 8 falhas eminfadic_spec.rbcomNoMethodError: undefined method 'BigDecimal'. Este PR adicionarequire 'bigdecimal'emlib/br_danfe.rbpara não deixar essa regressão vazar para quem depender deste release.Testes
bundle exec rspec: 261 examples, 0 failuresbundle exec rubocop: sem ofensasgrep -rn "Nfce\|NfceLib"no repo inteiro: zero ocorrências🤖 Generated with Claude Code