Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion android-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<dependency>
<groupId>org.codenarc</groupId>
<artifactId>CodeNarc</artifactId>
<version>2.2.5</version>
<version>3.5.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* Checks the call of "set", "setAlarmClock", "setExact", "setInexactRepeating", "setRepeating" & "setWindow" from "android.app.AlarmManager".
* Checks also the call of "onPerformSync" & "getSyncAdapterBinder" from "android.content.AbstractThreadedSyncAdapter".
*/
@Rule(key = "EC501")
@Rule(key = "GCI501")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC501")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EBAT003")
public class JobCoalesceRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
* Check the call of the method "registerListener" of "android.hardware.SensorManager" with 4 parameters (the 4th one being the latency).
* If it isn't present, report issue.
*/
@Rule(key = "EC500")
@Rule(key = "GCI500")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC500")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EBAT002")
public class SensorCoalesceRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* Check if the method openConnection of the Url class is called inside a loop.
* Not thrown if openConnection() call is deported into an other method.
*/
@Rule(key = "EC502")
@Rule(key = "GCI502")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC502")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EBOT001")
public class InternetInTheLoopRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
* - if the method getOutputStream from the URLConnection class is called, reports the issue.
* - if a constructor is called with for parameter getOutputStream, reports the issue if the constructor isn't a GZIPOutputStream.
*/
@Rule(key = "EC504")
@Rule(key = "GCI504")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC504")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EBOT003")
public class UncompressedDataTransmissionRule extends IssuableSubscriptionVisitor {
private static final Logger LOG = Loggers.get(UncompressedDataTransmissionRule.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* @see OpeningClosingMethodCheck
*/
@Rule(key = "EC503")
@Rule(key = "GCI503")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC503")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EBOT002")
public class WifiMulticastLockRule extends OpeningClosingMethodCheck {
private static final String ERROR_MESSAGE = "Failing to call WifiManager.MulticastLock#release() can cause a noticeable battery drain.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* Check the call of the method "setRenderMode" of "opengl.GLSurfaceView".
* If argument value is "1" report issue.
*/
@Rule(key = "EC510")
@Rule(key = "GCI510")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC510")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL008")
public class ContinuousRenderingRule extends FlagOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* Check the call of the method "acquire" of "android.os.PowerManager$WakeLock".
* Reports an issue if found without any parameters.
*/
@Rule(key = "EC508")
@Rule(key = "GCI508")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC508")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL006")
public class DurableWakeLockRule extends IssuableSubscriptionVisitor {
private String methodOwnerType = "android.os.PowerManager$WakeLock";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* Check the call of the method "newWakeLock" of "android.os.PowerManager".
* Reports an issue if found.
*/
@Rule(key = "EC507")
@Rule(key = "GCI507")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC507")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL004")
public class KeepCpuOnRule extends SpecificMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
/**
* Check the call of "FLAG_KEEP_SCREEN_ON" on the method "addFlags" of "android.view.Window".
*/
@Rule(key = "EC505")
@Rule(key = "GCI505")
@DeprecatedRuleKey(repositoryKey = "ecoCode-android-java", ruleKey = "EC505")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL001")
public class KeepScreenOnAddFlagsRule extends FlagOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
/**
* Check the call of "FLAG_KEEP_SCREEN_ON" on the method "setFlags" (both parameters) of "android.view.Window".
*/
@Rule(key = "EC506")
@Rule(key = "GCI506")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC506")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL002")
public class KeepScreenOnSetFlagsRule extends FlagOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
* If the argument 0 of the method is true, report the method node.
* Otherwise report an issue on the new class nodes.
*/
@Rule(key = "EC511")
@Rule(key = "GCI511")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC511")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL009")
public class KeepVoiceAwakeRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
/**
* Check the call of the method "setExact" And "setExactAndAllowWhileIdle" and "setRepeating" of "android.app.AlarmManager".
*/
@Rule(key = "EC509")
@Rule(key = "GCI509")
@DeprecatedRuleKey(repositoryKey = "ecoCode-android-java", ruleKey = "EC509")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EIDL007")
public class RigidAlarmRule extends SpecificMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* @see OpeningClosingMethodCheck
*/
@Rule(key = "EC512")
@Rule(key = "GCI512")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC512")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ELEA002")
public class CameraLeakRule extends OpeningClosingMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* @see OpeningClosingMethodCheck
*/
@Rule(key = "EC513")
@Rule(key = "GCI513")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC513")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ELEA003")
public class LocationLeakRule extends OpeningClosingMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* @see ConstructorBeforeMethodCheck
*/
@Rule(key = "EC516")
@Rule(key = "GCI516")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC516")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ELEA006")
public class MediaLeakMediaPlayerRule extends ConstructorBeforeMethodCheck {
private static final String ERROR_MESSAGE = "Failing to call release() on a Media Player may lead to continuous battery consumption.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* @see ConstructorBeforeMethodCheck
*/
@Rule(key = "EC515")
@Rule(key = "GCI515")
@DeprecatedRuleKey(repositoryKey = "ecoCode-android-java", ruleKey = "EC515")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ELEA005")
public class MediaLeakMediaRecorderRule extends ConstructorBeforeMethodCheck {
private static final String ERROR_MESSAGE = "Failing to call release() on a Media Recorder may lead to continuous battery consumption.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
*
* @see OpeningClosingMethodCheck
*/
@Rule(key = "EC514")
@Rule(key = "GCI514")
@DeprecatedRuleKey(repositoryKey = "ecoCode-android-java", ruleKey = "EC514")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ELEA004")
public class SensorManagerLeakRule extends OpeningClosingMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
* </li>
* </ul>
*/
@Rule(key = "EC518")
@Rule(key = "GCI518")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC518")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EOPT002")
public class BluetoothLowEnergyRule extends BaseTreeVisitor implements JavaFileScanner {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
* <li>If the first import is found but not the second, report an issue.</li>
* </ul>`
*/
@Rule(key = "EC517")
@Rule(key = "GCI517")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC517")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EOPT001")
public class FusedLocationRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
* android.intent.action.ACTION_POWER_CONNECTED`, `android.intent.action.BATTERY_LOW` or
* android.intent.action.BATTERY_OKAY` reports a (positive) issue.
*/
@Rule(key = "EC519")
@Rule(key = "GCI519")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC519")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EPOW004")
public class ChargeAwarenessRule extends IssuableSubscriptionVisitor {
private static final Logger LOG = Loggers.get(ChargeAwarenessRule.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
/**
* Checks the use of the BATTERY_CHANGED propriety in intentFilter or the use of the isPowerSaveMode() method
*/
@Rule(key = "EC520")
@Rule(key = "GCI520")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC520")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "EPOW006")
public class SaveModeAwarenessRule extends IssuableSubscriptionVisitor {
private static final Logger LOG = Loggers.get(SaveModeAwarenessRule.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
* Check the assignment of the variable android.view.WindowManager$LayoutParams.screenBrightness with the value
* "BRIGHTNESS_OVERRIDE_FULL" (1.0f).
*/
@Rule(key = "EC522")
@Rule(key = "GCI522")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC522")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB002")
public class BrightnessOverrideRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import java.util.List;
import java.util.Optional;

@Rule(key = "EC531")
@Rule(key = "GCI531")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC531")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB014")
public class HighFrameRateRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* On the method `android.bluetooth.BluetoothGatt#requestConnectionPriority(int)`, reports an issue if
* it is called with a parameter value different from `CONNECTION_PRIORITY_LOW_POWER (2)`.
*/
@Rule(key = "EC526")
@Rule(key = "GCI526")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC526")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB008")
public class ThriftyBluetoothLowEnergyRequestConnectionPriorityRule extends ConstantOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* On the method `android.bluetooth.le.AdvertiseSettings$Builder#setAdvertiseMode(int)`, report an issue if
* it is called with parameter value different from `ADVERTISE_MODE_LOW_POWER (0)`.
*/
@Rule(key = "EC525")
@Rule(key = "GCI525")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC525")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB007")
public class ThriftyBluetoothLowEnergySetAdvertiseModeRule extends ConstantOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
* * **Case 3**:
* - if the method `setPowerRequirement` of type `android.location.Criteria` is called report an issue on its first argument if it's not `1`.
*/
@Rule(key = "EC524")
@Rule(key = "GCI524")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC524")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB006")
public class ThriftyGeolocationCriteriaRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
* Check if a method requestLocationUpdates is called from android.location.LocationManager package.
* If minDistance argument value is 0, report an issue on the argument.
*/
@Rule(key = "EC527")
@Rule(key = "GCI527")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC527")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB010")
public class ThriftyGeolocationMinDistanceRule extends IssuableSubscriptionVisitor {
private static final String ERROR_MESSAGE = "Location updates should be done with a distance interval greater than 0.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
* Check if a method requestLocationUpdates is called from android.location.LocationManager package.
* If minTime argument value is 0, report an issue on the argument.
*/
@Rule(key = "EC523")
@Rule(key = "GCI523")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC523")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB005")
public class ThriftyGeolocationMinTimeRule extends IssuableSubscriptionVisitor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
/**
* Check the call of "TYPE_ROTATION_VECTOR" on the method "getDefaultSensor" of "android.hardware.SensorManager".
*/
@Rule(key = "EC521")
@Rule(key = "GCI521")
@DeprecatedRuleKey(repositoryKey = "ecoCode-android-java", ruleKey = "EC521")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB001")
public class ThriftyMotionSensorRule extends FlagOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
/**
* Check the call of "setSound", "setVibrate" & "setVibrationPattern" of "android.app.NotificationChannel" & "android.app.Notification$Builder".
*/
@Rule(key = "EC529")
@Rule(key = "GCI529")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC529")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB012")
public class ThriftyNotificationRule extends IssuableSubscriptionVisitor {
private static final String ERROR_MESSAGE = "Avoid using vibration or sound when notifying the users to use less energy.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
* Check the call of the method "setTorchMode" from "android.hardware.camera2.CameraManager"
* with the param 1 set to "true".
*/
@Rule(key = "EC530")
@Rule(key = "GCI530")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC530")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB013")
public class TorchFreeRule extends ArgumentValueOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

import java.util.Optional;

@Rule(key = "EC528")
@Rule(key = "GCI528")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC528")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "ESOB011")
public class VibrationFreeRule extends ArgumentValueOnMethodCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
* practice should be discouraged at early stage.
*/

@Rule(key = "EC532")
@Rule(key = "GCI532")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-java", ruleKey = "EC532")
@DeprecatedRuleKey(repositoryKey = "ecoCode-java", ruleKey = "SPRI002")
public class GoogleTrackerRule extends BaseTreeVisitor implements JavaFileScanner {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
/**
* Checks manifest intent-filter statement: if the action is BOOT_COMPLETED, report a bad practice
*/
@Rule(key = "EC540")
@Rule(key = "GCI540")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-xml", ruleKey = "EC540")
@DeprecatedRuleKey(repositoryKey = "ecoCode-xml", ruleKey = "EBAT001")
public class ServiceBootTimeXmlRule extends XPathSimpleCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* Checks manifest uses-permissions statement.
* if the permissions "android.permission.WAKE_LOCK" is found, report an issue.
*/
@Rule(key = "EC542")
@Rule(key = "GCI542")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-xml", ruleKey = "EC542")
@DeprecatedRuleKey(repositoryKey = "ecoCode-xml", ruleKey = "EIDL005")
public class KeepCpuOnXmlRule extends CheckPermissionsRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
import org.sonar.check.Rule;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "EC541")
@Rule(key = "GCI541")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-xml", ruleKey = "EC541")
@DeprecatedRuleKey(repositoryKey = "ecoCode-xml", ruleKey = "EIDL003")
public class KeepScreenOnXmlRule extends XPathSimpleCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* Checks manifest intent-filter statement: if the action is ACTION_POWER_CONNECTED, ACTION_POWER_DISCONNECTED,
* BATTERY_OKAY or BATTERY_LOW report a good practice.
*/
@Rule(key = "EC545")
@Rule(key = "GCI545")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-xml", ruleKey = "EC545")
@DeprecatedRuleKey(repositoryKey = "ecoCode-xml", ruleKey = "EPOW005")
public class ChargeAwarenessXmlRule extends XPathSimpleCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* Checks manifest uses-permissions statement:
* if the permission "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND" is found, report an issue.
*/
@Rule(key = "EC543")
@Rule(key = "GCI543")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-xml", ruleKey = "EC543")
@DeprecatedRuleKey(repositoryKey = "ecoCode-xml", ruleKey = "EPOW002")
public class CompagnionInBackgroundXmlRule extends CheckPermissionsRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* Checks manifest uses-permissions statement:
* if the permission "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" is found, report an issue.
*/
@Rule(key = "EC544")
@Rule(key = "GCI544")
@DeprecatedRuleKey(repositoryKey = "ecocode-android-xml", ruleKey = "EC544")
@DeprecatedRuleKey(repositoryKey = "ecoCode-xml", ruleKey = "EPOW003")
public class IgnoreBatteryOptimizationsXmlRule extends CheckPermissionsRule {

Expand Down
Loading
Loading