Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created September 20, 2020 17:42
Show Gist options
  • Save MartinThoma/cc5865fe57a3a403774fc68f9f676444 to your computer and use it in GitHub Desktop.
Save MartinThoma/cc5865fe57a3a403774fc68f9f676444 to your computer and use it in GitHub Desktop.
# Core Library
import ast
from typing import Set
# First party
from flake8_simplify import Plugin
def _results(code: str) -> Set[str]:
"""Apply the plugin to the given code."""
tree = ast.parse(code)
plugin = Plugin(tree)
return {f"{line}:{col} {msg}" for line, col, msg, _ in plugin.run()}
def test_trivial_case():
"""Check the plugins output for no code."""
assert _results("") == set()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment