aboutsummaryrefslogtreecommitdiffstats
path: root/lint
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Lint detector warning about missing <uses-sdk> min or target SDK ↵Tor Norbye2012-02-075-5/+126
|\ | | | | | | settings"
| * Lint detector warning about missing <uses-sdk> min or target SDK settingsTor Norbye2012-02-075-5/+126
| | | | | | | | Change-Id: I9401318afe771d11ef6f211ee3f9cb6c62df8f83
* | Merge "Make the lint string-format check ignore date strings"Tor Norbye2012-02-075-47/+209
|\ \
| * | Make the lint string-format check ignore date stringsTor Norbye2012-02-075-47/+209
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The string format lint check might be processing strings not intended for String.format (but intended for example for android.text.format.Time#format), in which case it will be wrong about whether two conversions are incompatible. (This does not fix all scenarios; if a date string looks like a String.format in the sense that all of its formatting characters are defined by String.format then the string will assume to be intended for String.format.) This changeset attempts to recognize this, and also make the "is incompatible" check a bit more nuanced: it will now consider "d" compatible with "x" for example. Change-Id: I63ce082f40169e4033809d25cae3cf116c9e2044
* | Merge "Suppress UselessLeaf warnings for root layouts"Tor Norbye2012-02-073-0/+17
|\ \
| * | Suppress UselessLeaf warnings for root layoutsTor Norbye2012-02-073-0/+17
| |/ | | | | | | Change-Id: I997ad6f1348e9884b56a60ef453cd02754c936bb
* | Make ButtonOrder lint rule consider minSdk and targetSdk and v14Tor Norbye2012-02-074-49/+202
|/ | | | | | | | | | | | | | | | This changeset enables the button order check by default, and makes the rule consider the minimum and target SDK more carefully. * If both the min and target SDK >= 14, the rule enforces the new button order. * If both the min and target SDK <= 14, then the rule does nothing. * Otherwise, if warns if the wrong button order is in a layout that is in a layout*-v14 or higher folder, or if it's in a non-v14 folder and there is no corresponding v14 layout. Change-Id: Idf54f86d7a004fdb073486160e4d5ff5fd1cd45c
* Add support for suppressing lint via XML attributesTor Norbye2012-02-0639-53/+258
| | | | | | | | | | | | | | | | | | | | | | | This changeset adds support for suppressing in XML files: (1) Lint will ignore errors found in attributes and elements if the element (or any surrounding parent elements) specifies a tools:ignore="id-list" attribute where the id-list matches the id of the reported issue (or "all"). The "tools" prefix can be any prefix bound to the namespace "http://schemas.android.com/tools" (2) There's a new quickfix shown for XML lint warnings which offers to add a lint suppress attribute for a given lint warning (setting the id to the id of the warning, and adding the tools namespace binding if necessary). (3) The XML formatter now handles namespaces a bit better: after the preferred attributes (id, name, style, layout params, etc) have been handled, attributes are sorted by namespace prefix before they are sorted by local name -- which effectively will sort any new tools:ignore attributes to the end. Change-Id: Id7474cde5665d9bd29bdd4e0d0cc89ed4d422aea
* Update expected size icon detector to new action bar sizeTor Norbye2012-02-063-7/+12
| | | | | | | This addresses 25176: LINT: Incorrectly flags Action Bar icons as wrong size Change-Id: I1309c60f48585dd118951d928e3cd3d06a1d2939
* HTML report tweaksTor Norbye2012-02-063-53/+58
| | | | | | | | | | | | | | | | | | - If specifying a report directory (rather than an HTML file name), always write out an overview report. (Before this it only wrote an overview report if issues were *found* in multiple projects). - If checking *specific* issues (with the --check flag), don't write out the list of suppressed issues. - If no errors were found, write a message to that effect. - Make some space between the explanation area and the More Info URL, if any - Code cleanup Change-Id: I0c1a5cf14de15276904e8999323df443fc39dc9c
* New button-related lint checksTor Norbye2012-02-0613-1/+1272
| | | | | | | | | | | | | | | | | | | | This changeset adds 3 new lint checks related to buttons: (1) Order. This looks for "wrong" button orders, where either the Cancel button is not on the left, or the OK button is not on the right. (These are checked separately since it's possible to have for example "Cancel | Send".) (2) Case. This looks at OK and Cancel button labels and ensure that they're using the "standard" capitalization - this catches dialogs which use "CANCEL | ABORT" or "Cancel | Ok". (Yes, lint found several existing cases of this!) (3) Back. This looks for button with the label "Back" and warns to use the Android-specific naviagation approach instead. Change-Id: Ic0e4fe3a0347647fdba7c25d8e2290ec0e6bdd39 http://developer.android.com/design/building-blocks/dialogs.html
* Merge "Add lint rule checking for showAsAction="always" in menus"Tor Norbye2012-02-069-1/+432
|\
| * Add lint rule checking for showAsAction="always" in menusTor Norbye2012-02-039-1/+432
| | | | | | | | | | | | | | | | | | | | It's better to use "ifRoom" instead. The check allows a menu to have a couple of "always" items if there is also at least one "ifRoom" item in the menu. In Java code, the lint check will complain if it finds one or more references to MenuItem.SHOW_AS_ACTION_ALWAYS but no references to SHOW_AS_ACTION_IF_ROOM. Change-Id: Ib13f89920bd3919ffd7fc0f0137e90103e8850c3
* | Merge "The inefficient layout weights check only applies for horizontal ↵Tor Norbye2012-02-065-3/+97
|\ \ | |/ | | | | LinearLayouts"
| * The inefficient layout weights check only applies for horizontal LinearLayoutsTor Norbye2012-02-035-3/+97
| | | | | | | | Change-Id: I648e0adde917e47da02f181c019bf0302ebab643
* | Merge "Fix type in Java parser interface"Tor Norbye2012-02-062-6/+4
|\ \ | |/
| * Fix type in Java parser interfaceTor Norbye2012-02-032-6/+4
| | | | | | | | Change-Id: Ic08e20bf6d729362fae7d82c84e664e05b6ba843
* | SDK: verbose log for CommonXmlEditor.Raphael2012-02-061-1/+1
|/ | | | | | | | | | This just adds a simple printf of the resFolder + type when the CommonXmlEditor can't find a matching delegate. Also a 1-character typo fix in a lint message and ignore bin/gen folders for the sdk controller app. Change-Id: If43877e6c4d4158c475507671993fe29716a7c5e
* Disable String.format construction checkTor Norbye2012-02-033-8/+26
| | | | Change-Id: I2b0b118c2f4c3e64fb4c2e68ae594bb5e18a5938
* Include .9.png files in HTML reportTor Norbye2012-02-031-2/+1
| | | | Change-Id: Ib7b8914f05849db49dd9f25349be08e67eb7264d
* Include suppress help in HTML report, and tweak CSSTor Norbye2012-02-033-21/+49
| | | | | | | | | | | | | First, include the suppress help as a section in the bottom of the HTML report, and link to it from each issue explanation. Second, tweak the generated HTML and CSS a bit: Fix <a> element generation to be properly closed (which avoids issue where the first link in each location list did not have the right style), make links in the More Info have a blue color to stand out more, and add a Holo like gradient in the background color for browsers that support it. Change-Id: I3078cb1f1a5112dc6360816c4a6a6c37771ab6fc
* Add lint abbreviation flagTor Norbye2012-02-029-42/+109
| | | | | | | | | | | | Add a new flag, --showall, to turn off the abbreviation handling which truncates long lists (such as all missing translation keys, or additional resource locations). In HTML reports, always include full location lists, but by default hide them via a JavaScript reveal button. Also style buttons a bit more holo-like. Change-Id: I6e4ac7f910d1161981c48c7c4c766f03e650fdf6
* Include disabled issue count in HTML summaryTor Norbye2012-02-021-5/+8
| | | | Change-Id: Ia9dd344a8b12a8bce479aa19fed6c876c86b7b0c
* Add --url none option to lint driver to turn off url mappingTor Norbye2012-02-021-11/+19
| | | | Change-Id: Ie00cb9e23098676db021d6cc4d2f3d99a5362dbc
* Add Quickfix to add @TargetApi.Tor Norbye2012-02-023-6/+12
| | | | | | | | | | | This changeset adds a quickfix for adding @TargetApi(N) for lint warnings where API <N> required by the given access is too high for the current min SDK. It also tweaks the add annotation label format to be similar to the regular javac one. Change-Id: Ia38f94c58cb59ae0cdd2416c1d019c9e7174797b
* A few simple name changesTor Norbye2012-02-029-25/+26
| | | | | | | | | | | | | | | | | | | | | This changeset contains no semantic changes, just a couple of simple refactorings: (1) Rename the "Lint" class to "LintDriver". "Lint" is a bit generic (there's already LintClient for example), and this object was already referred to as a driver from various other API's, such as Context.getDriver(). (2) Rename LintRunner in Eclipse to EclipseLintRunner, similar to the other EclipseLintClient in the same package - and to avoid confusion with LintDriver. (3) Move all the lint fix inner classes inside the LintFix class out as top level classes. The class was getting really large and there's really no good reason to keep all the individual fixes as inner classes; there's already a separate lint package for them. Change-Id: Ifc0004bfb38f8e11e33e9ddc477b6cf07ca319f2
* Add has-autofix info to HTML reportTor Norbye2012-02-023-1/+57
| | | | Change-Id: I14e997d4fb7a38a15b764d195c001506c6b73c6c
* Skip android.support packages in AOSP buildsTor Norbye2012-02-026-2/+48
| | | | Change-Id: I7b5b2c8031a21ad255c835607a1394541e89e73a
* Add marker resolution for adding @SuppressLint to Java filesTor Norbye2012-02-022-10/+14
| | | | | | | | | | | | | This changeset adds a new marker resolution for adding @SuppressLint annotation (or modifying an existing @SuppressLint) in the method, field or class surrounding a lint warning. It searches up in scope and adds one suggestion for each enclosing applicable scope. This changeset also makes the suppress id's be case insensitive such that a codestyle similar to the one used by @SuppressWarnings is possible. Change-Id: I0a6a80c4e2d526f1c8fc6aedd95674a25e6a22f0
* Merge "Regression test"Tor Norbye2012-02-021-0/+6
|\
| * Regression testTor Norbye2012-02-011-0/+6
| | | | | | | | Change-Id: Ica2631561584fc520e0776843c784d68c1f35093
* | Attempt to use a common filepath root as the relative dirTor Norbye2012-02-013-5/+137
| | | | | | | | Change-Id: Ic49dc60284820ed01841a8fdbf09c4668e285169
* | Remove obsolete issue limitation description from UnusedResource detectorTor Norbye2012-02-011-10/+1
| | | | | | | | Change-Id: Id4caccd3f38f41288cc84dfe94546f18316631a2
* | Include disabled checks in the HTML reportTor Norbye2012-02-012-54/+169
| | | | | | | | Change-Id: I706443006cd6164718428cd1c6909303acda81dc
* | Add help topic for suppressing warningsTor Norbye2012-02-012-2/+71
|/ | | | Change-Id: I1e03d928e6abe306a6a861cbf80b896cb5cd864e
* Lint HTML improvementsTor Norbye2012-02-0111-201/+507
| | | | | | | | | | | This changeset makes various improvements to the Lint error report: the styles are now in a separate stylesheet, and the default style is Holo-like. Paths are handled better when linting multiple projects such that the report title includes the root-relative project path, and all filenames are then relative to the project root. The table of contents is now a table, and includes error and warning icons. Change-Id: I4e49f7b226bfa4d7b46e3a29e006fe78a504e9ef
* Add @ApiTarget supportTor Norbye2012-01-316-2/+107
| | | | | | | The @ApiTarget annotation lets you annotate classes, constructors and methods with a temporary local version of a min sdk. Change-Id: Ic9d166d45fde45f1c97e503cebf07d5ae0635c73
* Merge "Add @SuppressLint support for Java parse tree detectors"Tor Norbye2012-01-3110-10/+234
|\
| * Add @SuppressLint support for Java parse tree detectorsTor Norbye2012-01-3110-10/+234
| | | | | | | | | | | | | | This changeset adds support for suppressing lint warnings by annotatating variable declarations, fields, methods and classes. Change-Id: If274d65bccdc5c7d6426566c635245d6b3aae147
* | Emit relative paths in multi-project HTML reportsTor Norbye2012-01-311-5/+20
| | | | | | | | Change-Id: I2bf31a95fbb9835912df06eb9319820668019aeb
* | Merge "Add @SuppressLint support for Java bytecode detectors"Tor Norbye2012-01-3117-184/+606
|\ \ | |/
| * Add @SuppressLint support for Java bytecode detectorsTor Norbye2012-01-3117-184/+606
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset adds support for suppressing lint warnings by annotatating classes and methods. (Finer granularity will be available for Java source detectors, but does not work for byte code detectors since those annotations disappear from the .class file). It also rewrites two of the existing bytecode detectors to use the ASM DOM instead of the old visitor pattern such that it can pass a MethodNode to the Lint driver to check for suppress annotations. While doing that I also make the field getter detector print the name of the field that the getter call can be replaced with. Change-Id: I8f7accb0219e6e9b3c499f16e7c0eb46853bbe04
* | Allow bitmaps in res/drawable/ when minSdk < 4Tor Norbye2012-01-312-1/+14
|/ | | | Change-Id: Ic02970df139fdb87ab56e46e95155c18e9aa6ccc
* Write lint overview report for multi-reportTor Norbye2012-01-312-20/+177
| | | | | | | | | | | If lint writes out multiple HTML reports (e.g. when specifying a directory to the --html flag), and there are more projects than just one, write an overview doc which contains a table of all the projects and the corresponding error and warning counts in decreasing order, with links to the individual reports. Also ensure that there are no case-insensitive filename clashes. Change-Id: I4dcda14a625863e71022734088a027fc8ac357d0
* Find API database when running in AOSP build environment with SDKTor Norbye2012-01-311-0/+9
| | | | Change-Id: Ic884ec376d99d9b10a123f9b8a084987dd398e0e
* Support Android source tree directly in lint project supportTor Norbye2012-01-301-0/+206
| | | | | | | | This changeset makes lint recognize when it's invoked in an Android build environment, and if so locate the generated sources and bytecode output locations automatically. Change-Id: If217a49b7c7168cb762a36494d1aedbbb0fdbb6a
* Error messages for no-dpi warnings were tagged with the wrong issueTor Norbye2012-01-301-1/+1
| | | | Change-Id: I8d70800ae7902851139c620c64b2abe27ba01450
* Add support for exporting one HTML report for each linted projectTor Norbye2012-01-309-199/+336
| | | | | | | | | | | | | | | If you point the --html flag to a directory rather than a file (or to a nonexistent file which does not have a file extension, such as /tmp/lintoutput/) then lint will create a separate report for each linted project and write each one into the export directory. It also writes the project name into the report title. (This changeset also performs some other cleanup to make delegating HTML reporting easier now that it's done by the multi-project exporter.) Change-Id: I460e9fad5ae7176d066550f6193ba79a7668e416
* Convert ApiCheck internal JVM signature to external in error messageTor Norbye2012-01-302-12/+12
| | | | Change-Id: Ia76b2fb5693d7e36fed2258791eda9c59a48ff49
* Add .jar support for bytecode checksTor Norbye2012-01-306-12/+125
| | | | | | | This changeset makes the lint driver able to process .jar files and run the detectors on the classes inside. Change-Id: Iaf7303197b953d6c6f925cdf83ad33a8ecd581a5