Closed kaushalmodi closed 5 years ago
The [Name]
warnings for *Param(Dispatch|Default)
come from your parameter names (probably "Force" and "Submitted") not my code. If you want to be style safe then you probably want to change those to force and submitted and put in a short = {"force":'F', "submitted":'S'}
.
The keyCount
declared but not used is mine, but honestly I think it's probably bad form to strictly error out on declared but not used conditions. I can see them being unsightly/annoying, but they shouldn't be a show stopper. Or does --styleCheck:error
fail on those, too?
It's often a PITA in code generators to never declare anything unless you'll really need it in later generated code. I've noticed that keyCount
and looked into it at some point, but don't recall why it was hard to fix. We can keep this issue open if that really matters to you.
The [Name] warnings for *Param(Dispatch|Default) come from your parameter names
Oops! You are correct!
Or does
--styleCheck:error
fail on those, too?
I don't think --styleCheck:error
will fail those; you can try it out.
We can keep this issue open if that really matters to you.
I am closing this.. If I still cannot compile my projects with --styleCheck:error
due to an error in cligen, I'll reopen this. Next time, I'll make sure that it's not a dynamically generated var from my project :)
No worries. I tried to pick my "suffixes" (e.g. ParamDispatch
) for generated names to try to be recognizable. It worked! But maybe only for me as a reader. :-) Had you searched for "submitted" you would find the string nowhere in the cligen repo. That could also have been a tip off.
Had you searched for "submitted" you would find the string nowhere in the cligen repo.
Yes, I was lazy..
Even if I had just read (not even searched) "SubmittedChangelists", I would have known that it came from my perforce/p4 package.
Wow. Opening an issue with copy-pasted errors to complain about said errors without actually even reading the names being complained about...That is lazy. It's ok, though, at least according to Larry Wall http://threevirtues.com/ :-)
Little bit credit for at least opening the issue? :P
I just copied all lines with:
/home/kmodi/.nimble/pkgs/cligen-0.9.36/cligen.nim(565, 12) Hint: ..
btw I confirm that now the "'keyCount' is declared but not used" are the only warnings emanating from cligen.
Cool. If you want to take a look at silencing the keyCount
thing, I'd happily accept a PR. I'm in the middle of something else at the moment.
I did a quick grep and found it amusing that you have that warning as part of your test suite :D
https://github.com/c-blake/cligen/blob/31fdd7040d8bc0d930b15d28acb0149646883489/test/ref#L673-L674
I'd happily accept a PR
Working on it ..
Update: OK, this wasn't as simple as I thought.. the keyCount
identifier is probably created on the fly using macros.. so grep doesn't help there. I'll need to revisit this later.
If all that really matters is silencing that pedantic warning (yeah..been there forever and I got sick of seeing it in the test diff), we could just always "use" the variable trivially as in keyCount.inc "Kaushal"; keyCount.dec "Kaushal"
right after we declare it. That might slow down program startup by like, oh, 20-40 nanoseconds or some similar hard to measure amount and Nim is unlikely to ever get an analyzer smart enough to realize that such a use was a no-op.
Maybe you can confirm all your own warnings go away? The one in the test suite did.
Oh, I was submitting the PR and then realized why it complained of merging conflict: https://github.com/kaushalmodi/cligen/commit/dabbe7bace487e51eb1b3661ee637fc2c6269208
Can you also fix the https://github.com/kaushalmodi/cligen/commit/dabbe7bace487e51eb1b3661ee637fc2c6269208#diff-5cbfc5f8e7ea060286d1849ee868c3deR871 part?
Done.
Thanks! cligen is now all clear.. now to deal with the styleCheck warnings coming from critbits ...
Yeah. I know about those, but that seemed more for style czars over at Nim stdlib. :-) I use that for quite a few things in both cligen
and lc
. So, hopefully you won't break anything. :-) I found some bug that wasn't caught by the unit tests probably caused by the '\0' no longer being visible from Nim '[]'. I just hope they don't change styleCheck rules very often...That would be a drag. Cheers.
Ref: https://github.com/nim-lang/Nim/pull/11752
OK enough style fixing for the day..
:-)
Hello,
When I compile any of my package using
cligen
with--styleCheck:hint
, I get these warnings:Can you please fix them? Once these are fixed, I plan to compile those packages with
--styleCheck:error
.PS: Once you fix these, it might be helpful to put
switch("styleCheck", "error")
in aconfig.nims
in the root of this repo.