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

DX: remove markdownlint support #173

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pyvenv*/
!.github/*.yml
!.github/*/*.yml
!.gitpod.yml
!.markdownlint.json
!.pre-commit-config.yaml
!.pre-commit-hooks.yaml
!.readthedocs.yml
Expand Down
1 change: 0 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ vscode:
extensions:
- charliermarsh.ruff
- christian-kohler.path-intellisense
- davidanson.vscode-markdownlint
- eamodio.gitlens
- editorconfig.editorconfig
- esbenp.prettier-vscode
Expand Down
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ repos:
.*\.py
)$

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint

- repo: local
hooks:
- id: mypy
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"charliermarsh.ruff",
"christian-kohler.path-intellisense",
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
Expand All @@ -24,6 +23,7 @@
],
"unwantedRecommendations": [
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"ms-python.flake8",
"ms-python.isort",
"ms-python.pylint",
Expand Down
23 changes: 23 additions & 0 deletions src/repoma/check_dev_files/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _remove_flake8() -> None:
executor(remove_extension_recommendation, "ms-python.flake8", unwanted=True)
executor(remove_precommit_hook, "autoflake") # cspell:ignore autoflake
executor(remove_precommit_hook, "flake8")
executor(remove_precommit_hook, "markdownlint")
executor(remove_precommit_hook, "nbqa-flake8")
executor(remove_settings, ["flake8.importStrategy"])
executor.finalize()
Expand All @@ -46,6 +47,12 @@ def _remove_isort() -> None:
executor(__remove_isort_settings)
executor(__remove_nbqa_option, "black")
executor(__remove_nbqa_option, "isort")
executor(
remove_extension_recommendation,
# cspell:ignore davidanson markdownlint
extension_name="davidanson.vscode-markdownlint",
unwanted=True,
)
executor(remove_extension_recommendation, "ms-python.isort", unwanted=True)
executor(remove_precommit_hook, "isort")
executor(remove_precommit_hook, "nbqa-isort")
Expand Down Expand Up @@ -96,6 +103,7 @@ def _remove_pydocstyle() -> None:
def _remove_pylint() -> None:
executor = Executor()
executor(__remove_configs, [".pylintrc"]) # cspell:ignore pylintrc
executor(__remove_from_gitignore, ".markdownlint.json")
executor(__uninstall, "pylint", check_options=["lint", "sty"])
executor(remove_extension_recommendation, "ms-python.pylint", unwanted=True)
executor(remove_precommit_hook, "pylint")
Expand Down Expand Up @@ -133,3 +141,18 @@ def __uninstall(package: str, check_options: List[str]) -> None:
continue
msg = f'Please remove {package} from the "{section}" section of setup.cfg'
raise PrecommitError(msg)


def __remove_from_gitignore(pattern: str) -> None:
gitignore_path = ".gitignore"
if not os.path.exists(gitignore_path):
return
with open(gitignore_path) as f:
lines = f.readlines()
filtered_lines = [s for s in lines if pattern not in s]
if filtered_lines == lines:
return
with open(gitignore_path, "w") as f:
f.writelines(filtered_lines)
msg = f"Removed {pattern} from {gitignore_path}"
raise PrecommitError(msg)
Loading