-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add report option to cli #1058
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
base: main
Are you sure you want to change the base?
Conversation
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit ab0d296 with previous commit ae52e3b. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 2 groups improved, 👍 5 audits improved, 👎 1 audit regressed, 14 audits changed without impacting score🗃️ Groups
19 other groups are unchanged. 🛡️ Audits
590 other audits are unchanged. |
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.
The implementation is good, but the naming doesn't feel right to me. Suggested a few alternatives.
--persist.report Generate the report files for given formats. (useful | ||
in combination with caching) [boolean] |
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.
The way this option is named and described feels off to me. Although we document --persist.report
, we don't expect anyone to ever use it like that, the only sensible usage is --persist.no-report
, which itself looks weird and I don't expect it'll occur to users to use the no-
"prefix" like that (why not --no-persist.report
for example?). Another oddity is that although it sits under persist
namespace on the same level with other options, disabling it actually makes all the other persist options meaningless (not clear from the name). And I don't think persist.report
works linguistically either, because we're chaining two verbs mean the same thing ("generate a file").
However, I can see why your chose to combine it with existing persist
options (logically coupled) and included no-
prefix negation (consistency for boolean options), instead of a standalone --no-report
option.
I can think of 2 alternatives which would be more intuitive:
- Instead of adding a new property under persist, we could allow setting
persist: false
(config) and--no-persist
(CLI). The type definition would effectively betype PersistConfig = false | { outputDir?: string, ... }
(default is the object, i.e. enabled with default options). This nicely illustrates how the logic works - either you don't persist anything, or you do and only in that case does it make sense to able to configure options. Our implementation can then be a simple truthiness check. And a--no-persist
flag is fairly self-explanatory. - If we want to keep
persist
as an object, then I'd rename the property and invert its meaning. I'd go withpersist.disabled
. This way the default value isfalse
(always preferable with booleans, aligns with truthy/falsy JS logic), it's more obvious from the name what it does and the documentation is less awkward. Now, we seem to be claiming--persist.report
is "useful in combination with caching" - it isn't,--persist.no-report
is, but that's not at all clear - but this description would work just fine for--persist.disabled
.
This PR includes:
persist.report
to modelpersist.report
to CLI options and logicRelated:
#1048