solpp icon indicating copy to clipboard operation
solpp copied to clipboard

SPDX-License-Identifier moved to second line

Open 0xalfalfa opened this issue 2 years ago • 1 comments

If I have

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
...

in my input file, the output file will start with

pragma solidity ^0.8.13;

// SPDX-License-Identifier: UNLICENSED
...

and the solidity compiler will warn:

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.

The "SPDX-License-Identifier" line, and probably any comment lines, should stay at the top of the source code.

0xalfalfa avatar Apr 21 '22 07:04 0xalfalfa

This also causes problems to solidity-coverage.

Weirdly enough, you will get 4 extra empty lines at the top of the source, and all its inline indicators of coverage offsetted by -4 lines, making it almost impossible to understand.

ddnexus avatar Sep 12 '22 01:09 ddnexus