rehandalal / sort-requirements

A simple script to sort python dependencies in requirement text files.
Mozilla Public License 2.0
17 stars 4 forks source link

handle comments #1

Closed DeoLeung closed 5 years ago

DeoLeung commented 5 years ago

if there are comments, the comment will be in wrong place, maybe keep the comment stick to the next uncomment line

rehandalal commented 5 years ago

thanks for filing the issue. do you have a sample requirements file that you could provide?

DeoLeung commented 5 years ago
b==1.1
# some comment
# continued comment
a==0.3

will expect

# some comment
# continued comment
a==0.3
b==1.1

currently

a==0.3
# some comment
# continued comment
b==1.1

also better to normalize the ('-')

rehandalal commented 5 years ago

Fixed by https://github.com/rehandalal/sort-requirements/commit/3cd56c5fbb5f3abc5a28fdcfab63d916240db952.

Note: This will only pin comments directly above a requirement.

In other words... This will work:

a==0.3
# comment
# more comments
b==1.1

But this will not:

a==0.3
# comment
# more comments

b == 1.1

IMO at that point it becomes difficult to tell if the comment is linked to the line below it

DeoLeung commented 5 years ago

thx it works