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

1044 java #4

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6032969
feat: add test files
May 30, 2024
9419960
feat: :construction: EC1024 skeleton
max-208 May 30, 2024
f790569
feat: add test class
May 30, 2024
2facdf2
Fix: fix class and file name
May 30, 2024
a916018
feat: :construction: WIP : create rule EC10044
max-208 May 30, 2024
3ad7732
Merge branch '1044-java' of github.com:max-208/ecoCode-java into 1044…
max-208 May 30, 2024
5a8eb15
fix: improve test
May 30, 2024
de78977
feat: :construction: WIP finish rule creation for EC1044 rule
max-208 May 30, 2024
756e40e
Merge branch '1044-java' of github.com:max-208/ecoCode-java into 1044…
max-208 May 30, 2024
c6eaa43
feat: :construction: WIP : create rule 1044
max-208 May 30, 2024
75196b8
feat: :sparkles: created rule 1044
max-208 May 30, 2024
ea027b0
Add test to ensure all Rules are registered
jycr May 30, 2024
e82572d
fix: :bug: improve false positives detection
max-208 Jun 10, 2024
759b8ad
refactor: :recycle: quick refactor
max-208 Jun 11, 2024
2b7f600
refactor: :recycle: fix formating
max-208 Jun 12, 2024
a6938a4
comment on TODO_DDC.md for docker port pb
dedece35 Jun 12, 2024
7bad352
Merge branch 'main' into feature/add-rule-declaration-test
dedece35 Jun 13, 2024
42006ef
add 10.6.0 SonarQube version + update docker port managment
dedece35 Jul 19, 2024
688cffc
[ISSUE 60] update compatibility to SonarQube 10.6.0
dedece35 Jul 21, 2024
0316bc3
upgrade ecocode-rules-spec to 1.6.2
dedece35 Jul 21, 2024
13aa2fa
prepare 1.6.2 : update CHANGELOG
dedece35 Jul 21, 2024
660711d
[maven-release-plugin] prepare release 1.6.2
dedece35 Jul 21, 2024
49b32fe
[maven-release-plugin] prepare for next development iteration
dedece35 Jul 21, 2024
7b1656a
Merge pull request #61 from green-code-initiative/release_1.6.2
dedece35 Jul 21, 2024
4b849b5
correction of docker env
dedece35 Jul 23, 2024
0c06478
Merge pull request #49 from green-code-initiative/feature/add-rule-de…
dedece35 Jul 26, 2024
688974f
[PR 49] Update CHANGELOG
dedece35 Jul 26, 2024
30b131f
remove executeUpdate
max-208 Aug 7, 2024
647df32
add some comments
max-208 Aug 7, 2024
50259b0
small refactor and add comments
max-208 Aug 19, 2024
3cfaf87
Merge branch 'main' into 1044-java
max-208 Aug 19, 2024
753cdc2
[ecoCode#336] Adds Maven Wrapper
jycr Sep 1, 2024
b1abd7b
Migrates scripts to use Maven Wrapper (to ensure consistency of Maven…
jycr Sep 1, 2024
3a58257
feat: Adds "ecoCode way" profile.
jycr May 30, 2024
2329fd8
Merge pull request #67 from green-code-initiative/feature/maven-wrapper
jycr Sep 6, 2024
cf2e612
Merge pull request #59 from green-code-initiative/feature/ecocode-bui…
jycr Sep 6, 2024
55781ac
update CHANGELOG
dedece35 Sep 6, 2024
1fc5855
Merge branch 'main' into 1044-java
dedece35 Sep 6, 2024
d0fe4d2
Add rule to registrar and correct ID
max-208 Sep 9, 2024
0e76371
Improve test names and add select * case
max-208 Sep 9, 2024
b8a7654
improve ResultSet get method detection
max-208 Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .default.docker.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set default Sonarqube environment variables used by docker-compose
# You can override these envvars by creating a '.override.docker.env' file
# For available envvars list, see https://docs.sonarsource.com/sonarqube/latest/setup-and-upgrade/configure-and-operate-a-server/environment-variables/

SONAR_LOG_LEVEL_WEB=INFO
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@

# Ensure BAT files will always be checked out with CRLFs (regardless of the
# OS they were checked out on).
*.bat text eol=crlf
*.bat text eol=crlf

# Ensure BAT files will always be checked out with CRLFs (regardless of the
# OS they were checked out on).
*.cmd text eol=crlf
6 changes: 3 additions & 3 deletions .github/workflows/_BACKUP_manual_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
git config user.name 'github-actions[bot]'
git config user.email ''
- name: Maven release
run: mvn release:prepare -B -ff -DtagNameFormat=@{project.version}
run: ./mvnw release:prepare -B -ff -DtagNameFormat=@{project.version}
- name: Maven release clean
run: mvn release:clean
run: ./mvnw release:clean
- name: Get last TAG
run: echo "LAST_TAG=$(git tag --sort=-version:refname | head -n 1)" >> $GITHUB_ENV
- name: Extract release notes
Expand All @@ -44,7 +44,7 @@ jobs:
with:
ref: ${{ env.LAST_TAG }}
- name: Build project
run: mvn -e -B clean package -DskipTests
run: ./mvnw -e -B clean package -DskipTests
- name: Create release
id: create_release
uses: actions/create-release@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Verify
run: mvn -e -B verify
run: ./mvnw -e -B verify

- name: Set up JDK 17
uses: actions/setup-java@v3
Expand All @@ -57,4 +57,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -e -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecoCode-java
run: ./mvnw -e -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecoCode-java
2 changes: 1 addition & 1 deletion .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Build project
run: mvn -e -B clean package -DskipTests
run: ./mvnw -e -B clean package -DskipTests
- name: Create release
id: create_release
uses: actions/create-release@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Ignore all files and folders starting with ".", except a few exceptions
.*
!.mvn/
!.gitignore
!.gitattributes
!.github/
Expand Down
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [#59](https://github.com/green-code-initiative/ecoCode-java/pull/59) Add builtin profile `ecoCode way` to aggregate all implemented ecoCode rules by this plugin

### Changed

- [#49](https://github.com/green-code-initiative/ecoCode-java/pull/49) Add test to ensure all Rules are registered
- [#336](https://github.com/green-code-initiative/ecoCode/issues/336) [Adds Maven Wrapper](https://github.com/green-code-initiative/ecoCode-java/pull/67)

### Deleted

## [1.6.2] - 2024-07-21

### Changed

- [#60](https://github.com/green-code-initiative/ecoCode-java/issues/60) Check + update for SonarQube 10.6.0 compatibility
- refactoring docker system
- upgrade ecocode-rules-specifications to 1.6.2

## [1.6.1] - 2024-05-15

### Changed
Expand Down
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
FROM maven:3-openjdk-11-slim AS builder
ARG MAVEN_BUILDER=3-openjdk-17-slim
ARG SONARQUBE_VERSION=10.6.0-community

FROM maven:${MAVEN_BUILDER} AS builder

COPY . /usr/src/ecocode

WORKDIR /usr/src/ecocode
COPY src src/
COPY pom.xml tool_build.sh ./

RUN ./tool_build.sh

FROM sonarqube:10.5.1-community
FROM sonarqube:${SONARQUBE_VERSION}
COPY --from=builder /usr/src/ecocode/target/ecocode-*.jar /opt/sonarqube/extensions/plugins/
USER sonarqube
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Ready to use binaries are available [from GitHub](https://github.com/green-code-

| Plugin version | SonarQube version | Java version |
|----------------|---------------------|--------------|
| 1.5.+ | 9.4.+ LTS to 10.5.1 | 11 / 17 |
| 1.6.+ | 9.4.+ LTS to 10.6.0 | 11 / 17 |

> Compatibility table of versions lower than 1.4.+ are available from the
> main [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-plugins-version-compatibility).
Expand Down
3 changes: 2 additions & 1 deletion _TODOs_DDC.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- check usefulness
- upgrade versions
- enable github `dependabot` to create automatically PR with version upgrades of dependencides (when all dependencies will be ok)
- ménage dans les branches de dev (local et remote)
- ménage dans les branches de dev (local et remote)
- docker-compose : ":9000" (génération port aléatoire pour l'IHM + repérage pour IHM) au lieu de "9000:9000" si erreur lors du démarrage "Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:9000 -> 0.0.0.0:0: listen tcp 0.0.0.0:9000: bind: address already in use"
23 changes: 16 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
version: "3.3"
name: sonarqube_ecocode_java

services:
sonar:
image: sonarqube:10.5.1-community
build: .
container_name: sonar_ecocode_java
ports:
- "9000:9000"
- ":9000"
networks:
- sonarnet
depends_on:
- db
db:
condition: service_healthy
environment:
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonarqube
SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: 'true'
env_file:
- path: ./.default.docker.env
required: true
- path: ./.override.docker.env
required: false
volumes:
- type: bind
source: ./target/ecocode-java-plugin-1.6.2-SNAPSHOT.jar
target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.6.2-SNAPSHOT.jar
- "extensions:/opt/sonarqube/extensions"
- "logs:/opt/sonarqube/logs"
- "data:/opt/sonarqube/data"
Expand All @@ -34,6 +38,11 @@ services:
POSTGRES_PASSWORD: sonar
POSTGRES_DB: sonarqube
PGDATA: pg_data:/var/lib/postgresql/data/pgdata
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U sonar -d sonarqube" ]
interval: 5s
timeout: 5s
retries: 5

networks:
sonarnet:
Expand Down
Loading