Skip to content

Commit a4e76ab

Browse files
committed
fix: misc linter trim
Signed-off-by: Josef Andersson <josef.andersson@digg.se>
1 parent 685e349 commit a4e76ab

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
SPDX-FileCopyrightText: 2025 Digg - Agency for Digital Government
4+
5+
SPDX-License-Identifier: CC0-1.0
6+
-->
7+
<FindBugsFilter>
8+
<!-- Exclude generated sources (OpenAPI, etc.) -->
9+
<Match>
10+
<Source name="~.*generated-sources.*"/>
11+
</Match>
12+
<Match>
13+
<Source name="~.*generated.*"/>
14+
</Match>
15+
</FindBugsFilter>

linters/java/spotbugs.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ source "${SCRIPT_DIR}/../../utils/colors.sh"
1111

1212
maven_opts=(--batch-mode --no-transfer-progress --errors -Dstyle.color=always)
1313

14+
# Default exclude file from devbase-justkit (excludes generated-sources)
15+
DEFAULT_EXCLUDE="${SCRIPT_DIR}/config/spotbugs-exclude.xml"
16+
1417
main() {
1518
print_header "JAVA SPOTBUGS"
1619

@@ -24,7 +27,17 @@ main() {
2427
return 1
2528
fi
2629

27-
if mvn "${maven_opts[@]}" spotbugs:check; then
30+
# Use project's exclude file if exists, otherwise use default
31+
local exclude_opt=()
32+
if [[ -f "development/spotbugs-exclude.xml" ]]; then
33+
exclude_opt=(-Dspotbugs.excludeFilterFile=development/spotbugs-exclude.xml)
34+
elif [[ -f ".spotbugs-exclude.xml" ]]; then
35+
exclude_opt=(-Dspotbugs.excludeFilterFile=.spotbugs-exclude.xml)
36+
elif [[ -f "${DEFAULT_EXCLUDE}" ]]; then
37+
exclude_opt=(-Dspotbugs.excludeFilterFile="${DEFAULT_EXCLUDE}")
38+
fi
39+
40+
if mvn "${maven_opts[@]}" ${exclude_opt[@]+"${exclude_opt[@]}"} spotbugs:check; then
2841
print_success "SpotBugs passed"
2942
return 0
3043
else

linters/markdown.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ readonly ACTION="${1:-check}"
1313
shift || true
1414
readonly DISABLE="${1:-MD013}"
1515

16-
readonly EXCLUDE=".github-shared,node_modules,vendor,target"
16+
readonly EXCLUDE=".github-shared,node_modules,vendor,target,CHANGELOG.md"
1717

1818
check_markdown() {
1919
local args=(check . --exclude "$EXCLUDE")

linters/shell-fmt.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ source "${SCRIPT_DIR}/../utils/colors.sh"
1212
readonly MODE="${1:-check}"
1313

1414
find_shell_scripts() {
15-
find . -type f \( -name "*.sh" -o -name "*.bash" \) -not -path "./.git/*" 2>/dev/null
15+
find . -type f \( -name "*.sh" -o -name "*.bash" \) \
16+
-not -path "./.git/*" \
17+
-not -path "./target/*" \
18+
-not -path "./node_modules/*" \
19+
2>/dev/null
1620
}
1721

1822
check_format() {

linters/shell.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ source "${SCRIPT_DIR}/../utils/colors.sh"
1212
find_shell_scripts() {
1313
find . -type f \( -name "*.sh" -o -name "*.bash" \) \
1414
-not -path "./.git/*" \
15+
-not -path "./target/*" \
16+
-not -path "./node_modules/*" \
1517
-not -path "./tests/libs/*" \
1618
2>/dev/null
1719
}
1820

1921
find_bats_files() {
2022
find . -type f -name "*.bats" \
2123
-not -path "./.git/*" \
24+
-not -path "./target/*" \
25+
-not -path "./node_modules/*" \
2226
-not -path "./tests/libs/*" \
2327
2>/dev/null
2428
}

0 commit comments

Comments
 (0)