Skip to content
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 Checkstyle settings for newline after catch brace #12189

Merged
merged 9 commits into from
Nov 16, 2024
8 changes: 7 additions & 1 deletion config/IntelliJ Code Style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="WRAP_COMMENTS" value="true" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="true" />
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="CATCH_ON_NEW_LINE" value="false" />
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
<arrangement>
<rules>
<section>
Expand Down Expand Up @@ -293,4 +299,4 @@
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</code_scheme>
6 changes: 6 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<property name="fileExtensions" value="groovy,java" />
</module>

<!-- Prevent newline after catch opening parenthesis -->
<module name="RegexpMultiline">
<property name="message" value="No newline allowed after catch opening parenthesis" />
<property name="format" value="catch\s*\(\s*[\r]?\n" />
<property name="fileExtensions" value="groovy,java" />
</module>
<!-- Checks for size violations: https://checkstyle.sourceforge.io/config_sizes.html -->

<!-- LineLength not in place as PreviewerViewer and RelatedArticlesTab have line length with more than 500 charachters -->
Expand Down
7 changes: 7 additions & 0 deletions config/checkstyle/checkstyle_reviewdog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
<property name="fileExtensions" value="groovy,java" />
</module>

<!-- Prevent newline after catch opening parenthesis -->
<module name="RegexpMultiline">
<property name="message" value="No newline allowed after catch opening parenthesis" />
<property name="format" value="catch\s*\(\s*[\r]?\n" />
<property name="fileExtensions" value="groovy,java" />
</module>

<!-- Checks for size violations: https://checkstyle.sourceforge.io/config_sizes.html -->

<!-- LineLength not in place as PreviewerViewer and RelatedArticlesTab have line length with more than 500 charachters -->
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ private boolean exportMatches(List<ParserResult> loaded) {
try {
// extract current thread task executor from indexManager
matches = new DatabaseSearcher(query, databaseContext, new CurrentThreadTaskExecutor(), cliPreferences).getMatches();
} catch (IOException e) {
} catch (
IOException e) {
LOGGER.error("Error occurred when searching", e);
return false;
}
Expand Down
Loading