Skip to content

Commit dcaee5e

Browse files
Merge branch 'master' of https://github.com/TaranjeetSinghKalsi/Java into binary-string-to-decimal
2 parents a9aaaa7 + e21aee8 commit dcaee5e

File tree

922 files changed

+62403
-8095
lines changed

Some content is hidden

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

922 files changed

+62403
-8095
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @yanglbme @vil02 @BamaCharanChhandogi @alxkm @siriak
1+
* @DenizAltunkapan @yanglbme @alxkm

.github/workflows/build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
name: Build
22
on: [push, pull_request]
33

4+
permissions:
5+
contents: read
6+
47
jobs:
58
build:
69
runs-on: ubuntu-latest
710
steps:
8-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
912
- name: Set up JDK
10-
uses: actions/setup-java@v4
13+
uses: actions/setup-java@v5
1114
with:
1215
java-version: 21
13-
distribution: 'adopt'
16+
distribution: 'temurin'
1417
- name: Build with Maven
1518
run: mvn --batch-mode --update-snapshots verify
1619
- name: Upload coverage to codecov (tokenless)
1720
if: >-
1821
github.event_name == 'pull_request' &&
1922
github.event.pull_request.head.repo.full_name != github.repository
20-
uses: codecov/codecov-action@v4
23+
uses: codecov/codecov-action@v5
2124
with:
2225
fail_ci_if_error: true
2326
- name: Upload coverage to codecov (with token)
2427
if: >
2528
github.repository == 'TheAlgorithms/Java' &&
2629
(github.event_name != 'pull_request' ||
2730
github.event.pull_request.head.repo.full_name == github.repository)
28-
uses: codecov/codecov-action@v4
31+
uses: codecov/codecov-action@v5
2932
with:
3033
token: ${{ secrets.CODECOV_TOKEN }}
3134
fail_ci_if_error: true

.github/workflows/clang-format-lint.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ on:
33
push: {}
44
pull_request: {}
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
build:
811
runs-on: ubuntu-latest
912

1013
steps:
11-
- uses: actions/checkout@v4
12-
- uses: DoozyX/clang-format-lint-action@v0.18
14+
- uses: actions/checkout@v5
15+
- uses: DoozyX/clang-format-lint-action@v0.20
1316
with:
1417
source: './src'
1518
extensions: 'java'

.github/workflows/codeql.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ on:
1010
schedule:
1111
- cron: '53 3 * * 0'
1212

13-
env:
14-
LANGUAGE: 'java-kotlin'
15-
1613
jobs:
17-
analyze:
18-
name: Analyze
14+
analyzeJava:
15+
name: AnalyzeJava
1916
runs-on: 'ubuntu-latest'
2017
permissions:
2118
actions: read
@@ -24,24 +21,46 @@ jobs:
2421

2522
steps:
2623
- name: Checkout repository
27-
uses: actions/checkout@v4
24+
uses: actions/checkout@v5
2825

2926
- name: Set up JDK
30-
uses: actions/setup-java@v4
27+
uses: actions/setup-java@v5
3128
with:
3229
java-version: 21
33-
distribution: 'adopt'
30+
distribution: 'temurin'
3431

3532
- name: Initialize CodeQL
36-
uses: github/codeql-action/init@v3
33+
uses: github/codeql-action/init@v4
3734
with:
38-
languages: ${{ env.LANGUAGE }}
35+
languages: 'java-kotlin'
3936

4037
- name: Build
4138
run: mvn --batch-mode --update-snapshots verify
4239

4340
- name: Perform CodeQL Analysis
44-
uses: github/codeql-action/analyze@v3
41+
uses: github/codeql-action/analyze@v4
42+
with:
43+
category: "/language:java-kotlin"
44+
45+
analyzeActions:
46+
name: AnalyzeActions
47+
runs-on: 'ubuntu-latest'
48+
permissions:
49+
actions: read
50+
contents: read
51+
security-events: write
52+
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v5
56+
57+
- name: Initialize CodeQL
58+
uses: github/codeql-action/init@v4
59+
with:
60+
languages: 'actions'
61+
62+
- name: Perform CodeQL Analysis
63+
uses: github/codeql-action/analyze@v4
4564
with:
46-
category: "/language:${{env.LANGUAGE}}"
65+
category: "/language:actions"
4766
...

.github/workflows/infer.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ name: Infer
88
- master
99
pull_request:
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
run_infer:
1316
runs-on: ubuntu-latest
1417
steps:
15-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1619

1720
- name: Set up JDK
18-
uses: actions/setup-java@v4
21+
uses: actions/setup-java@v5
1922
with:
2023
java-version: 21
21-
distribution: 'adopt'
24+
distribution: 'temurin'
2225

2326
- name: Set up OCaml
2427
uses: ocaml/setup-ocaml@v3
@@ -41,6 +44,7 @@ jobs:
4144
cd ..
4245
git clone https://github.com/facebook/infer.git
4346
cd infer
47+
git checkout 01aaa268f9d38723ba69c139e10f9e2a04b40b1c
4448
./build-infer.sh java
4549
cp -r infer ../Java
4650
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: ProjectStructure
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
check_structure:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
- uses: actions/setup-python@v6
20+
with:
21+
python-version: '3.13'
22+
23+
- name: Check project structure
24+
run: python3 .github/workflows/scripts/check_structure.py
25+
...
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import pathlib
2+
import sys
3+
4+
5+
def _is_java_file_properly_located(java_file: pathlib.Path) -> bool:
6+
main_parents = java_file.parent.parents
7+
return (
8+
pathlib.Path("src/main/java/com/thealgorithms/") in main_parents
9+
or pathlib.Path("src/test/java/com/thealgorithms/") in main_parents
10+
)
11+
12+
13+
def _find_misplaced_java_files() -> list[pathlib.Path]:
14+
return [
15+
java_file
16+
for java_file in pathlib.Path(".").rglob("*.java")
17+
if not _is_java_file_properly_located(java_file)
18+
]
19+
20+
21+
if __name__ == "__main__":
22+
misplaced_files = _find_misplaced_java_files()
23+
if misplaced_files:
24+
print("The following java files are not located in the correct directory:")
25+
for _ in misplaced_files:
26+
print(_)
27+
sys.exit(1)

.github/workflows/stale.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ name: 'Close stale issues and PRs'
22
on:
33
schedule:
44
- cron: '0 0 * * *'
5+
permissions:
6+
contents: read
57
jobs:
68
stale:
9+
permissions:
10+
issues: write
11+
pull-requests: write
712
runs-on: ubuntu-latest
813
steps:
9-
- uses: actions/stale@v9
14+
- uses: actions/stale@v10
1015
with:
1116
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution!'
1217
close-issue-message: 'Please reopen this issue once you have made the required changes. If you need help, feel free to ask in our [Discord](https://the-algorithms.com/discord) server or ping one of the maintainers here. Thank you for your contribution!'
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Generate Directory Markdown
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
generate-directory:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v5
18+
19+
- name: Run Directory Tree Generator
20+
uses: DenizAltunkapan/directory-tree-generator@v2
21+
with:
22+
path: src
23+
extensions: .java
24+
show-extensions: false
25+
26+
- name: Commit changes
27+
run: |
28+
git config --global user.name "$GITHUB_ACTOR"
29+
git config --global user.email "[email protected]"
30+
git add DIRECTORY.md
31+
git diff --cached --quiet || git commit -m "Update DIRECTORY.md"
32+
33+
- name: Create Pull Request
34+
uses: peter-evans/create-pull-request@v7
35+
with:
36+
token: ${{ secrets.REPO_SCOPED_TOKEN }}
37+
branch: update-directory
38+
base: master
39+
title: "Update DIRECTORY.md"
40+
body: "Automatically generated update of the directory tree."
41+
commit-message: "Update DIRECTORY.md"
42+
draft: false

.github/workflows/update_directory.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)