View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000109||file||[All Projects] General||public||2019-09-27 12:10||2019-09-27 12:10|
|Platform||Linux||OS||Arch Linux||OS Version|
|Target Version||Fixed in Version|
|Summary||0000109: reStructuredText with embedded code detected as Python script|
|Description||We're documenting our Python project with reStructuredText files. These contain various snippets of Python code which serve as examples. I've attached a simple document showing this.|
When run on this document, file picks up on the embedded code and detects it as a Python script:
$ file -v
magic file from /usr/share/file/misc/magic
$ file document.rst
document.rst: Python script, ASCII text executable
$ file -b --mime-type document.rst
The particular use-case where we ran into this was in a Git hook which runs a code formatting tool to reject any Python code which doesn't meet the project coding style. It was using file to only run the checker on Python files. For the time being we've changed this to a simple file extension test.
Note that it doesn't happen on every document, just those with enough magic matches to get the strength high enough. On documents which don't meet the threshold it reports "ASCII text text/plain". Ideally, it would report this in all cases.
|Tags||No tags attached.|