Skip to content

Reduce the environmental footprint of your Swift-based iOS apps with SonarQube

License

Notifications You must be signed in to change notification settings

green-code-initiative/ecoCode-ios

Repository files navigation

Logo

Mobile apps running on top of battery-limited devices are more than others concerned by the reduction of their environmental footprint. Hence, we created ecoCode iOS, the version of ecoCode project fully dedicated to the iOS platform. It provides static code analyzers to highlight code structures that may have a negative ecological impact: energy over-consumption, "fatware", shortening devices' lifespan, etc.

ecoCode iOS is based on evolving catalogs of best practices for iOS. A SonarQube plugin then implements these catalogs as rules for scanning your projects.

License: GPL v3 Build

Technical Debt Coverage Maintainability Rating Reliability Rating Security Rating

🌿 SonarQube Plugin

ecoCode iOS SonarQube plugin is an "eco-responsibility" static code analyzer for iOS projects written in Swift. Its aim is to detect code smells indicating how the source code can be improved to reduce their environmental and social impact.

🛒 Distribution

Ready to use binaries are available from GitHub.

NB: To work, ecocode-ios needs Swift language support in SonarQube. For SonarQube Community Edition (which does not support Swift language), you need to install an additional plugin like sonar-apple.

By default ecoCode profile is not activated. To activate ecoCode rules in SonarQube, create a new profile (or extend an existing one) where ecoCode rules are activated. Here is an example:

Profiles

🚀 Development Quickstart

Requirements

  • Java JDK 11+
  • Maven 3.8 or later
  • A local SonarQube instance for local testing

Compile

./tool_compile.sh

Run (with Docker)

This implies to have a machine ready to run containerized applications. Please refer to Docker documentation: https://www.docker.com/.

# build Jar files for application
./tool_build.sh

# clean docker environment
./tool_docker-clean.sh

# initialize docker environment
./tool_docker-init.sh

# display logs from docker environment
./tool_docker-logs.sh

The tests instance of SonarQube with the plugin will then be available at: http://localhost:9000. Default credentials are admin/admin

Test

An iOS test project is available here/

🤝 Partners

Snapp’ Université de Pau Région Nouvelle-Aquitaine Solocal / PagesJaunes inside|app

🧩 Plugins version compatibility

Plugins Version SonarQube version
1.1.+ SonarQube 9.4.+ LTS to 10.0

🛠️ Contributing

If you want to contribute to the project, your help will be greatly appreciated.

Start right away by reading General contribution guide and the iOS specific contribution guide.