openSUSE / obs-service-go_modules

OBS Source Service to download, verify, and vendor Go module dependency sources
GNU General Public License v2.0
19 stars 18 forks source link

fix flake8 errors and add flake8 Github Action #28

Closed johanneskastl closed 1 year ago

johanneskastl commented 1 year ago

Add a GitHub action that lints the go_modules file.

johanneskastl commented 1 year ago

Only errors left:

go_modules:88:63: W605 invalid escape sequence '\.'
go_modules:88:90: W605 invalid escape sequence '\.'
go_modules:88:94: W605 invalid escape sequence '\.'

All from the big regex:

 87     basename = re.sub(                                                                                                                                                                   
 88         "^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",  # noqa: E501                                                                      
 89         r"\g<basename>",                                                                                                                                                                 
 90         archive_name,                                                                                                                                                                    
 91     )
johanneskastl commented 1 year ago

Only errors left:

go_modules:88:63: W605 invalid escape sequence '\.'
go_modules:88:90: W605 invalid escape sequence '\.'
go_modules:88:94: W605 invalid escape sequence '\.'

All from the big regex:

 87     basename = re.sub(                                                                                                                                                                   
 88         "^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",  # noqa: E501                                                                      
 89         r"\g<basename>",                                                                                                                                                                 
 90         archive_name,                                                                                                                                                                    
 91     )

This can be fixed by prepending a r:

-        "^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",  # noqa: E501
+        r"^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",  # noqa: E501
johanneskastl commented 1 year ago

Github Action for flake8 linting is now green :-) https://github.com/johanneskastl/obs-service-go_modules/actions