Skip to content

Commit

Permalink
Fix lint error & remove black (#621)
Browse files Browse the repository at this point in the history
* Fix lint error & remove black

Related to #620

Update the lint script and configuration files to fix the lint error. And remove black because ruff replace it.

* **scripts/lint.sh**
  - Update the `ruff` command to use `ruff check` instead of `ruff`.
  - Remove the `black` command.

* **.github/workflows/lint.yml**
  - Remove `black` from the `Install dependencies` step.

* **.pre-commit-config.yaml**
  - Remove the `black` dependency.
  • Loading branch information
julien-duponchelle authored Aug 11, 2024
1 parent b933500 commit 3397d39
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff black
pip install ruff
- name: Run lint script
run: bash scripts/lint.sh
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ repos:
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,7 @@

1.0.8 31/03/2024
* Fix parsing replications events (#614)

1.0.9 11/08/2024
* Fix typo in ident variable name (#619)
* Remove black and use only ruff as linter
2 changes: 1 addition & 1 deletion pymysqlreplication/binlogstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def __log_valid_parameters(self):
parameter = parameter.replace("_BinLogStreamReader__", "")
if parameter in ignored or not value:
continue
if type(value) == frozenset:
if value is frozenset:
string_list = [
str(item).split()[-1][:-2].split(".")[2] for item in value
]
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[tool.ruff]
ignore = [
"E501", # Line too long, handled by black
lint.ignore = [
"F403", # from module import *' used, It should be removed afterwad
"F405", # same to F403
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
3 changes: 1 addition & 2 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
set -e
set -x

ruff pymysqlreplication
black pymysqlreplication --check
ruff check pymysqlreplication

0 comments on commit 3397d39

Please sign in to comment.