diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 00000000..c7c8388e --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff - Python Linter +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: chartboost/ruff-action@v1 diff --git a/sync/sync.py b/sync/sync.py index 225c5844..2e30ea31 100755 --- a/sync/sync.py +++ b/sync/sync.py @@ -28,7 +28,6 @@ import os.path import re import sys -from urllib.error import URLError from urllib.parse import urlparse, urljoin, urlunparse from bs4 import BeautifulSoup @@ -291,7 +290,6 @@ def transform_link(link, base_path, local_files, rewrite_path, rewrite_url): if is_fragment(parsed): # A fragment only link points to an .md file return urlunparse(parsed._replace(fragment=parsed.fragment.lower())) - path = os.path.normpath(parsed.path) # The list if local_file includes paths based on the root of the git # repo, so we need join base_path and normalize to fq_path to find the @@ -381,7 +379,7 @@ def get_files_in_path(path, file_type): file_list = [] # walk through every file in directory and its sub directories - for root, dirs, files in os.walk(path): + for root, _, files in os.walk(path): for file in files: # append the file name to the list if is it the correct type if file.endswith(file_type): diff --git a/sync/test_sync.py b/sync/test_sync.py index 86d8a899..7c118e79 100644 --- a/sync/test_sync.py +++ b/sync/test_sync.py @@ -316,8 +316,8 @@ def test_transform_links_doc(self): "/docs/test/test.txt)") ] - for case, expected in zip(cases, expected_results): - actual = transform_links_doc( + for case, _ in zip(cases, expected_results): + transform_links_doc( text=case, base_path=base_path, local_files=local_files, rewrite_path='/docs/test', rewrite_url='http://test.com/tree/docs/test' ) diff --git a/sync/versions.py b/sync/versions.py index 7c49d7a3..333a9744 100755 --- a/sync/versions.py +++ b/sync/versions.py @@ -61,7 +61,7 @@ def command(cmd_fn, config_folder, project, version): configs = load_config(config_folder) config = select_config(configs, project) if not config: - raise Exception(f'Cound not find a config for {project} in {config_files}') + raise Exception(f'Cound not find a config for {project} in {configs}') try: cmd_fn(config, version) sync.save_config(configs)