-
Notifications
You must be signed in to change notification settings - Fork 10
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 the possibility to show the default values for parameters #135
Add the possibility to show the default values for parameters #135
Conversation
bee6ed7
to
d921670
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.
- unused-variable (Variable is unused)
* check-parameters: true (Check for unused parameters)
Please keep the full parameter name. This makes it less confusing when configuring your magik-lint.properties
. Now one might think the key to set is check-parameters
, instead of unused-variable.check-parameters
- forbidden-call (Forbidden call)
* (default) forbidden-calls (List of forbidden calls, separated by ','):
- show()
- sw:show()
- print()
- sw:print()
- debug_print()
- sw:debug_print()
- .sys!perform()
- .sys!slot()
I understand the splitting/generating the list. But when configuring your magik-lint.properties
it does expect a single string. This causes confusion.
I'm not a fan of this. It makes the software more complex and I doubt it adds that much value. It might be better to add the defaults to the wiki, through automation of some sort, if we would really want this. You can already see the defaults when running the linter(s) without a config file.
magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java
Outdated
Show resolved
Hide resolved
* Show parameters for a check. | ||
* | ||
* @param writer Writer Write to write output to. | ||
* @param showDefaultValues boolean Boolean to show default values for parameters or not. |
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.
No need to state that it is a boolean. Java includes types for their parameters etc. :)
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.
It was copied from the method above (showChecks), but I probably introduced that as well.
final Writer writer, final MagikCheckHolder holder, final boolean showDefaultValues) | ||
throws ReflectiveOperationException, IOException { | ||
for (final MagikCheckHolder.Parameter parameter : holder.getParameters()) { | ||
if (!parameter.isExplicitlySet() && !showDefaultValues) { |
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.
So if no value is set, and the --with-default-values
is not given, the parameter will not be shown? That seems a bit confusing
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.
That was the behaviour before this PR as well. Only user-changed parameters were shown. I kept that behaviour, but if a user uses --with-default-values
, the default values will be shown as well.
@@ -50,6 +50,11 @@ public final class Main { | |||
.build(); | |||
private static final Option OPTION_SHOW_CHECKS = | |||
Option.builder().longOpt("show-checks").desc("Show checks and exit").build(); | |||
private static final Option OPTION_WITH_DEFAULT_VALUES = |
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.
A better name would be --show-check-parameters-default-values
or something.
magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java
Outdated
Show resolved
Hide resolved
magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java
Outdated
Show resolved
Hide resolved
magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/MagikCheckHolder.java
Outdated
Show resolved
Hide resolved
magik-typed-lint/src/main/java/nl/ramsolutions/sw/magik/typedlint/MagikTypedLint.java
Outdated
Show resolved
Hide resolved
magik-typed-lint/src/main/java/nl/ramsolutions/sw/magik/typedlint/MagikTypedLint.java
Outdated
Show resolved
Hide resolved
magik-typed-lint/src/main/java/nl/ramsolutions/sw/magik/typedlint/MagikTypedLint.java
Outdated
Show resolved
Hide resolved
magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java
Outdated
Show resolved
Hide resolved
582238a
to
283abae
Compare
283abae
to
130e71c
Compare
) Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 17 to 18. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](DavidAnson/markdownlint-cli2-action@v17...v18) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…-showing-behaviour
Also improved the formatting a little:
Before:
After:
Adding
--with-default-values
to--show-checks
, generates the next output: