rpm-software-management / spec-cleaner

spec-cleaner
BSD 3-Clause "New" or "Revised" License
28 stars 34 forks source link

Whitespace newline added in conditional as reported on opensuse-factory ml #176

Closed scarabeusiv closed 7 years ago

scarabeusiv commented 7 years ago

The reason is the class detection gets triggered too late after the condition start and it puts newline to the top.

class: '<class 'spec_cleaner.rpmdescription.RpmDescription'>' line: '%description' class: 'None' line: 'The 802.11 regulatory domain database is used by CRDA and provides' class: 'None' line: 'allowed frequency ranges for 802.11 wireless drivers.' class: 'None' line: '' class: 'None' line: '%if 0%{?suse_version} == 1110' class: 'None' line: '# _libexecdir points to /usr/lib64 for SLE11' class: '<class 'spec_cleaner.rpmpreamble.RpmPreamble'>' line: '%define _libexecdir %{_prefix}/lib' class: '<class 'spec_cleaner.rpmsection.Section'>' line: '%endif' class: 'None' line: '' class: '<class 'spec_cleaner.rpmprep.RpmPrep'>' line: '%prep'

scarabeusiv commented 7 years ago

Well I found one more case where it breaks.

It seems we need to detect the comments before section and glue them to it while providing the newline above them.

Also we must make sure we are not doing this for codeblock.

scarabeusiv commented 7 years ago

Well most of the cases are covered, so lets leave this as closed unless someone finds more breakages.