AlDanial / cloc

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
GNU General Public License v2.0
19.69k stars 1.02k forks source link

Some XML files were missed in the statistics #856

Closed salix2022 closed 1 month ago

salix2022 commented 1 month ago

Bug Description: When using cloc to calculate the code size of XML files, some XML files were missed in the statistics.

cloc; OS; OS version:

cloc version: V2.02 Perl version (if running the cloc source): Unknown OS: Windows OS version: 10 Pro Steps to Reproduce: Command: cloc-2.02 --csv --out=report.csv --by-file C:\source

Expected Result: All of XML files could be correctly counted.

Actual Result: The XML declaration with a space before the last of question mark,this XML file is not included in the statistics.

Additional Context: The issue appears to be related to the writing style of the XML declaration statement on the first line. The code size is recorded correctly when the declaration is written as:

xml -<?xml version="1.0" encoding="Shift_JIS" ?> (before ? has blank) However, the XML file is not included in the statistics when it is written with a space before the last of question mark:

xml -<xml version="1.0" encoding="Shift_JIS"?>(before ? hasn't blank) The presence of a space before the question mark in the declaration statement is non-standard. The standard format should not have a space before the question mark, and the version with a space is incorrect.

It is hoped that when the XML file is written according to standard conventions, the tool will correctly count the code for sizing purposes.

AlDanial commented 1 month ago

XML files begin with <?xml not <xml. Try changing your files to include a question mark after the first <.