aboutsummaryrefslogtreecommitdiffstats
path: root/lint/cli/src/test/java/com/android
Commit message (Collapse)AuthorAgeFilesLines
* SDK: Delete projects moved to tools/base or tools/swt.Raphael Moll2013-03-13574-21930/+0
| | | | Change-Id: Iba15f82cb00d19217382c78d8ff37dda1e97ea59
* Fix API check via support libraryTor Norbye2013-01-284-0/+38
| | | | | | | | | | | | | This CL fixes the API check such that it properly handles calls in the Android support library (android.support.*). There was an optimization to skip looking up inherited API calls once the API checker reaches the android.* namespace, since at that point all the inherited methods are inlined in the database, but this should not be done if the package starts with android.support.*, since those methods still could be inheriting from the Android APIs without appearing in the database. Change-Id: Iab7b9f98daa5507794a0673a8db53ce953f2bcd9
* Merge "Add new lint Checks for manifest typos."Tor Norbye2013-01-2310-0/+436
|\
| * Add new lint Checks for manifest typos.Keiji Ariyama2013-01-2310-0/+436
| | | | | | | | | | | | | | | | | | Check <use-sdk> instead of <uses-sdk> Check <user-permission> instead of <uses-permission> Check <use-feature> instead of <uses-feature> Check <user-library> instead of <uses-library> Change-Id: I60ea44d7d6d8860b8987998a03c128523e8ba082
* | Lint bug fixesTor Norbye2013-01-226-0/+82
|/ | | | | | | | | | | | | | | | | | | | | | | This CL contains a number of unrelated lint bug fixes: * Fix API detector such that it warns about ?android:name attrs * Fix API detector for inlined constants such that it's more rigorous in how it determines whether a constant is used in a valid (if conditional or case value) context * Fix 43070: Analytics resources should not be flagged as needing translations * Fix 42994: Android lint should not complain about 'Custom view is missing constructor used by tools' for classes that are declared abstract * Finally, pass in the right node context for a few places it was missing it (when missing, adding suppress annotations only works on the root class AST node) Change-Id: I044140c865dbd3d0e964dae7f13c66eeb450509e
* 42798: lint miscounts String.format()Tor Norbye2013-01-153-0/+43
| | | | Change-Id: Ibd997301864981ceb863a30b36034a784ab13392
* 27869: Don't require a LinearLayout orientation when style is setTor Norbye2013-01-141-0/+16
| | | | Change-Id: I783e001fe84d825e116c6b2a882bcf2d22c61884
* Fix commit transation detectorTor Norbye2013-01-143-23/+55
| | | | | | | | | | | | | | | | | | | | | First, fix the error message; it was sharing code with the recycle detector and accidentally mentioned recycle rather than commit in the error message. Second, fix a bug where it would fail to find committed transactions if the commit() was reached through setter chaining (where each setter returns this). Also, remove checking for recycling of Message objects; according to the following thread it looks unnecessary: https://groups.google.com/forum/?fromgroups=#!\ topic/android-developers/9pHuc7lGunY Finally, the unit test class had the wrong name (was not moved when the recycle detector was generalized to handle other types of cleanup.) Change-Id: I80f4bf65acf304660c8a7e7a5b9e1b4f932e25c0
* 42565: Lint reports Analytics resource as unusedTor Norbye2013-01-141-0/+11
| | | | Change-Id: I27f5714539f1d28efc6ace1b9c9918fbd5f47825
* 42661: Split API check constant warnings into a separate issueTor Norbye2013-01-144-40/+71
| | | | | | | | | The issue has severity warning instead of error. Also, deliberately filter out constants which moved to a base class. Change-Id: I4976c421aa589cdb0a673c2d49bcafdd80ff005e
* Api Detector: Flag style definitionsTor Norbye2013-01-143-0/+67
| | | | | | | This should help track down problems like https://github.com/JakeWharton/ActionBarSherlock/issues/446 Change-Id: I5ed721189fcdd1090b2dfd5f64d2222e223aa4c5
* Make resource folders customizeableTor Norbye2013-01-041-1/+77
| | | | | | | | | | | | | | | | Until now, lint has hardcoded where the project resources are to be found: in $project/res. With the new build system this will no longer necessarily be the case; there can be multiple resource folders, and the locations might not be just res/. Therefore, this CL generalizes lint's handling of resource folders: it is now provided by the LintClient, and the command line lint tool uses this to offer a new --resources flag which can be used to set the resource directory/directories for a project. Change-Id: I3717c6474141776ee5541d476f9bad5bb8e1a9c7
* Merge "27869: Lint rule for LinearLayout which doesn't specify orientation"Tor Norbye2013-01-031-4/+4
|\
| * 27869: Lint rule for LinearLayout which doesn't specify orientationTor Norbye2013-01-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a check for cases where you have a LinearLayout which does not specify an orientation (meaning it's horizontal), yet it contains multiple children, and one of the children prior to the last one sets its width to fill_parent or match_parent (without a weight). This is a common pitfall for new developers who create the layout and assume it's vertical, and at runtime only see the first child, not realizing the remainder are off screen to the right. Change-Id: Ief9604d8a8fc84849d1a8f2df6d7ec0b75b13eaa
* | Code cleanupTor Norbye2013-01-025-11/+25
|/ | | | | | | | Fix typos, remove redundant semicolons, fix incorrect names (using an m prefix where they should be using s, turn fields with constant names into actual constants), etc. Change-Id: I44a5ab82c1158007d0803d43ce14b361aff240b8
* Update fragment issue from warning to errorTor Norbye2013-01-022-8/+24
| | | | | | Also update constants to stay in sync with sdk/ version. Change-Id: I8e454a03d83c81036bf8cc73609babc96a9c7739
* 42173: New Lint Check: <Fragment> instead of <fragment>Tor Norbye2013-01-022-0/+70
| | | | Change-Id: I33f3284368a9dd199b2cd70c023d6a22f2426c00
* 42169: New Lint Check: ACQUIRE_CAUSES_WAKEUP with PARTIAL_WAKE_LOCKTor Norbye2013-01-023-0/+33
| | | | Change-Id: I55ec4385e782ec8d5eff80b2206a0bcfe755201a
* 41753: Lint API Check: Consult source files for constantsTor Norbye2013-01-025-10/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lint currently checks the .class files for field references and method references to APIs that require a version higher than the minSdkVersion in the manifest. However, constants (such as final static integers) will be copied into the .class file, so there is no reference to the original API and its API version, which means lint can't flag these. In some cases, such as referencing LayoutParams.MATCH_PARENT, that's no problem; the constant value works on older versions, and there is no problem, since the value rather than the reference is used. However, in other cases this may lead to runtime crashes. This CL updates lint to look at the source files and flag field references. It excludes some constants that are known to be okay (such as referencing say android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 (which is typically done precisely to conditionally branch based on the current device's version). It also ignores usages as case constants or in conditional if checks. We may need to do additional tweaks to this in the future, since unlike method and field references there are probably many cases where referencing these constants are fine on older devices, but there are also cases where it's dangerous. For now, we're erring on the side of warning the developer rather than being certain that it's not a problem. Change-Id: Ieba4c15d7fdda02756b7b7f5a1b79f7698c1915b
* Remove ExportedActivity checkJon Larimer2012-12-271-52/+0
| | | | Change-Id: I428628956c7790b5206d83310211411c4ea54c68
* Prevent circular dependencies in library project dependenciesTor Norbye2012-12-212-4/+77
| | | | Change-Id: Ia43c2436e01032ace7e2b13e59d60d10f71e7004
* Add lint check for suspicious onMeasure/onLayout/onDraw callsTor Norbye2012-12-213-0/+124
| | | | | | Cherrypick from https://android-review.googlesource.com/#/c/48540/ Change-Id: Ic3d4552324c319899f908c4741ed263514713c1a
* Lint check for valid class referencesTor Norbye2012-12-196-10/+229
| | | | | | | | | | | | | | Lint already checks that classes registered in the manifest (such as activities and services) exist and are instantiatable. This lint check expands this check to also make sure that custom views and fragments referenced in layouts also exist, as well as class names registered in analytics config files (requested in issue 41567). It also fixes the typography detector to not flag IDs as needing em dashes. Change-Id: Idd42be60dae6c0747324d600d15b01d6d8a3240f
* Look for missing commit calls on fragment managersTor Norbye2012-12-194-2/+105
| | | | | | | | | | This implements 41339: Forgetting .commit() after .beginTransaction() Also renames the RecycleDetector to something more generic since it checks for other types of cleanup as well. Change-Id: I19ca6537ba88745845ad452f87b6562085a47fe5
* Lint: Flag using @dimen where not allowed in manifestTor Norbye2012-12-193-0/+76
| | | | | | | Adds a lint check which flags using resource ids for versionName, versionCode, minSdkVersion and targetSdkVersion in the manifest. Change-Id: I5b4e25d0b114cdf84f446a193fe5d3a095b2f415
* Code cleanupTor Norbye2012-12-123-14/+14
| | | | | | | | Ran some static analysis on the lint code and fixed various issues - some typos, made some fields final, made some methods static, sorted modifier order etc. Change-Id: Ibdcdec5745f040eb7b0880cf6999c0f0ea7f7e6f
* Add lint recycle detectorTor Norbye2012-12-113-0/+235
| | | | | | | | | | | | | | | This lint check looks for missing recycle() calls on resources such as TypedArrays, MotionEvents, and Messages. 41140 New Lint Check: Check Recycling VelocityTracker 41138 New Lint Check: Check Recycling Message 41137 New Lint Check: Check Recycling MotionEvent 41136 New Lint Check: Check Recycling TypedArray In addition, it also flags cases where a method is called on a resource after the resource has been recycled. Change-Id: Ia06a1779519971d5459f1cd98914a6aededc4b83
* Merge "41154: Handle allowBackup properly for target < 4"Tor Norbye2012-12-101-0/+13
|\
| * 41154: Handle allowBackup properly for target < 4Tor Norbye2012-12-101-0/+13
| | | | | | | | | | | | | | | | This fixes 41154: Template Android Application Project for API v3 reports AAPT problem with android:allowBackup="true" Change-Id: I74b4cd0f8df9a74fe9221250cc83b1d15821ce51
* | Unit test fix: make tests more resilient to test jar locationTor Norbye2012-12-102-11/+16
|/ | | | | | Also handle case where $ANDROID_BUILD_TOP is set better. Change-Id: Ib39f275417738af9145697e19f4de085255c1655
* Move lint unit tests into lint/cliTor Norbye2012-12-07532-0/+19963
The unit tests for lint have lived in the lint/libs/lint_checks library, but that's not a natural place since the cli library depends on the lint_checks library, yet the lint_check *tests* also depend on cli. Furthermore, the tests also test stuff in the cli library. Thus, move the test sources over to the cli library, which also pulls in the lint_checks library. Change-Id: Ia8527ea894b287915ad12c04c16daf80ace67bdc