-
Notifications
You must be signed in to change notification settings - Fork 19
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
iOS plugin #5
iOS plugin #5
Conversation
src/ios-plugin/swift-lang/src/main/java/io/ecocode/swift/antlr/ParseTreeAnalyzer.java
Outdated
Show resolved
Hide resolved
...ugin/swift-lang/src/main/java/io/ecocode/swift/antlr/generated/Swift5ParserBaseListener.java
Outdated
Show resolved
Hide resolved
Hi @zippy1978, I'm not expert in ios development but I've worked with java and maven since many years. If you want to discuss about my comments on Slack appointment, no problem. It will be a pleasure to talk to you. Hi @julien-hertout-neomades, @jhertout, |
Hi @dedece35, If possible, I will be interested to join the Slack as well ! |
hi @zippy1978 |
Relies on parent pom version for now. But should probably be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with migration of SonarQube from 9.3 to 9.8, some source code must change ...
please check PR #13 on current repo
…that it works the same locally and from GH action)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zippy1978,
all is almost good.
please see the few remaining comments .
This comment was marked as resolved.
This comment was marked as resolved.
@jhertout @dedece35 , And also addressed the requested changes. For the license header in files: I used this maven plugin (I used it on previous projects) : https://mycila.carbou.me/license-maven-plugin |
* SonarQube Apple Plugin - Enables analysis of Swift and Objective-C projects into SonarQube. | ||
* Copyright © 2022 inside|app (contact@insideapp.fr) | ||
* ecoCode iOS plugin - Help the earth, adopt this green plugin for your applications | ||
* Copyright © 2022 CNumR (https://www.ecocode.io/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not CNumR but Green Code Initiative (same review note in all files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Actually the header is generated automatically from pom data.
In parent pom.xml organization is still CNumR.
I will update it.
Also url is still https://collectif.greenit.fr, should I change it as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a dedicated PR for this. We will change it later.
@@ -145,6 +145,35 @@ | |||
</executions> | |||
</plugin> | |||
|
|||
<plugin> | |||
<groupId>com.mycila</groupId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe discuss about it during weekly meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zippy1978,
Thanks for the update. I had be able to install and test the plugin. I have some last (I hope :)) remarks:
- In the docker-compose in the ios-plugin folder, can you remove the line "- "extensions:/opt/sonarqube/extensions". It does not work with it. It was a patch we did for a deployment in our Snapp' gitlab at the begining of the project. It is not required anymore.
- There is no "tags" in your rule description file. Can you add "ecocode, environment, idleness" as tags for the rule?
- Can you be a little more complete in the rule detail description: add why the rule is a bad practice by explaining what the original call does and why it is energy consuming. You can add the code "compliant" and "not compliant" samples too (only bad if necessary).
- I create a swift project to test the plugin (its aim is to have all the issues in a swift project and to see if they are detected by the plugin): https://github.com/green-code-initiative/ecoCode-mobile-ios-swift-test-project. When I perform an analyse using the sonar-scanner (see project readme), the analyse succeeds and the plugin works but I have exceptions during the scanner work:
Do you have an idea of what the problem is?
I notice that the ios-plugin deployment does not work with the "global" docker-file but we will fix it later. It is not important if the project works only in the "ios-plugin environment" for the moment.
Thanks
Regarding the stacktrace: it is not related to the ecoCode plugin but to the Swift lang support plugin (that is required) and that we have been developing at inside|app here: https://github.com/insideapp-oss/sonar-apple. So we did some investigation, and it is probably caused by a mix in line ending chars in the source files. On Windows this feature is called "autocrlf". This problem is SonarQube related (not specific / not related to specific plugin) and can happen with any language (see https://stackoverflow.com/questions/43997878/sonarqube-c-sharp-analysis-fails-to-not-a-valid-line-offset-for-pointer) Note that the issue does not appear on macOS and Linux (using your test project + running SonarQube in docker-compose). Could you double check the line ending chars on your test project sources ? |
Kudos, SonarCloud Quality Gate passed! |
Hi @jhertout, I addressed all the points you mentioned above. The rule now looks like: |
Hello @zippy1978 , it seems ok for me. I don't remember if I answer you relating the stacktrace I sent to you but you were right. The problem was that I work on Windows and my EOL was changed by git. Thanks |
Description
This PR added support to iOS mobile apps (with Swift language support).
In order to work, the plugin needs to be installed alongside a plugin supporting Swift as a language such as sonar-apple (open source) or the commercial version from SonarSource.
This initial version comes with a single rule, but lays the groundwork for implementing (many !) more.
A basic CONTRIBUTION.md explains how to add new rules.
initial PR (before migration): cnumr/ecoCode#146
(plop @zippy1978 )