You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Advanced usage question: How to call the pycodestyle with custom rule in the external file #917
I try to write a wrapper to call the pycodestyle with the rule in the wrapper file.
My rule/wrapper looks like.
importpycodestyledef_main(**kwargs)
@pycodestyle.register_checkdefimage_lines(logical_line):
r"""Find the line starting from the - FROM - image: directives. I801: def a():\n pass\na() I802: def b():\n pass\na() """#noqaiflogical_line.startswith('FROM'):
yield0, "I801 found the FROM directive"eliflogical_line.startswith('image:'):
yield0, "I802 found the image directive"style=pycodestyle.StyleGuide(filename=['Dockerfile', 'docker-compose.yml'], select=['I801', 'I802'])
if__name__=='__main__':
_main()
Activity
asottile commentedon Mar 22, 2020
fwiw, it's probably easier to use
flake8as a plugin system rather than pycodestyle