-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ruff): add option for ruff as linter and auto-formatter #298
Conversation
baefdd9
to
efa3084
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on that @Naman-Priyadarshi
src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Outdated
Show resolved
Hide resolved
src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Outdated
Show resolved
Hide resolved
src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Outdated
Show resolved
Hide resolved
src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Outdated
Show resolved
Hide resolved
src/scicookie/{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Outdated
Show resolved
Hide resolved
@@ -48,7 +48,7 @@ sort_by_size = true | |||
verbose = false | |||
{% endif -%} | |||
|
|||
{%- if cookiecutter.use_ruff == "yes" %} | |||
{%- if cookiecutter.use_ruff_linter == "yes" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no needs for keeping different if
for ruff linter and ruff formatter
just use something like:
if cookiecutter.use_ruff_linter == "yes" or cookiecutter.use_ruff_formatter == "yes"
or maybe something like (not really sure if that works inside a jinja2 tag):
`if "yes" in [cookiecutter.use_ruff_linter, cookiecutter.use_ruff_formatter]`
src/scicookie/{{cookiecutter.project_slug}}/build-system/poetry/pyproject.toml
Outdated
Show resolved
Hide resolved
330d040
to
97f11dc
Compare
Hey @Naman-Priyadarshi , it seems that there is 1 file that needs an format update, according to ruff formatter ... let me know if you need any help to identify what need to be done |
I tried running |
diff --git a/src/osl_python_package/__init__.py b/src/osl_python_package/__init__.py
index 87fa060..d5d5599 100644
--- a/src/osl_python_package/__init__.py
+++ b/src/osl_python_package/__init__.py
@@ -8,11 +8,11 @@ def get_version() -> str:
try:
return importlib_metadata.version(__name__)
except importlib_metadata.PackageNotFoundError: # pragma: no cover
- return '0.1.0' # semantic-release
+ return "0.1.0" # semantic-release
version = get_version()
__version__ = version |
@@ -48,7 +48,7 @@ sort_by_size = true | |||
verbose = false | |||
{% endif -%} | |||
|
|||
{%- if cookiecutter.use_ruff == "yes" %} | |||
{%- if cookiecutter.use_ruff_linter == "yes" or cookiecutter.use_ruff_formatter == "yes" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add at the end of the tool.ruff tables/sections
https://github.com/arxlang/astx/blob/main/pyproject.toml#L100-L101
[tool.ruff.format]
quote-style = "double"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried both single
and double
, still getting the same error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @xmnlab, since the "double" format did not work, maybe we would change the generation of
return '0.1.0' # semantic-release
to use double quotes instead?
77280a9
to
874d4e3
Compare
Hi @xmnlab, the test seems to be failing due to some miscellaneous error
Could you help me out here? Thank you! |
hi @Naman-Priyadarshi ! when things weird like that happen in CI, just restart that to check if it is some random issue in the installation ... usually that fix the problem. if it is something about distlib ... maybe it is some conflict between conda and poetry .. so usually I just add that dep inside the conda environment file in the pip section ... usually that fix the issue in this case I just restarted the CI and everything is working |
thanks for working on that @Naman-Priyadarshi |
yeah that makes complete sense, the problem is that maybe I don't have permissions to restart the ci! that's why I mentioned you to do it for me hahaha, anyways thank you 😁 |
🎉 This issue has been resolved in version 0.9.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Pull Request description
This pull request introduces two separate configuration options for ruff: linter and auto-formatter. These changes enhance the flexibility of our code quality tools, allowing users to choose whether they want to use Ruff solely as a linter, solely as an auto-formatter, or both.
Also added both the configurations to the osl profile and base profile.
WIP: Adding documentation toguide.md
Fixes #220
How to test these changes
makim tests.unittest
or
create a project manually
Pull Request checklists
This PR is a:
About this PR:
Author's checklist:
complexity.
Additional information
Reviewer's checklist
Copy and paste this template for your review's note: