Skip to content

Commit

Permalink
feat: remove black, rearrange ruff commands
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberb committed Jun 24, 2024
1 parent ddebd21 commit d8b4513
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 73 deletions.
23 changes: 11 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,21 @@ $(INSTALL_STAMP): pyproject.toml poetry.lock
$(POETRY) install
touch $(INSTALL_STAMP)

.PHONY: ruff-sort
ruff-sort: $(INSTALL_STAMP) ## Run ruff sorting
$(POETRY) run ruff check --fix $(APP_AND_TEST_DIRS)
$(POETRY) run ruff format $(APP_AND_TEST_DIRS)

.PHONY: ruff-lint
ruff-lint: $(INSTALL_STAMP) ## Run ruff linting
$(POETRY) run ruff check $(APP_AND_TEST_DIRS)

.PHONY: ruff-fmt
ruff-lint: $(INSTALL_STAMP) ## Run ruff format checker
$(POETRY) run ruff format --check $(APP_AND_TEST_DIRS)

.PHONY: ruff-doc
ruff-doc: $(INSTALL_STAMP) ## Run ruff docs
ruff-doc: $(INSTALL_STAMP) ## Run ruff docstrings
$(POETRY) run ruff check --select D $(APP_AND_TEST_DIRS)

.PHONY: black
black: $(INSTALL_STAMP) ## Run black
$(POETRY) run black --quiet --diff --check merino $(APP_AND_TEST_DIRS)
.PHONY: ruff-format
ruff-sort: $(INSTALL_STAMP) ## Run ruff format
$(POETRY) run ruff format $(APP_AND_TEST_DIRS)

.PHONY: bandit
bandit: $(INSTALL_STAMP) ## Run bandit
Expand All @@ -46,12 +45,12 @@ mypy: $(INSTALL_STAMP) ## Run mypy
$(POETRY) run mypy $(APP_AND_TEST_DIRS) --config-file="pyproject.toml"

.PHONY: lint
lint: $(INSTALL_STAMP) ruff-sort ruff-lint ruff-doc black bandit mypy ## Run various linters
lint: $(INSTALL_STAMP) ruff-lint ruff-fmt ruff-doc bandit mypy ## Run various linters

.PHONY: format
format: $(INSTALL_STAMP) ## Sort imports and reformat code
$(POETRY) run ruff check --select I --fix $(APP_AND_TEST_DIRS)
$(POETRY) run black $(APP_AND_TEST_DIRS)
$(POETRY) run ruff check --fix $(APP_AND_TEST_DIRS)
$(POETRY) run ruff format $(APP_AND_TEST_DIRS)

.PHONY: dev
dev: $(INSTALL_STAMP) ## Run merino locally and reload automatically
Expand Down
9 changes: 6 additions & 3 deletions docs/dev/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ $ make help
# Just like `poetry install`
$ make install

# Run sort
$ make ruff-sort

# Run linter
$ make ruff-lint

# Run format checker
$ make ruff-fmt

# Run doc checker
$ make ruff-doc

# Run formatter
$ make ruff-format

# Run black
$ make black

Expand Down
57 changes: 1 addition & 56 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ relative_files = true
show_missing = true

[tool.ruff]
line-length = 99
line-length = 88

This comment has been minimized.

Copy link
@gruberb

gruberb Jun 24, 2024

Author Member

Ups, this made it into the commit. I tried a few settings to accompany black. Will revert to 99.

exclude = ["build", "dist", "__pycache__", ".git"]
# Error Code Ref: https://www.pydocstyle.org/en/stable/error_codes.html
# D212 Multi-line docstring summary should start at the first line
Expand All @@ -17,6 +17,7 @@ lint.extend-select = ["D212"]
# D203 as it conflicts with D211 https://github.com/PyCQA/pydocstyle/issues/141
# D205 1 blank line required between summary line and description, awkward spacing
# D400 First line should end with a period, doesn't work when sentence spans 2 lineslint.ignore = ["D105", "D107", "D203", "D205", "D400"]
lint.ignore = ["D105","D107","D203", "D205", "D400"]
lint.extend-ignore = ["E203"]
lint.per-file-ignores = {"__init__.py" = ["F401"]}
lint.pydocstyle.convention = "pep257"
Expand Down Expand Up @@ -85,7 +86,6 @@ types-python-dateutil = "^2.8.19.13"
pydantic = "^2.1.0"

[tool.poetry.group.dev.dependencies]
black = "^24.4.0"
mypy = "^1.5"
pre-commit = "^2.20.0"
bandit = {extras = ["toml"], version = "^1.7.5"}
Expand Down

0 comments on commit d8b4513

Please sign in to comment.