Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkdownBear: verify config_file #981

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions bears/markdown/MarkdownBear.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@ class MarkdownBear:
LICENSE = 'AGPL-3.0'
CAN_FIX = {'Formatting'}

@staticmethod
def create_arguments(filename, file, config_file,
markdown_bullets: str='-',
markdown_closed_headings: bool=False,
markdown_setext_headings: bool=False,
markdown_emphasis: str='*',
markdown_strong: str='*',
markdown_encode_entities: bool=False,
markdown_codefence: str='`',
markdown_fences: bool=True,
markdown_list_indent: str='1',
markdown_loose_tables: bool=False,
markdown_spaced_tables: bool=True,
markdown_list_increment: bool=True,
markdown_horizontal_rule: str='*',
markdown_horizontal_rule_spaces: bool=False,
markdown_horizontal_rule_repeat: int=3):
def generate_config(filename, file, config_file,
markdown_bullets: str="-",
markdown_closed_headings: bool=False,
markdown_setext_headings: bool=False,
markdown_emphasis: str="*",
markdown_strong: str="*",
markdown_encode_entities: bool=False,
markdown_codefence: str="`",
markdown_fences: bool=True,
markdown_list_indent: str="1",
markdown_loose_tables: bool=False,
markdown_spaced_tables: bool=True,
markdown_list_increment: bool=True,
markdown_horizontal_rule: str='*',
markdown_horizontal_rule_spaces: bool=False,
markdown_horizontal_rule_repeat: int=3):
"""
:param markdown_bullets:
Character to use for bullets in lists. Can be "-", "*" or "+".
Expand Down Expand Up @@ -101,7 +100,11 @@ def create_arguments(filename, file, config_file,
'ruleRepetition': markdown_horizontal_rule_repeat, # int
}

config_json = json.dumps(remark_configs)
# Remove { and } as remark adds them on its own
settings = config_json[1:-1]
return '--no-color', '--quiet', '--setting', settings
return json.dumps(remark_configs)

@staticmethod
def create_arguments(filename, file, config_file):
if config_file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait - did this actually work? At least this commit seems to be not helpful, config_file should be None all the time

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the purpose of the issue if the config_file should be None all the time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to override https://github.com/coala/coala/blob/master/coalib/bearlib/abstractions/Linter.py#L127 for the config to be generated, then config_file will hold a filename of that config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly confused by this. Where does config_file get set? Where does the value come from?

return '--no-color', '--quiet', '--setting', config_file
else:
raise Exception('No config file')