René's URL Explorer Experiment


Title: Implement `usethis tool ruff` · Issue #27 · usethis-python/usethis-python · GitHub

Open Graph Title: Implement `usethis tool ruff` · Issue #27 · usethis-python/usethis-python

X Title: Implement `usethis tool ruff` · Issue #27 · usethis-python/usethis-python

Description: Motivation ruff is probably the most popular linter as of late (for good reason) so it's essential we include it in usethis. Summary of desired feature Support the addition of ruff to a project using the usethis tool ruff command Design ...

Open Graph Description: Motivation ruff is probably the most popular linter as of late (for good reason) so it's essential we include it in usethis. Summary of desired feature Support the addition of ruff to a project usi...

X Description: Motivation ruff is probably the most popular linter as of late (for good reason) so it's essential we include it in usethis. Summary of desired feature Support the addition of ruff to a project...

Opengraph URL: https://github.com/usethis-python/usethis-python/issues/27

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Implement `usethis tool ruff`","articleBody":"**Motivation**\r\n`ruff` is probably the most popular linter as of late (for good reason) so it's essential we include it in `usethis`.\r\n\r\n**Summary of desired feature**\r\nSupport the addition of `ruff` to a project using the `usethis tool ruff` command\r\n\r\n**Design**\r\nBasically, the tool would be handled identically to `deptry` but there are some additional complications from needing `pyproject.toml` config. In particular, there needs to be some logic to add the new configuration sections to the `pyproject.toml`, if they don't already exist. This should be inserted alphabetically within the `tool` section - in cases where the order is not already alphabetical, place it as low as possible while still retaining order in terms of the subsequent sections.\r\n\r\nThere will be two hooks corresponding to formatting and checks, which is also different to the `deptry` case where there is only one hook.\r\n\r\nWe need to decide which rules to enable. To simplify things, we can just use `ruff`'s defaults, i.e. `[\"E4\", \"E7\", \"E9\", \"F\"]`, plus a collection of others which are mostly autofixable and relatively uncontroversial:\r\n`[\"I\", \"UP\", \"C4\", \"SIM\", \"PLE\", \"PLR\", \"FURB\", \"RUF\"]`\r\n\r\nLater, the user could opt-in to a more aggressive approach with a  `--strict` command which tries to enable as many rules as is reasonable (perhaps avoiding the especially controversial ones or ones with too many false positives). For now, we won't implement the `--strict` flag, so there would be minimal `ruff` configuration to add in `pyproject.toml`.\r\n\r\nAlso, later, for tools managed by `usethis`, we could ensure particular rules are enabled, e.g. `\"PT\"` when the user is using `pytest`.\r\n\r\nWhen making the strict flag later, here are some thoughts for reference:\r\n- Some rules are \"under-specified\" without further configuration, e.g. docstring checking. We should adopt an opinionated default even for controversial points like docstring format. Later, deviations from the defaults could be handled `usethis` interfaces.\r\n- We should name each rule family explicitly. We can keep track of new rules added to ruff via the `ruff rule --all --output-format json`, and have a version test which ensures we haven't missed anything. It is tempting to use `\"ALL\"` but this obscures which rules are actually being used. In my view, it is better to name each rule family explicitly, even if this makes the config section longer.  This also means we can manually go through each family of rules systematically and not just uncritically adopt new additions.\r\n- We could include rules conditionally based on whether the framework is being used; for example, `NPY` rules could be enabled only when `numpy` is a dependency. The issue with this is that dependencies might change. Even if the framework isn't being used, it doesn't hurt to have the rule enabled. So it's probably not a good idea.\r\n\r\n**Describe alternatives you've considered**\r\nRather than having a strict flag, we could have the strict behaviour by default. The issue with this is that it is probably too much of a departure from people's expectations and might have too many false positives. Compliance with too many rules is burdensome for users who are not familiar with linters, especially if there is not autofix. It is also potentially very controversial regaring which rules to enable, and a maintenance burden. A strict mode would need a good philosophy on rule inclusion/exclusion so it's not just a fully manual process of constantly reviewing new rules and changes to rules.\r\n\r\nI considered the possibility of just using the `ruff` defaults only without any extra rules, but there are just too many useful linters and it seems a shame not to enable them by default, especially when they are mostly autofix and relatively uncontroversial.\r\n\r\n**Testing Strategy**\r\nSame as for `deptry` but also include tests relating to the `pyproject.toml` file contents:\r\n- checking the contents are correct\r\n- checking that `ruff` is able to run in a way that proves it is using the file contents\r\n- checking the associated messages\r\n\r\nAny functions which add/remove contents to/from the `pyproject.toml` file should be tested too.\r\n\r\n**Steps**\r\n- Copy `deptry`'s Tool definition, mutatis mutandis.\r\n- Also copy the `deptry` CLI function, but add a new call to create `pyproject.toml` sections, testing along the way.\r\n\r\n**Acceptance Criteria**\r\nNew `usethis tool ruff` CLI interface is available to add `ruff` including configuration.\r\n","author":{"url":"https://github.com/nathanjmcdougall","@type":"Person","name":"nathanjmcdougall"},"datePublished":"2024-10-18T05:30:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/27/usethis-python/issues/27"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b1357987-491e-0f1a-bc0d-9c7883ac6f99
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8F28:418ED:5AED0DF:7ED7028:6A4F95E0
html-safe-nonce05d418842571132b886b8197ac1bf1006744207490ca6acb50fc49524c82029f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjI4OjQxOEVEOjVBRUQwREY6N0VENzAyODo2QTRGOTVFMCIsInZpc2l0b3JfaWQiOiI0MjY1NzExMjY5MDUzNDM3NDA4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac2ddc61a7616d1450276f2a456167b7f851abf8c9a01bcef7c577931b6db21d4f
hovercard-subject-tagissue:2596457056
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/usethis-python/usethis-python/27/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a8b587c42ce56d29b1462912b4e6e583b9b05dbbb3cec998d11734b3e18821b8/usethis-python/usethis-python/issues/27
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a8b587c42ce56d29b1462912b4e6e583b9b05dbbb3cec998d11734b3e18821b8/usethis-python/usethis-python/issues/27
og:image:altMotivation ruff is probably the most popular linter as of late (for good reason) so it's essential we include it in usethis. Summary of desired feature Support the addition of ruff to a project usi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamenathanjmcdougall
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
turbo-cache-controlno-preview
go-importgithub.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git
octolytics-dimension-user_id216362695
octolytics-dimension-user_loginusethis-python
octolytics-dimension-repository_id842189705
octolytics-dimension-repository_nwousethis-python/usethis-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id842189705
octolytics-dimension-repository_network_root_nwousethis-python/usethis-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4b249b445842943ed31549e027f57a8ade9881ed
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/usethis-python/usethis-python/issues/27#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fusethis-python%2Fusethis-python%2Fissues%2F27
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fusethis-python%2Fusethis-python%2Fissues%2F27
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=usethis-python%2Fusethis-python
Reloadhttps://github.com/usethis-python/usethis-python/issues/27
Reloadhttps://github.com/usethis-python/usethis-python/issues/27
Reloadhttps://github.com/usethis-python/usethis-python/issues/27
Please reload this pagehttps://github.com/usethis-python/usethis-python/issues/27
usethis-python https://github.com/usethis-python
usethis-pythonhttps://github.com/usethis-python/usethis-python
Notifications https://github.com/login?return_to=%2Fusethis-python%2Fusethis-python
Fork 5 https://github.com/login?return_to=%2Fusethis-python%2Fusethis-python
Star 19 https://github.com/login?return_to=%2Fusethis-python%2Fusethis-python
Code https://github.com/usethis-python/usethis-python
Issues 163 https://github.com/usethis-python/usethis-python/issues
Pull requests 4 https://github.com/usethis-python/usethis-python/pulls
Actions https://github.com/usethis-python/usethis-python/actions
Security and quality 0 https://github.com/usethis-python/usethis-python/security
Insights https://github.com/usethis-python/usethis-python/pulse
Code https://github.com/usethis-python/usethis-python
Issues https://github.com/usethis-python/usethis-python/issues
Pull requests https://github.com/usethis-python/usethis-python/pulls
Actions https://github.com/usethis-python/usethis-python/actions
Security and quality https://github.com/usethis-python/usethis-python/security
Insights https://github.com/usethis-python/usethis-python/pulse
#31https://github.com/usethis-python/usethis-python/pull/31
Implement usethis tool ruffhttps://github.com/usethis-python/usethis-python/issues/27#top
#31https://github.com/usethis-python/usethis-python/pull/31
https://github.com/nathanjmcdougall
enhancementNew feature or requesthttps://github.com/usethis-python/usethis-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/nathanjmcdougall
nathanjmcdougallhttps://github.com/nathanjmcdougall
on Oct 18, 2024https://github.com/usethis-python/usethis-python/issues/27#issue-2596457056
nathanjmcdougallhttps://github.com/nathanjmcdougall
enhancementNew feature or requesthttps://github.com/usethis-python/usethis-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.