Skip to content

Conversation

@dltj
Copy link
Owner

@dltj dltj commented Nov 10, 2024

No description provided.

@dltj dltj merged commit 7059258 into main Nov 10, 2024
1 of 2 checks passed
Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth considering. View full project report here.

@task
def build(c):
"""Build local version of site"""
pelican_run("-s {settings_base}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-string is easier to read, write, and less computationally expensive than legacy string formatting. More info.

@task
def rebuild(c):
"""`build` with the delete switch"""
pelican_run("-d -s {settings_base}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, Consider using f-string instead.

@task
def regenerate(c):
"""Automatically regenerate site upon file modification"""
pelican_run("-r -s {settings_base}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, Consider using f-string instead.

# Open site in default browser
import webbrowser

webbrowser.open("http://{host}:{port}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: Consider using f-string instead.


webbrowser.open("http://{host}:{port}".format(**CONFIG))

sys.stderr.write("Serving at {host}:{port} ...\n".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: Consider using f-string instead.

@task
def preview(c):
"""Build production version of site"""
pelican_run("-s {settings_publish}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: Consider using f-string instead.


content_file_extensions = [".md", ".rst"]
for extension in content_file_extensions:
content_glob = "{}/**/*{}".format(SETTINGS["PATH"], extension)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, Consider using f-string instead.

# Open site in default browser
import webbrowser

webbrowser.open("http://{host}:{port}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: Consider using f-string instead.

@task
def publish(c):
"""Publish to production via rsync"""
pelican_run("-s {settings_publish}".format(**CONFIG))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, Consider using f-string instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants