Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e934c95

Browse files
authored
fix: add a new md formatter (#631)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 4aea565 commit e934c95

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

src/sp_repo_review/checks/precommit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,14 @@ class PC180(PreCommit):
128128
"Uses a markdown formatter"
129129

130130
renamed = {
131-
"https://github.com/pre-commit/mirrors-prettier": "https://github.com/rbubley/mirrors-prettier"
131+
"https://github.com/pre-commit/mirrors-prettier": "https://github.com/rbubley/mirrors-prettier",
132+
"https://github.com/executablebooks/mdformat": "https://github.com/hukkin/mdformat",
132133
}
133134

134135
repos = {
135136
"https://github.com/rbubley/mirrors-prettier",
136-
"https://github.com/executablebooks/mdformat",
137137
"https://github.com/hukkin/mdformat",
138+
"https://github.com/rvben/rumdl-pre-commit",
138139
}
139140

140141

tests/test_precommit.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,38 @@ def test_pc180():
130130
assert compute_check("PC180", precommit=precommit).result
131131

132132

133-
def test_pc180_alt_1():
133+
def test_pc180_rename():
134134
precommit = yaml.safe_load("""
135135
repos:
136-
- repo: https://github.com/rbubley/mirrors-prettier
136+
- repo: https://github.com/pre-commit/mirrors-prettier
137+
""")
138+
res = compute_check("PC180", precommit=precommit)
139+
assert not res.result
140+
assert "https://github.com/rbubley/mirrors-prettier" in res.err_msg
141+
142+
143+
def test_pc180_alt_2():
144+
precommit = yaml.safe_load("""
145+
repos:
146+
- repo: https://github.com/hukkin/mdformat
147+
""")
148+
assert compute_check("PC180", precommit=precommit).result
149+
150+
151+
def test_pc180_rename_1():
152+
precommit = yaml.safe_load("""
153+
repos:
154+
- repo: https://github.com/executablebooks/mdformat
155+
""")
156+
res = compute_check("PC180", precommit=precommit)
157+
assert not res.result
158+
assert "https://github.com/hukkin/mdformat" in res.err_msg
159+
160+
161+
def test_pc180_alt_3():
162+
precommit = yaml.safe_load("""
163+
repos:
164+
- repo: https://github.com/rvben/rumdl-pre-commit
137165
""")
138166
assert compute_check("PC180", precommit=precommit).result
139167

0 commit comments

Comments
 (0)