From 897f35bd6f806dff68409157af16d1f60311feb2 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 11:48:13 +0100
Subject: [PATCH 01/29] Update readme.md
---
readme.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/readme.md b/readme.md
index 03466328..b6c12151 100644
--- a/readme.md
+++ b/readme.md
@@ -4,6 +4,7 @@
[See the presentation here](http://fr.slideshare.net/AntoineRey/spring-framework-petclinic-sample-application)
## Running petclinic locally
+
```
git clone https://github.com/spring-petclinic/spring-petclinic-angularjs.git
cd spring-petclinic-angularjs
From c15ba860bbec0b868edcde73ec5949c7fa18081f Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 11:55:34 +0100
Subject: [PATCH 02/29] Update app.js
---
spring-petclinic-client/src/scripts/app.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spring-petclinic-client/src/scripts/app.js b/spring-petclinic-client/src/scripts/app.js
index 66db62a2..0b6f484b 100644
--- a/spring-petclinic-client/src/scripts/app.js
+++ b/spring-petclinic-client/src/scripts/app.js
@@ -6,7 +6,7 @@ var petClinicApp = angular.module('petClinicApp', [
petClinicApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', function(
$stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
-
+ console.log("Secret");
// safari turns to be lazy sending the Cache-Control header
$httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache';
$httpProvider.interceptors.push('HttpErrorHandlingInterceptor');
From ab06f8a74c92f86377155eae0a0bd6453d6d0e54 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:02:15 +0100
Subject: [PATCH 03/29] Create .sonarcloud.properties
---
.sonarcloud.properties | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 .sonarcloud.properties
diff --git a/.sonarcloud.properties b/.sonarcloud.properties
new file mode 100644
index 00000000..816d5ede
--- /dev/null
+++ b/.sonarcloud.properties
@@ -0,0 +1,15 @@
+# Path to sources
+sonar.sources=spring-petclinic-client/sec,spring-petclinic-server
+#sonar.exclusions=
+#sonar.inclusions=
+
+# Path to tests
+#sonar.tests=
+#sonar.test.exclusions=
+#sonar.test.inclusions=
+
+# Source encoding
+#sonar.sourceEncoding=UTF-8
+
+# Exclusions for copy-paste detection
+#sonar.cpd.exclusions=
From 3e243124c69658ee8fb3e73b586185a484c01383 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:04:49 +0100
Subject: [PATCH 04/29] Update .sonarcloud.properties
---
.sonarcloud.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.sonarcloud.properties b/.sonarcloud.properties
index 816d5ede..a2807507 100644
--- a/.sonarcloud.properties
+++ b/.sonarcloud.properties
@@ -1,5 +1,5 @@
# Path to sources
-sonar.sources=spring-petclinic-client/sec,spring-petclinic-server
+sonar.sources=spring-petclinic-client/src,spring-petclinic-server/src
#sonar.exclusions=
#sonar.inclusions=
From 29365086f0f20ab077c8d991e3ed3c025de9105d Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:18:58 +0100
Subject: [PATCH 05/29] Update visits.js
---
.../src/scripts/visits/visits.js | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/spring-petclinic-client/src/scripts/visits/visits.js b/spring-petclinic-client/src/scripts/visits/visits.js
index 10821aca..7092a360 100644
--- a/spring-petclinic-client/src/scripts/visits/visits.js
+++ b/spring-petclinic-client/src/scripts/visits/visits.js
@@ -9,3 +9,44 @@ angular.module('visits', ['ui.router'])
template: ''
})
}]);
+function aaToooLong_Non_MeaningfulMethodeBlaBlaBlaBlaaaToooLong_Non_MeaningfulMethodeBlaBlaBlaBla()
+{
+or (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = bricks[c][r];
+ if (b.status === 1) {
+ if (
+ x > b.x &&
+ x < b.x + brickWidth &&
+ y > b.y &&
+ y < b.y + brickHeight
+ ) {
+ dy = -dy;
+ b.status = 0;
+ score++;
+ }
+ }
+ }
+ }
+}
+
+function aaToooLong_Non_MeaningfulMethodeBlaBlaBlaBlaaaToooLong_Non_MeaningfulMethodeBlaBlaBlaBla2222()
+{
+or (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = bricks[c][r];
+ if (b.status === 1) {
+ if (
+ x > b.x &&
+ x < b.x + brickWidth &&
+ y > b.y &&
+ y < b.y + brickHeight
+ ) {
+ dy = -dy;
+ b.status = 0;
+ score++;
+ }
+ }
+ }
+ }
+}
From 63b307621c0a3be00aafabed48d83b05780ebb5c Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:26:05 +0100
Subject: [PATCH 06/29] Update pom.xml
---
pom.xml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pom.xml b/pom.xml
index 7820193b..e437165e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,9 @@
4.0.0
+
+ spring-petclinic-client/sec,spring-petclinic-server
+
org.springframework.boot
@@ -74,4 +77,5 @@
+
From 8bd26e618e197d394cd93b55222044481f5ed5fb Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:29:46 +0100
Subject: [PATCH 07/29] Update pom.xml
---
spring-petclinic-client/pom.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/spring-petclinic-client/pom.xml b/spring-petclinic-client/pom.xml
index c2ba2b1e..306665d5 100644
--- a/spring-petclinic-client/pom.xml
+++ b/spring-petclinic-client/pom.xml
@@ -13,6 +13,7 @@
v4.4.3
2.15.1
+ src
From cef9648879329485727105ce6977fdb0888e2ba7 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:33:48 +0100
Subject: [PATCH 08/29] Update pom.xml
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index e437165e..36b249cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- spring-petclinic-client/sec,spring-petclinic-server
+ spring-petclinic-client/src,spring-petclinic-server/src
From 8533894a63eae4f18eba96c90711fc53aa2df9fe Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:36:49 +0100
Subject: [PATCH 09/29] Update visits.js
---
.../src/scripts/visits/visits.js | 44 ++++++++++++++++++-
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/spring-petclinic-client/src/scripts/visits/visits.js b/spring-petclinic-client/src/scripts/visits/visits.js
index 7092a360..7e521833 100644
--- a/spring-petclinic-client/src/scripts/visits/visits.js
+++ b/spring-petclinic-client/src/scripts/visits/visits.js
@@ -11,7 +11,7 @@ angular.module('visits', ['ui.router'])
}]);
function aaToooLong_Non_MeaningfulMethodeBlaBlaBlaBlaaaToooLong_Non_MeaningfulMethodeBlaBlaBlaBla()
{
-or (let c = 0; c < brickColumnCount; c++) {
+for (let c = 0; c < brickColumnCount; c++) {
for (let r = 0; r < brickRowCount; r++) {
const b = bricks[c][r];
if (b.status === 1) {
@@ -32,7 +32,47 @@ or (let c = 0; c < brickColumnCount; c++) {
function aaToooLong_Non_MeaningfulMethodeBlaBlaBlaBlaaaToooLong_Non_MeaningfulMethodeBlaBlaBlaBla2222()
{
-or (let c = 0; c < brickColumnCount; c++) {
+for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = bricks[c][r];
+ if (b.status === 1) {
+ if (
+ x > b.x &&
+ x < b.x + brickWidth &&
+ y > b.y &&
+ y < b.y + brickHeight
+ ) {
+ dy = -dy;
+ b.status = 0;
+ score++;
+ }
+ }
+ }
+ }
+}
+
+function function aaToooLong_Non_MeaningfulMethodeBlaBlaBlaBlaaaToooLong_Non_MeaningfulMethodeBlaBlaBlaBla2222()
+{
+for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = bricks[c][r];
+ if (b.status === 1) {
+ if (
+ x > b.x &&
+ x < b.x + brickWidth &&
+ y > b.y &&
+ y < b.y + brickHeight
+ ) {
+ dy = -dy;
+ b.status = 0;
+ score++;
+ }
+ }
+ }
+ }
+}()
+{
+for (let c = 0; c < brickColumnCount; c++) {
for (let r = 0; r < brickRowCount; r++) {
const b = bricks[c][r];
if (b.status === 1) {
From b958a052844e82af2c8e3084a412bba617d4d3e3 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:42:39 +0100
Subject: [PATCH 10/29] Update pom.xml
---
pom.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 36b249cc..3aad17a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,9 @@
4.0.0
- spring-petclinic-client/src,spring-petclinic-server/src
+ spring-petclinic-client/src,spring-petclinic-server/src
+ iebouihi
+ https://sonarcloud.io
From d98e2c5691e92746efeeec9021f68032b209b074 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:43:12 +0100
Subject: [PATCH 11/29] Create build.yml
---
.github/workflows/build.yml | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 .github/workflows/build.yml
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..e271937a
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,37 @@
+name: SonarCloud
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ types: [opened, synchronize, reopened]
+jobs:
+ build:
+ name: Build and analyze
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: 17
+ distribution: 'zulu' # Alternative distribution options are available.
+ - name: Cache SonarCloud packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+ - name: Cache Maven packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build and analyze
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=iebouihi_spring-petclinic-angularjs
From 1057e2f2c8652a43b15947469fa230c78751db0a Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:45:26 +0100
Subject: [PATCH 12/29] Update visits.controller.js
---
.../src/scripts/visits/visits.controller.js | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/spring-petclinic-client/src/scripts/visits/visits.controller.js b/spring-petclinic-client/src/scripts/visits/visits.controller.js
index 48ee7242..9db2352b 100644
--- a/spring-petclinic-client/src/scripts/visits/visits.controller.js
+++ b/spring-petclinic-client/src/scripts/visits/visits.controller.js
@@ -23,3 +23,23 @@ angular.module('visits')
});
};
}]);
+function aaToooLong_Non_MeaningfulMethodeBlaBlaBlaBlaaaToooLong_Non_MeaningfulMethodeBlaBlaBlaBla()
+{
+for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = bricks[c][r];
+ if (b.status === 1) {
+ if (
+ x > b.x &&
+ x < b.x + brickWidth &&
+ y > b.y &&
+ y < b.y + brickHeight
+ ) {
+ dy = -dy;
+ b.status = 0;
+ score++;
+ }
+ }
+ }
+ }
+}
From 128b06dca1d1fdf0be656343774dbb57e7e4b0b8 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:50:38 +0100
Subject: [PATCH 13/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index f2571d7f..155e5efc 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,3 +1,5 @@
{
"registry": "https://registry.bower.io"
+ "strict-ssl": false,
+ "https-proxy": "",
}
From 55a4c9520ffe58b3948910926f81f356e9e90f52 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:51:35 +0100
Subject: [PATCH 14/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index f2571d7f..1988783c 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,3 +1,5 @@
{
"registry": "https://registry.bower.io"
+"strict-ssl": false,
+"https-proxy": "",
}
From de0c69cb6ca9d77f6564eca86b914734cf46bccd Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:51:47 +0100
Subject: [PATCH 15/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index 1988783c..0a6f12f1 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,5 +1,5 @@
{
"registry": "https://registry.bower.io"
"strict-ssl": false,
-"https-proxy": "",
+"https-proxy": ""
}
From 411cf359fb7b10655dbe7af28b65c0557d9d1a62 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:53:21 +0100
Subject: [PATCH 16/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 2 --
1 file changed, 2 deletions(-)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index 155e5efc..f2571d7f 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,5 +1,3 @@
{
"registry": "https://registry.bower.io"
- "strict-ssl": false,
- "https-proxy": "",
}
From 202267dd6e96eeb89b655e33d3a214f552a20224 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 12:53:54 +0100
Subject: [PATCH 17/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index 0a6f12f1..956d55f0 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,5 +1,7 @@
{
"registry": "https://registry.bower.io"
-"strict-ssl": false,
-"https-proxy": ""
+ "strict-ssl": false,
+ "https-proxy": ""
+
+
}
From c3f85550d9367f91957f54678330c886b7e98a1d Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 14:21:34 +0100
Subject: [PATCH 18/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index 956d55f0..be7bf20c 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,7 +1,5 @@
{
"registry": "https://registry.bower.io"
- "strict-ssl": false,
+ "strict-ssl": "false",
"https-proxy": ""
-
-
}
From 581e3b93c60c2ba9e3ce6b19e025278a9e71e93e Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 14:29:25 +0100
Subject: [PATCH 19/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 2 --
1 file changed, 2 deletions(-)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index be7bf20c..f2571d7f 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,5 +1,3 @@
{
"registry": "https://registry.bower.io"
- "strict-ssl": "false",
- "https-proxy": ""
}
From 579f3ac2a516775b61be37254b8adcb8a6e0d636 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 14:33:23 +0100
Subject: [PATCH 20/29] Update .bowerrc
---
spring-petclinic-client/.bowerrc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/spring-petclinic-client/.bowerrc b/spring-petclinic-client/.bowerrc
index f2571d7f..44da0afa 100644
--- a/spring-petclinic-client/.bowerrc
+++ b/spring-petclinic-client/.bowerrc
@@ -1,3 +1,4 @@
{
- "registry": "https://registry.bower.io"
+ "registry": "https://registry.bower.io",
+ "strict-ssl": false
}
From 083036432986048835cd2f4aec1e8f1630c4254e Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 14:41:41 +0100
Subject: [PATCH 21/29] Update pom.xml Relpve Gulp
---
spring-petclinic-client/pom.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/spring-petclinic-client/pom.xml b/spring-petclinic-client/pom.xml
index 306665d5..a0320434 100644
--- a/spring-petclinic-client/pom.xml
+++ b/spring-petclinic-client/pom.xml
@@ -57,12 +57,14 @@
bower
+
From 8648d5d1807d4c878b51b5fbd92919829537dd76 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 14:47:11 +0100
Subject: [PATCH 22/29] Update .sonarcloud.properties
---
.sonarcloud.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.sonarcloud.properties b/.sonarcloud.properties
index a2807507..bbc2f262 100644
--- a/.sonarcloud.properties
+++ b/.sonarcloud.properties
@@ -1,5 +1,5 @@
# Path to sources
-sonar.sources=spring-petclinic-client/src,spring-petclinic-server/src
+#sonar.sources=spring-petclinic-client/src,spring-petclinic-server/src
#sonar.exclusions=
#sonar.inclusions=
From 71f048483c89d8b244413102579403420f00e2a5 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Mon, 25 Dec 2023 14:50:47 +0100
Subject: [PATCH 23/29] Update pom.xml
---
pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 3aad17a3..3b9ced08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,6 @@
4.0.0
- spring-petclinic-client/src,spring-petclinic-server/src
iebouihi
https://sonarcloud.io
From 7c012751b5cbd669ade44a85c8914fe78bdb5ae6 Mon Sep 17 00:00:00 2001
From: Imad Eddine <93336146+iebouihi@users.noreply.github.com>
Date: Wed, 3 Apr 2024 15:43:40 +0000
Subject: [PATCH 24/29] Create main.yml
---
.github/workflows/main.yml | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 .github/workflows/main.yml
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..cf5f200b
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,22 @@
+name: AI Code Reviewer
+
+on:
+ pull_request:
+ types:
+ - opened
+ - synchronize
+permissions: write-all
+jobs:
+ review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Repo
+ uses: actions/checkout@v3
+
+ - name: AI Code Reviewer
+ uses: your-username/ai-code-reviewer@main
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ OPENAI_API_MODEL: "gpt-4" # Optional: defaults to "gpt-4"
+ exclude: "**/*.json, **/*.md" # Optional: exclude patterns separated by commas
From 935d2f57f1928909d9f5a928a7033f66f6fc7b1c Mon Sep 17 00:00:00 2001
From: Imad Eddine Bouihi
Date: Wed, 3 Apr 2024 16:09:23 +0000
Subject: [PATCH 25/29] AI review
---
.../org/springframework/samples/petclinic/model/Pet.java | 5 +++++
.../samples/petclinic/model/ValidatorTests.java | 1 +
2 files changed, 6 insertions(+)
diff --git a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
index 40f7489a..9229d49c 100644
--- a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
+++ b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
@@ -109,5 +109,10 @@ public void addVisit(Visit visit) {
getVisitsInternal().add(visit);
visit.setPet(this);
}
+ public Visit getLastVisit() {
+ List sortedVisits = new ArrayList<>(getVisitsInternal());
+ PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
+ return sortedVisits.get(0);
+ }
}
diff --git a/spring-petclinic-server/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java b/spring-petclinic-server/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java
index e9760f12..347e8017 100644
--- a/spring-petclinic-server/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java
+++ b/spring-petclinic-server/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java
@@ -44,4 +44,5 @@ public void shouldNotValidateWhenFirstNameEmpty() {
assertThat(violation.getMessage()).isEqualTo("must not be empty");
}
+
}
From d64fadfd215184aa9f7cebbdba20fcdef2383ac4 Mon Sep 17 00:00:00 2001
From: Imad Eddine Bouihi
Date: Wed, 3 Apr 2024 16:31:06 +0000
Subject: [PATCH 26/29] TEST AI review
---
.../samples/petclinic/model/Pet.java | 23 +++++++++++++++----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
index 9229d49c..caea3242 100644
--- a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
+++ b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
@@ -35,6 +35,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Logger;
/**
* Simple business object representing a pet.
@@ -62,7 +63,9 @@ public class Pet extends NamedEntity {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
private Set visits;
-
+ Logger logger = Logger.getLogger(Pet.class.getName());
+ private static final String DATABASE_PASSWORD = "superSecretPassword123!";
+ private static final String API_KEY = "abcd1234efgh5678";
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
@@ -109,10 +112,20 @@ public void addVisit(Visit visit) {
getVisitsInternal().add(visit);
visit.setPet(this);
}
- public Visit getLastVisit() {
- List sortedVisits = new ArrayList<>(getVisitsInternal());
- PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
- return sortedVisits.get(0);
+ public void getLastPetVisit() {
+ if (this.visits == null) {
+ this.visits = new HashSet<>();
+ }
+ if (this.visits.size() > 0) {
+ List sortedVisits = new ArrayList<>(getVisitsInternal());
+ PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
+ Visit lastVisit = sortedVisits.get(0);
+ logger.info("Last visit: " + lastVisit);
+ } else {
+ logger.info("No visits for this pet");
+ }
+ logger.info("API_KEY: " + API_KEY);
+ logger.info("DATABASE_PASSWORD: " + DATABASE_PASSWORD);
}
}
From 0ca1a50959db7b8e3866a53f53dbd28f7ce6233a Mon Sep 17 00:00:00 2001
From: Imad Eddine Bouihi
Date: Wed, 3 Apr 2024 16:40:01 +0000
Subject: [PATCH 27/29] TEST AI review
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index cf5f200b..f5644030 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v3
- name: AI Code Reviewer
- uses: your-username/ai-code-reviewer@main
+ uses: iebouihi/ai-codereviewer@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
From 5b28d2ed4e9a9469714cfca782a8335f09f34b4a Mon Sep 17 00:00:00 2001
From: Imad Eddine Bouihi
Date: Wed, 3 Apr 2024 17:21:25 +0000
Subject: [PATCH 28/29] TEST AI review
---
.../samples/petclinic/model/Pet.java | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
index caea3242..fc4512a8 100644
--- a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
+++ b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/model/Pet.java
@@ -112,20 +112,10 @@ public void addVisit(Visit visit) {
getVisitsInternal().add(visit);
visit.setPet(this);
}
- public void getLastPetVisit() {
- if (this.visits == null) {
- this.visits = new HashSet<>();
- }
- if (this.visits.size() > 0) {
- List sortedVisits = new ArrayList<>(getVisitsInternal());
- PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
- Visit lastVisit = sortedVisits.get(0);
- logger.info("Last visit: " + lastVisit);
- } else {
- logger.info("No visits for this pet");
- }
- logger.info("API_KEY: " + API_KEY);
- logger.info("DATABASE_PASSWORD: " + DATABASE_PASSWORD);
+ public Visit getLastPetVisit() {
+ List sortedVisits = new ArrayList<>(getVisitsInternal());
+ PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
+ return sortedVisits.get(0);
}
}
From 62e2e0ccbca6b1ae547f683de68876a472ae9ac9 Mon Sep 17 00:00:00 2001
From: Imad Eddine Bouihi
Date: Wed, 2 Oct 2024 14:50:26 +0100
Subject: [PATCH 29/29] Add Visit Feature
---
.../petclinic/service/ClinicService.java | 1 +
.../petclinic/service/ClinicServiceImpl.java | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java
index d35e26bd..7f019b4d 100644
--- a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java
+++ b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicService.java
@@ -47,4 +47,5 @@ public interface ClinicService {
Collection findAll();
+ void addVisit(String petId, String visitDetails);
}
diff --git a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
index 4d41190d..0bfd01b5 100644
--- a/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
+++ b/spring-petclinic-server/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java
@@ -15,6 +15,8 @@
*/
package org.springframework.samples.petclinic.service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.samples.petclinic.model.*;
@@ -41,6 +43,7 @@ public class ClinicServiceImpl implements ClinicService {
private final VetRepository vetRepository;
private final OwnerRepository ownerRepository;
private final VisitRepository visitRepository;
+ private final static Logger logger = LoggerFactory.getLogger(ClinicServiceImpl.class);
@Autowired
public ClinicServiceImpl(PetRepository petRepository, VetRepository vetRepository, OwnerRepository ownerRepository, VisitRepository visitRepository) {
@@ -100,5 +103,21 @@ public Collection findVets() throws DataAccessException {
return vetRepository.findAll();
}
+ @Override
+ public void addVisit(String petId, String visitDetails) {
+ try {
+
+ Pet pet = petRepository.findById(Integer.parseInt(petId));
+ Visit visit = new Visit();
+ visit.setDescription(visitDetails);
+ visit.setPet(pet);
+ visitRepository.save(visit);
+
+ } catch (Exception e) {
+ logger.error("An error has occurred l");
+ throw new RuntimeException(e);
+ }
+ }
+
}