Skip to content

Commit 06c0373

Browse files
authored
Merge branch 'master' into master
2 parents 886d23d + 9bfc05a commit 06c0373

File tree

1,342 files changed

+63868
-20029
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,342 files changed

+63868
-20029
lines changed

.clang-format

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
Language: Java
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: DontAlign
5+
AlignConsecutiveMacros: false
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: false
10+
AlignTrailingComments: false
11+
AllowAllArgumentsOnNextLine: true
12+
AllowAllConstructorInitializersOnNextLine: true
13+
AllowAllParametersOfDeclarationOnNextLine: true
14+
AllowShortBlocksOnASingleLine: Never
15+
AllowShortCaseLabelsOnASingleLine: false
16+
AllowShortFunctionsOnASingleLine: false
17+
AllowShortLambdasOnASingleLine: All
18+
AllowShortIfStatementsOnASingleLine: true
19+
AllowShortLoopsOnASingleLine: true
20+
AlwaysBreakAfterDefinitionReturnType: None
21+
AlwaysBreakAfterReturnType: None
22+
AlwaysBreakBeforeMultilineStrings: false
23+
AlwaysBreakTemplateDeclarations: MultiLine
24+
BinPackArguments: true
25+
BinPackParameters: true
26+
BraceWrapping:
27+
AfterCaseLabel: false
28+
AfterClass: false
29+
AfterControlStatement: false
30+
AfterEnum: false
31+
AfterFunction: false
32+
AfterNamespace: false
33+
AfterObjCDeclaration: false
34+
AfterStruct: false
35+
AfterUnion: false
36+
AfterExternBlock: false
37+
BeforeCatch: false
38+
BeforeElse: false
39+
IndentBraces: false
40+
SplitEmptyFunction: true
41+
SplitEmptyRecord: true
42+
SplitEmptyNamespace: true
43+
BreakBeforeBinaryOperators: All
44+
BreakBeforeBraces: Custom
45+
BreakBeforeInheritanceComma: false
46+
BreakInheritanceList: BeforeColon
47+
BreakBeforeTernaryOperators: true
48+
BreakConstructorInitializersBeforeComma: false
49+
BreakConstructorInitializers: BeforeComma
50+
BreakAfterJavaFieldAnnotations: false
51+
BreakStringLiterals: true
52+
ColumnLimit: 300
53+
CommentPragmas: '^ IWYU pragma:'
54+
CompactNamespaces: false
55+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
56+
ConstructorInitializerIndentWidth: 4
57+
ContinuationIndentWidth: 4
58+
Cpp11BracedListStyle: true
59+
DeriveLineEnding: true
60+
DerivePointerAlignment: false
61+
DisableFormat: false
62+
ExperimentalAutoDetectBinPacking: false
63+
FixNamespaceComments: false
64+
ForEachMacros:
65+
- foreach
66+
- Q_FOREACH
67+
- BOOST_FOREACH
68+
IncludeBlocks: Preserve
69+
IncludeCategories:
70+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
71+
Priority: 2
72+
SortPriority: 0
73+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
74+
Priority: 3
75+
SortPriority: 0
76+
- Regex: '.*'
77+
Priority: 1
78+
SortPriority: 0
79+
IncludeIsMainRegex: '(Test)?$'
80+
IncludeIsMainSourceRegex: ''
81+
IndentCaseLabels: false
82+
IndentGotoLabels: true
83+
IndentPPDirectives: None
84+
IndentWidth: 4
85+
IndentWrappedFunctionNames: false
86+
InsertNewlineAtEOF: true
87+
JavaScriptQuotes: Leave
88+
JavaScriptWrapImports: true
89+
KeepEmptyLinesAtTheStartOfBlocks: true
90+
MacroBlockBegin: ''
91+
MacroBlockEnd: ''
92+
MaxEmptyLinesToKeep: 1
93+
NamespaceIndentation: Inner
94+
ObjCBinPackProtocolList: Auto
95+
ObjCBlockIndentWidth: 4
96+
ObjCSpaceAfterProperty: true
97+
ObjCSpaceBeforeProtocolList: true
98+
PenaltyBreakAssignment: 2
99+
PenaltyBreakBeforeFirstCallParameter: 19
100+
PenaltyBreakComment: 300
101+
PenaltyBreakFirstLessLess: 120
102+
PenaltyBreakString: 1000
103+
PenaltyBreakTemplateDeclaration: 10
104+
PenaltyExcessCharacter: 1000000
105+
PenaltyReturnTypeOnItsOwnLine: 60
106+
PointerAlignment: Left
107+
ReflowComments: true
108+
SortIncludes: true
109+
SortUsingDeclarations: true
110+
SpaceAfterCStyleCast: true
111+
SpaceAfterLogicalNot: false
112+
SpaceAfterTemplateKeyword: true
113+
SpaceBeforeAssignmentOperators: true
114+
SpaceBeforeCpp11BracedList: false
115+
SpaceBeforeCtorInitializerColon: true
116+
SpaceBeforeInheritanceColon: true
117+
SpaceBeforeParens: ControlStatements
118+
SpaceBeforeRangeBasedForLoopColon: true
119+
SpaceInEmptyBlock: false
120+
SpaceInEmptyParentheses: false
121+
SpacesBeforeTrailingComments: 1
122+
SpacesInAngles: false
123+
SpacesInConditionalStatement: false
124+
SpacesInContainerLiterals: false
125+
SpacesInCStyleCastParentheses: false
126+
SpacesInParentheses: false
127+
SpacesInSquareBrackets: false
128+
SpaceBeforeSquareBrackets: false
129+
Standard: Latest
130+
StatementMacros:
131+
- Q_UNUSED
132+
- QT_REQUIRE_VERSION
133+
TabWidth: 8
134+
UseCRLF: false
135+
UseTab: Never
136+
...

.devcontainer/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/java/.devcontainer/base.Dockerfile
22

33
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
4-
ARG VARIANT="17-bullseye"
5-
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
4+
ARG VARIANT="21-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/java:1.1.0-${VARIANT}
66

77
# [Option] Install Maven
88
ARG INSTALL_MAVEN="false"

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// Update the VARIANT arg to pick a Java version: 11, 17
99
// Append -bullseye or -buster to pin to an OS version.
1010
// Use the -bullseye variants on local arm64/Apple Silicon.
11-
"VARIANT": "17-bullseye",
11+
"VARIANT": "21-bullseye",
1212
// Options
1313
"INSTALL_MAVEN": "true",
1414
"INSTALL_GRADLE": "true",

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @siriak @yanglbme @debasishbsws
1+
* @yanglbme @vil02 @BamaCharanChhandogi @alxkm @siriak

.github/dependabot.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "docker"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/.github/workflows/"
11+
schedule:
12+
interval: "daily"
13+
14+
- package-ecosystem: "maven"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
...

.github/pull_request_template.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
<!--
2+
Thank you for your contribution!
3+
In order to reduce the number of notifications sent to the maintainers, please:
4+
- create your PR as draft, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests,
5+
- make sure that all of the CI checks pass,
6+
- mark your PR as ready for review, cf. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review
7+
-->
8+
19
<!-- For completed items, change [ ] to [x] -->
210

311
- [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Java/blob/master/CONTRIBUTING.md).
412
- [ ] This pull request is all my own work -- I have not plagiarized it.
513
- [ ] All filenames are in PascalCase.
614
- [ ] All functions and variable names follow Java naming conventions.
715
- [ ] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
16+
- [ ] All new code is formatted with `clang-format -i --style=file path/to/your/file.java`

.github/workflows/build.yml

+28-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
name: Build
22
on: [push, pull_request]
3+
34
jobs:
45
build:
56
runs-on: ubuntu-latest
67
steps:
7-
- uses: actions/checkout@v2
8-
- name: Set up JDK 17
9-
uses: actions/setup-java@v2
8+
- uses: actions/checkout@v4
9+
- name: Set up JDK
10+
uses: actions/setup-java@v4
1011
with:
11-
java-version: 17
12-
distribution: 'adopt'
12+
java-version: 21
13+
distribution: 'temurin'
1314
- name: Build with Maven
1415
run: mvn --batch-mode --update-snapshots verify
16+
- name: Upload coverage to codecov (tokenless)
17+
if: >-
18+
github.event_name == 'pull_request' &&
19+
github.event.pull_request.head.repo.full_name != github.repository
20+
uses: codecov/codecov-action@v5
21+
with:
22+
fail_ci_if_error: true
23+
- name: Upload coverage to codecov (with token)
24+
if: >
25+
github.repository == 'TheAlgorithms/Java' &&
26+
(github.event_name != 'pull_request' ||
27+
github.event.pull_request.head.repo.full_name == github.repository)
28+
uses: codecov/codecov-action@v5
29+
with:
30+
token: ${{ secrets.CODECOV_TOKEN }}
31+
fail_ci_if_error: true
32+
- name: Checkstyle
33+
run: mvn checkstyle:check
34+
- name: SpotBugs
35+
run: mvn spotbugs:check
36+
- name: PMD
37+
run: mvn pmd:check
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Clang format linter
2+
on:
3+
push: {}
4+
pull_request: {}
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: DoozyX/[email protected]
13+
with:
14+
source: './src'
15+
extensions: 'java'
16+
clangFormatVersion: 16

.github/workflows/codeql.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: "CodeQL"
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
schedule:
11+
- cron: '53 3 * * 0'
12+
13+
env:
14+
LANGUAGE: 'java-kotlin'
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: 'ubuntu-latest'
20+
permissions:
21+
actions: read
22+
contents: read
23+
security-events: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up JDK
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: 21
33+
distribution: 'temurin'
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: ${{ env.LANGUAGE }}
39+
40+
- name: Build
41+
run: mvn --batch-mode --update-snapshots verify
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v3
45+
with:
46+
category: "/language:${{env.LANGUAGE}}"
47+
...

.github/workflows/infer.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: Infer
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
11+
jobs:
12+
run_infer:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: 21
21+
distribution: 'temurin'
22+
23+
- name: Set up OCaml
24+
uses: ocaml/setup-ocaml@v3
25+
with:
26+
ocaml-compiler: 5
27+
28+
- name: Get current year/weak
29+
run: echo "year_week=$(date +'%Y_%U')" >> $GITHUB_ENV
30+
31+
- name: Cache infer build
32+
id: cache-infer
33+
uses: actions/cache@v4
34+
with:
35+
path: infer
36+
key: ${{ runner.os }}-infer-${{ env.year_week }}
37+
38+
- name: Build infer
39+
if: steps.cache-infer.outputs.cache-hit != 'true'
40+
run: |
41+
cd ..
42+
git clone https://github.com/facebook/infer.git
43+
cd infer
44+
./build-infer.sh java
45+
cp -r infer ../Java
46+
47+
- name: Add infer to PATH
48+
run: |
49+
echo "infer/bin" >> $GITHUB_PATH
50+
51+
- name: Display infer version
52+
run: |
53+
which infer
54+
infer --version
55+
56+
- name: Run infer
57+
run: |
58+
mvn clean
59+
infer --fail-on-issue --print-logs --no-progress-bar -- mvn test
60+
...

.github/workflows/prettify.yml

-30
This file was deleted.

0 commit comments

Comments
 (0)