-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/jackdewinter/pymarkdown/issues/946
- Loading branch information
1 parent
3eb0b1c
commit 7d3ec20
Showing
11 changed files
with
524 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
test/resources/plugins/bad/bad_next_line_with_fix_trigger.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Module to implement a sample plugin that has a bad next_line function. | ||
""" | ||
from pymarkdown.plugin_manager.plugin_details import PluginDetailsV2 | ||
from pymarkdown.plugin_manager.rule_plugin import RulePlugin | ||
|
||
|
||
class BadNextLineWithFixTrigger(RulePlugin): | ||
""" | ||
Class to implement a sample plugin that has a bad starting_new_file function. | ||
""" | ||
|
||
def get_details(self): | ||
""" | ||
Get the details for the plugin. | ||
""" | ||
return PluginDetailsV2( | ||
plugin_name="bad-next-line-with-trigger", | ||
plugin_id="MDE008", | ||
plugin_enabled_by_default=True, | ||
plugin_description="Plugin that has a bad next_line function.", | ||
plugin_version="0.0.0", | ||
plugin_fix_level=0, | ||
plugin_supports_fix=True | ||
) | ||
|
||
def next_line(self, context, line): | ||
""" | ||
Event that a new line is being processed. | ||
""" | ||
if line == "throw_exception" and context.in_fix_mode: | ||
raise Exception("bad next_line") |
30 changes: 30 additions & 0 deletions
30
test/resources/plugins/bad/bad_next_line_with_scan_trigger.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Module to implement a sample plugin that has a bad next_line function. | ||
""" | ||
from pymarkdown.plugin_manager.plugin_details import PluginDetailsV2 | ||
from pymarkdown.plugin_manager.rule_plugin import RulePlugin | ||
|
||
|
||
class BadNextLineWithScanTrigger(RulePlugin): | ||
""" | ||
Class to implement a sample plugin that has a bad starting_new_file function. | ||
""" | ||
|
||
def get_details(self): | ||
""" | ||
Get the details for the plugin. | ||
""" | ||
return PluginDetailsV2( | ||
plugin_name="bad-next-line-with-trigger", | ||
plugin_id="MDE008", | ||
plugin_enabled_by_default=True, | ||
plugin_description="Plugin that has a bad next_line function.", | ||
plugin_version="0.0.0", | ||
) | ||
|
||
def next_line(self, context, line): | ||
""" | ||
Event that a new line is being processed. | ||
""" | ||
if line == "throw_exception": | ||
raise Exception("bad next_line") |
Oops, something went wrong.