<p><b>@sqrrm</b> requested changes on this pull request.</p>
<p>NACK</p>
<p>See comments on exception usage.</p>
<p>Comments on braces are not blocking but it would be good to address the multiline blocks.</p>
<p>Apart from those comments it looks ready to merge.</p><hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/3889#discussion_r368680974">common/src/main/java/bisq/common/config/Config.java</a>:</p>
<pre style='color:#555'>> + .withRequiredArg()
+ .ofType(String.class)
+ .describedAs("OFF|ALL|ERROR|WARN|INFO|DEBUG|TRACE")
+ .defaultsTo(Level.INFO.levelStr);
+
+ ArgumentAcceptingOptionSpec<Path> torrcFileOpt =
+ parser.accepts("torrcFile", "An existing torrc-file to be sourced for Tor. Note that torrc-entries, " +
+ "which are critical to Bisq's correct operation, cannot be overwritten.")
+ .withRequiredArg()
+ .withValuesConvertedBy(new PathConverter(PathProperties.FILE_EXISTING, PathProperties.READABLE));
+
+ try {
+ OptionSet cliOpts = parser.parse(args);
+
+ if (cliOpts.has(helpOpt))
+ throw new HelpRequested(parser);
</pre>
<p>This goes against our style of not using exceptions as a part of the expected execution flow.</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/3889#discussion_r368930085">common/src/main/java/bisq/common/config/Config.java</a>:</p>
<pre style='color:#555'>> + ex.getMessage()));
+ }
+ }
+
+ private Optional<OptionSet> parseOptionsFrom(File file, OptionParser parser, OptionSpec<?>... disallowedOpts) {
+ if (!file.isAbsolute() || !file.exists())
+ return Optional.empty();
+
+ ConfigFileReader configFileReader = new ConfigFileReader(file);
+ String[] optionLines = configFileReader.getOptionLines().stream()
+ .map(o -> "--" + o) // prepend dashes expected by jopt parser below
+ .collect(toList())
+ .toArray(new String[]{});
+
+ OptionSet configFileOpts = parser.parse(optionLines);
+ for (OptionSpec<?> disallowedOpt : disallowedOpts)
</pre>
<p>Prefer braces...</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/3889#discussion_r368930224">common/src/main/java/bisq/common/config/Config.java</a>:</p>
<pre style='color:#555'>> + }
+ }
+
+ private Optional<OptionSet> parseOptionsFrom(File file, OptionParser parser, OptionSpec<?>... disallowedOpts) {
+ if (!file.isAbsolute() || !file.exists())
+ return Optional.empty();
+
+ ConfigFileReader configFileReader = new ConfigFileReader(file);
+ String[] optionLines = configFileReader.getOptionLines().stream()
+ .map(o -> "--" + o) // prepend dashes expected by jopt parser below
+ .collect(toList())
+ .toArray(new String[]{});
+
+ OptionSet configFileOpts = parser.parse(optionLines);
+ for (OptionSpec<?> disallowedOpt : disallowedOpts)
+ if (configFileOpts.has(disallowedOpt))
</pre>
<p>...for all blocks.</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/3889#discussion_r368931020">common/src/main/java/bisq/common/config/Config.java</a>:</p>
<pre style='color:#555'>> +
+ OptionSet configFileOpts = parser.parse(optionLines);
+ for (OptionSpec<?> disallowedOpt : disallowedOpts)
+ if (configFileOpts.has(disallowedOpt))
+ throw new IllegalArgumentException(
+ format("The '%s' option is disallowed in config files", disallowedOpt.options().get(0)));
+
+ return Optional.of(configFileOpts);
+ }
+
+ public String getDefaultAppName() {
+ return defaultAppName;
+ }
+
+ public File getDefaultUserDataDir() {
+ if (Utilities.isWindows())
</pre>
<p>Prefer braces even for single, unbroken line blocks, but I don't think we have completely agreed on that one.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/3889?email_source=notifications&email_token=AJFFTNUZ67AWNIFA55ABMRTQ63RBPA5CNFSM4KFNLJBKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSLZFEA#pullrequestreview-345477776">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNTVBD44YHKPG6AR7JLQ63RBPANCNFSM4KFNLJBA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNSS76MTOULKPRFSLETQ63RBPA5CNFSM4KFNLJBKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSLZFEA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/3889?email_source=notifications\u0026email_token=AJFFTNUZ67AWNIFA55ABMRTQ63RBPA5CNFSM4KFNLJBKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSLZFEA#pullrequestreview-345477776",
"url": "https://github.com/bisq-network/bisq/pull/3889?email_source=notifications\u0026email_token=AJFFTNUZ67AWNIFA55ABMRTQ63RBPA5CNFSM4KFNLJBKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSLZFEA#pullrequestreview-345477776",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>