Skip to content

Commit

Permalink
Add lint format and test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonykalavera committed Jul 22, 2024
1 parent 11e8a15 commit 33c333a
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 41 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.8
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,15 @@ github: publish
ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) "$(OUTPUTDIR)"
git push origin $(GITHUB_PAGES_BRANCH)

format:
ruff check --fix-only .
ruff format .

.PHONY: html help clean regenerate serve serve-global devserver devserver-global publish github
lint:
ruff check .
mypy .

test:
pytest -vv --cov .

.PHONY: html help clean regenerate serve serve-global devserver devserver-global publish github
17 changes: 8 additions & 9 deletions pelicanconf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Pelican configuration."""

AUTHOR = "Jony Kalavera"
SITENAME = "Studio Kalavera"
SITESUBTITLE = "One-man Game Development Studio"
Expand All @@ -12,17 +14,15 @@

# Do not publish articles set in the future
WITH_FUTURE_DATES = False
# TEMPLATE_PAGES = {"blog.html": "blog.html"}
STATIC_PATHS = ["images"]

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
FEED_ALL_ATOM: str | None = None
CATEGORY_FEED_ATOM: str | None = None
TRANSLATION_FEED_ATOM: str | None = None
AUTHOR_FEED_ATOM: str | None = None
AUTHOR_FEED_RSS: str | None = None

# Blogroll
LINKS: tuple[tuple[str, str], ...] = tuple()

# Social widget
Expand All @@ -38,7 +38,7 @@

DEFAULT_DATE_FORMAT = "%d/%b/%Y %a"

# Formatting for urls
# Formatting for URLs

ARTICLE_URL = "{date:%Y}/{date:%m}/{slug}/"
ARTICLE_SAVE_AS = "{date:%Y}/{date:%m}/{slug}/index.html"
Expand All @@ -61,7 +61,6 @@

RELATED_POSTS_MAX = 20

# TODO: align default SITEMAP config to http://wordpress.org/extend/plugins/google-sitemap-generator/stats/
SITEMAP = {
"format": "xml",
"priorities": {"articles": 0.5, "indexes": 0.5, "pages": 0.5},
Expand Down
196 changes: 195 additions & 1 deletion poetry.lock

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

12 changes: 2 additions & 10 deletions publishconf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# This file is only used if you use `make publish` or
"""Pelican publish configuration."""
# explicitly specify it as your config file.

import os
import sys

sys.path.append(os.curdir)
from pelicanconf import *
from pelicanconf import * # noqa: F403

# If your site is available via HTTPS, make sure SITEURL begins with https://
SITEURL = "https://studio.kalavera.xyz"
Expand All @@ -15,8 +12,3 @@
CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml"

DELETE_OUTPUT_DIRECTORY = True

# Following items are often useful when publishing

# DISQUS_SITENAME = ""
# GOOGLE_ANALYTICS = ""
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
##############################################################################
# MYPY SETTINGS #
##############################################################################
[tool.mypy]
python_version = "3.10"
ignore_missing_imports = true
strict_optional = true
mypy_path = "."

[[tool.mypy.overrides]]
module = [
"*.migrations.*",
"*.tests.*"
]
ignore_errors = true
##############################################################################
# RUFF SETTINGS #
##############################################################################

[tool.ruff]

# Same as Black.
line-length = 119

# Assume Python 3.10
target-version = "py310"

[tool.ruff.format]
exclude = ["__pycache__", ".pytest_cache", ".mypy_cache", ".venv",]

[tool.ruff.lint]
select = ["E", "F", "I", "PL", "B", "T20", "TCH", "ASYNC", "U", "UP", "LOG", "G", "ERA", "SIM", "D" ]

# On top of the Google convention, disable `D417`, which requires
# documentation for every function parameter.
ignore = ["D417", "PLR0913", "PLR2004", ]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]

##############################################################################
# POETRY SETTINGS #
##############################################################################
[tool.poetry]
name = "studiokalavera"
version = "0.1.0"
Expand All @@ -16,6 +62,9 @@ pelican-related-posts = "^1.0.0"
[tool.poetry.group.dev.dependencies]
ruff = "^0.5.4"
mypy = "^1.11.0"
types-invoke = "^2.0.0.10"
pytest = "^8.3.1"
pytest-coverage = "^0.0"

[build-system]
requires = ["poetry-core"]
Expand Down
Loading

0 comments on commit 33c333a

Please sign in to comment.