-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Add a desc
stanza to the cask DSL
#8137
Add a desc
stanza to the cask DSL
#8137
Conversation
desc
stanza to the cask DSL
i can 'donate' a few thousand app-descriptions. quality is varying but it could be used a starting point. |
We'll also need to add the same audit which already exists for formulae to |
I couldn't locate the existing audit for formulae; can you point me to it? |
Ah, it's actually a RuboCop rule: Probably the best way to go is:
|
Thanks for the pointers, but I must confess I'm a little out of my depth here, as I have pretty much zero experience programming in Ruby. I have several basic questions, such as:
Do we have an example of a similar structure I can study? Or otherwise, would you mind drafting a pseudo-code outline of the suggested changes? (I imagine these may be simple changes for someone experienced, so feel free to add a commit to this PR with the intended changes if that's more convenient to you.) |
I'd start by creating a module RuboCop
module Cop
module DescHelper
module_function
def audit_desc(type, name, desc)
end
end
end
end which returns an array of problems. Called like |
@reitermarkus I'm sorry but I really lack the background to implement what you're suggesting. I have been making experiments locally for the past couple hours, and testing with I'll add a WIP commit to this PR to show you what I've got so far. I'd appreciate some more specific feedback/directions/pointers, as I really have no experience with Ruby programming so I lack many of the common patterns or concepts that would allow me to advance in this more autonomously. |
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.
Step 1 should work after these changes.
Thanks for the detailed feedback, @reitermarkus! I've made the changes you suggested, and through trial and error, continued to extract more functions from I am however stuck with the following errors:
and
I've tried, among other things, to locate definitions of |
The helper function should return an array of problems instead of calling the |
(Apologies, I forgot to add the newly created files. Updated the commit now.) |
3aa3ce4
to
f2fadb4
Compare
Ok, thanks — I'll try to implement this and will provide an update. |
Hi @reitermarkus — I've added a new commit with additional changes. The files should now pass @@ -1,7 +1,6 @@
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
desc 'command line'
- ^ Description should start with a capital letter
- ^^^^^^^^^^^^ Description should use "command-line" instead of "command line"
+ ^^^^^^^^^^^^^^^^^^^ Description should use "command-line" instead of "command line"
end The other failures all follow the same pattern. |
e49ebe0
to
ae653c3
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 doing the rubocop implementation, @reitermarkus! I left some comments inline (mostly nitpicks); please take a look and let me know what you think. I'd be happy to make the necessary changes myself, of course.
@waldyrious, yes, please feel free to make these changes yourself. Also, we need to add the cop to |
Sure, will do! Please do confirm the correct course of action on the comments I left inline, though, as I'm not sure which decision is the preferred in some of them. |
The extracted module will be used for Cask descs as well. Co-authored-by: Markus Reiter <me@reitermark.us>
7e498d6
to
3b86e1f
Compare
Hey @reitermarkus, I've done the discussed changes, and cleaned up the commits to make them more atomic. Let me know if there are any additional changes left. |
By the way, for future/self reference, I had some trouble figuring out the instructions from
In practice this means that for a test file like
(Hopefully this will help someone else —or my future self— who gets confused by the manpage instructions.) |
Thanks, @waldyrious, nice work! |
Fixes Homebrew/homebrew-cask#77696.
This PR introduces a new
desc
stanza to the Homebrew Cask DSL, to allow providing a proper description of a package, since the name may not always be sufficiently informative. This is similar to thedesc
field of Homebrew formulas, introduced by @adzenith in 8636547 (Homebrew/legacy-homebrew#39911), back in May 2015.For example, for the fontforge.rb cask, the contents would become something like this:
name 'FontForge' + desc 'Font editor and converter for outline and bitmap fonts' homepage 'https://fontforge.github.io/en-US/'
Note: I have very little experience with Ruby and Homebrew's internals, so this change was done mostly by studying the existing code (following an initial pointer by @reitermarkus) for patterns in similar stanzas (especially the
name
one), as well as previous PRs such as @vladimyr's #7286. I listed the changes inferred from that study in this comment, which was confirmed by @reitermarkus.After this PR, I will make the necessary adjustments to the documentation in the Homebrew/homebrew-cask repo.
brew style
with your changes locally?brew tests
with your changes locally?Note: I've ran
brew tests
locally "successfully", in that all the failures were timeout ones apparently unrelated to these changes.EDIT: for future reference (e.g. for someone reading this to figure out how one should go about adding a new stanza), the core of this PR is commit ffed8fd, which implements the actual
desc
stanza, along with 3b86e1f, which implements the rubocop to check a cask'sdesc
the same was that is done for formuladesc
s.