green-code-initiative / ecocode-java-test-project Goto Github PK
View Code? Open in Web Editor NEWJava project to test the java plugin of ecoCode.
License: GNU General Public License v3.0
Java project to test the java plugin of ecoCode.
License: GNU General Public License v3.0
Hi,
when I first tried to run an analysis on the project, I've got an error : You're not authorized to run analysis. Please contact the project administrator. I thought the problem came from the token in the script tool_send_to_sonar.sh
but I changed it and use the good one.
In fact, I had to add -Dsonar.projectKey=ecocode
in the script since my project name on Sonar was "ecocode".
I think you should indicate in the readme or in the script the project key we have to use when configurating the project or how we can add it in the script.
Regards.
The readme file refers to a script not present in this repository : ./tool_build.sh
This file in under the ecocode-common repository, that is confusing
Hi,
For people that are not used to the ecoCode project, I think you should indicate somewhere how to configure the test project on Sonar to test the good set of rules. Since there is no "ecoCode" profiles in Java, maybe you should explain how to create the profile with the good rules. In my case to test, I create an ecoCode profile from scratch with all the rules tagged eco-conception
.
Regards
Hi,
I think you should add more information in comments where issues are thrown. I will set an example:
The line 58 triggers a rule, not related with the rule the file is supposed to test but, well, it is here. I think you should indicate in this case that an issue should be found at that line.
On the line 62, on the same idea, I think you should indicate in the comment the rule that we expect here, to be sure it is the good one that is detected.
Regards.
I try to build the project before any changes and I get errors. Do I have to compile it in a specific environment?
$ ./tool_build.sh
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.21, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-91-generic", arch: "amd64", family: "unix"
[INFO] 12 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.381 s
[INFO] Finished at: 2024-01-18T17:24:38+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ecocode-java-plugin-test-project: Compilation failure: Compilation failure:
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[58,22] method map in interface java.util.stream.Stream<T> cannot be applied to given types;
[ERROR] required: java.util.function.Function<? super java.lang.Integer,? extends R>
[ERROR] found: (id)->{ Op[...]; } }
[ERROR] reason: cannot infer type-variable(s) R
[ERROR] (argument mismatch; bad return type in lambda expression
[ERROR] missing return value)
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[76,17] incompatible types: inference variable T has incompatible bounds
[ERROR] equality constraints: fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee
[ERROR] lower bounds: java.lang.Integer
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[84,37] constructor Employee in class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee cannot be applied to given types;
[ERROR] required: java.lang.Integer,java.lang.String
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[94,37] constructor Employee in class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee cannot be applied to given types;
[ERROR] required: java.lang.Integer,java.lang.String
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[95,21] cannot find symbol
[ERROR] symbol: variable employees
[ERROR] location: class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[98,25] incompatible types: inference variable T has incompatible bounds
[ERROR] equality constraints: fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee
[ERROR] lower bounds: java.util.Optional<fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee>
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[108,37] constructor Employee in class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee cannot be applied to given types;
[ERROR] required: java.lang.Integer,java.lang.String
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[109,21] cannot find symbol
[ERROR] symbol: variable employees
[ERROR] location: class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[107,26] incompatible types: inference variable R has incompatible bounds
[ERROR] lower bounds: java.lang.Object
[ERROR] lower bounds: void
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[118,37] constructor Employee in class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee cannot be applied to given types;
[ERROR] required: java.lang.Integer,java.lang.String
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[119,77] cannot find symbol
[ERROR] symbol: method anotherMethod()
[ERROR] location: class fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee
[ERROR] /home/intm/work/sncf/tickets/213/ecoCode-java-test-project/src/main/java/fr/greencodeinitiative/java/checks/AvoidSpringRepositoryCallInStreamCheck.java:[121,25] incompatible types: inference variable T has incompatible bounds
[ERROR] equality constraints: fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInStreamCheck.Employee
[ERROR] lower bounds: java.lang.Object
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.