Ejemplo n.º 1
0
 def test_lint(self):
     linter = MarkdownLinter(LintConfig())
     sample = self.get_sample_path("sample1.md")
     with open(sample) as f:
         errors = linter.lint(f.read())
         expected_errors = [RuleViolation("R1", "Line exceeds max length (119>80)", 3),
                            RuleViolation("R2", "Line has trailing whitespace", 4),
                            RuleViolation("R2", "Line has trailing whitespace", 5),
                            RuleViolation("R3", "Line contains hard tab characters (\\t)", 5)]
         self.assertListEqual(errors, expected_errors)
Ejemplo n.º 2
0
def cli(list_files, config, ignore, path):
    """ Markdown lint tool, checks your markdown for styling issues """
    files = MarkdownFileFinder.find_files(path)
    if list_files:
        echo_files(files)

    lint_config = get_lint_config(config)
    lint_config.apply_on_csv_string(ignore, lint_config.disable_rule)

    linter = MarkdownLinter(lint_config)
    error_count = linter.lint_files(files)
    exit(error_count)
Ejemplo n.º 3
0
def cli(list_files, config, ignore, path):
    """ Markdown lint tool, checks your markdown for styling issues """
    files = MarkdownFileFinder.find_files(path)
    if list_files:
        echo_files(files)

    lint_config = get_lint_config(config)
    lint_config.apply_on_csv_string(ignore, lint_config.disable_rule)

    linter = MarkdownLinter(lint_config)
    error_count = linter.lint_files(files)
    exit(error_count)
Ejemplo n.º 4
0
 def test_lint(self):
     linter = MarkdownLinter(LintConfig())
     sample = self.get_sample_path("sample1.md")
     with open(sample) as f:
         errors = linter.lint(f.read())
         expected_errors = [
             RuleViolation("R1", "Line exceeds max length (119>80)", 3),
             RuleViolation("R2", "Line has trailing whitespace", 4),
             RuleViolation("R2", "Line has trailing whitespace", 5),
             RuleViolation("R3", "Line contains hard tab characters (\\t)",
                           5)
         ]
         self.assertListEqual(errors, expected_errors)