Q: Are comment lines allowed in yardopts file ? #1562
Replies: 5 comments
-
Comments are not supported in .yardopts files. This would be an added feature that could be introduced as a PR, but is fairly low priority for this project given that you should be able to remove the line and use standard source control versioning tools (git etc) to keep track of what was temporarily disabled. If you're really toggling switches in your options file that often, you may want to look into using |
Beta Was this translation helpful? Give feedback.
-
I don't want it to be a version of my repo.
Never used the word "often". Basically it is usually that I want some options off whilst authoring and testing extra pages. So this usually means making a backup copy of the "production" yardopts and making the temporary changes. Both of your suggestions would just complicate the situation. And neither would solve the desire to embed commentary into the file. Having a separate comments file has the disadvantage that people are always in a hurry and don't read such files. Anyway, ... where is the code located that reads and processes the |
Beta Was this translation helpful? Give feedback.
-
It doesn't have to be a "version" (commit). Delete the line from the .yardopts, test your code, FWIW if you're making changes to your .yardopts in order to author / modify extra pages it kind of sounds like a misuse of the .yardopts file in general to comment anything out. I'm not sure I follow the use case for commenting out lines if the goal is authoring / testing extra pages. Can you describe how you modify the .yardopts file in an edit flow?
https://github.com/lsegal/yard/blob/main/lib/yard/cli/yardopts_command.rb |
Beta Was this translation helpful? Give feedback.
-
FYI, I am not working from a Git repo. And I really don't want to have to learn Git CLI. It's enough for me to use the GitHub Desktop and occasionally push to the few GitHub repos I have.
I actually no longer need to do this specifically in this project. I was commenting out two Listen, for me I've been commenting out unneeded options or commends since 1985 or so. It is fast, straightforward, easy and does not complicate the need by bringing in other processes (Git) etc. To me, it's not a weird idea. It takes 2 seconds. And I'm still rollin'.
Well I suppose I can write my own plugin then. The real use case as I had said was that I wish to embed comments within the file. Thanks for the link to the My quick test shows this works to reject any lines beginning with a lines = File.readlines(file).select {|line| line !~ /^#/ } Afterward the lines.join.shell_split |
Beta Was this translation helpful? Give feedback.
-
So this morning I am running tests having backed up the original def yardopts(file = options_file)
return [] unless use_yardopts_file
lines = File.readlines(file).select {|line| line !~ /^\s*#/ }
lines.join.shell_split
rescue Errno::ENOENT
[]
end (I opted to allow whitespace in front of the In the original you were purposefully using a binary read for a simple text file. Ie ... # File 'lib/yard/core_ext/file.rb', line 66
def self.read_binary(file)
File.open(file, 'rb', &:read)
end
I just realized that if I use a plugin, I'll have to specify it's use on the command line as it would be too late as a line option in the EDIT: But there is a comment in |
Beta Was this translation helpful? Give feedback.
-
Q: Are comment lines allowed in yardopts file ?
Thoroughly read the Guide and the yardopts help file and find no solution.
Starting a line with a # character does not seem to work.
This came up because I desire to do 2 things:
In testing, I want to temporarily switch "off" an option line without having to delete the line (or create a cloned file with a different name.)
I want to place an informational "reason" above some options to explain (to other users coming later) why I used the options the way I did. (To avoid someone coming along later and thinking they knew better and could change the options or consolidate them differently which would have a negative effect on the output.)
Beta Was this translation helpful? Give feedback.
All reactions