| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset splits the proguard.cfg into two halves:
(1) All the general Android settings go into
$ANDROID_SDK/proguard/proguard-android.txt.
This defines shrinking rules like keep custom views, etc. The
crucial point is that this information is maintained and updated
by Tools updates, so whenever new APIs are added to Android, or
whenever bugs are found in the configuration such as flags needed
to work with Dalvik, we can make the updates - we don't have old
snapshots living on in projects.
(2) Any project specific settings go to proguard-project.txt in the
project.
(3) The proguard.config property in project.properties now refers to a
*path* of configuration files, which are all passed to ProGuard in
the given order. The code which processes this setting will
substitute android.sdk.home and user.home variables, so the path
does not have to be hardcoded to point to the project-android.txt
file.
The default project templates have been updated to include a
commented out configuration setting up proguard as described
above.
The default proguard file name was changed from proguard.cfg to
proguard-project.txt such that it can be directly opened in Eclipse
and to make it clear it's an editable text file.
Lint was updated to find the Proguard file via the proguard.config
property as well as via the old and new default names for projects not
enabled with ProGuard.
A subsequent CL will add a lint check which identifies projects
containing the old setup (full local configuration) and offer to
replace it with the new setup.
Change-Id: I44b4c97a160114c2382f02f843c95486a0dc9d6b
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Android has various setColor methods (such as setTextColor) which take
an integer, where it expects RGB values in the bytes. Since this is
an integer, and since color resources are integers, sometimes code
incorrectly passes the color resource id rather than a resolved color
to the setter:
paint.setColor(R.color.red)
Obviously, the color should be "resolved" first via
getResource().getColor().
This changeset adds a lint detector which catches these kinds of bugs.
Change-Id: I2970e5220d24ad3b844a9f19fbe99b932d9f7fb4
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Take the folder version into account when checking the API level in
XML files. For example, even if minSdkVersion=5, it's okay to have a
<GridLayout> element in a layout if that layout is in a layout-v14 (or
higher) folder.
Change-Id: Idbd3647c1145e4b3d03f90626339ef7e6b10c827
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
TextView provides a number of attributes related to text editing.
However, these are generally intended for the EditText subclass of
EditText. This lint check looks for <TextView> elements in layouts
where one or more of the edit-related attributes (such as inputType)
are defined.
It also updates the deprecation detector to check various deprecated
attributes (it only checked for deprecated elements before this.)
Change-Id: I1b94902d906cd0bee6a6564368125a68b3c9bb2a
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If Lint cannot find the .class files for a project, it cannot run any
of the class-file based checks (such as the NewApi check).
This changeset adds a new category and issue id, "Lint Error", for
these types of issues. In HTML reports, these errors are listed at the
top. The issue explanation states that these errors don't represent
bugs in the user's code, but that lint was not able to check certain
things for the reasons given.
In the case of no .class files found, it asks whether the project
needs to be built first. It also uses these lint errors to emit
errors in processing lint.xml configuration files.
(Note that if you don't want to see these types of errors, you can
suppress it via --disable LintError.)
Change-Id: Ifc2f55566f3a0cd20189d43e4205201bc21ee280
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A lint.xml file in a library project should be able to suppress lint
errors in that project. This changeset fixes a couple of bugs which
prevented this from working: In Eclipse, the configuration was cached,
which meant a single lint run through multiple projects would just use
the configuration of the first encountered project. And from the
command line driver, the code to handle --check handling would
override configuration severity in one scenario.
Change-Id: Ib08e2b14582ab53e5ab89244738d1bd77839610e
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a lint rule checking that any named, non-abstract
classes which extend Activity, Service or ContentProvider have a
corresponding registration in the manifest file.
It also ensures that the registration is under the right kind of tag
(<activity>, <service>, <provider> or <receiver>).
Change-Id: Ifbb587ae7b3eb6529d5099b33245d0478d48c41f
|
|/
|
|
|
|
|
|
| |
This changeset makes the API lint detector look at XML attribute
values and XML value text nodes and check any references to @android
resources to ensure that they are available in all supported versions.
Change-Id: Iab0d23423c30381e06b32f54aa902a31cc1f9a1c
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lint check makes sure that if a layout references
android:onClick="foo" then one of the Java classes provide a
public void foo(View)
method. It also looks for simple typos, and warns if the access
modifiers are not right.
(It also moves some ASM-related utility code out of specific detectors
and into the ClassContext class)
Change-Id: Ifb0820221175a0760b83992f54e99f761b4d7097
|
|
|
|
| |
Change-Id: If83a942f99da90d061529092feaab3be94a8e0ad
|
|
|
|
| |
Change-Id: Ia8f0c1aebb4e797352a0513b8113b5d6b75ef0dc
|
|
|
|
|
|
|
|
| |
Also adds a lint check for unused namespace declarations,
and migrates the TypoDetector code into this new namespace
detector.
Change-Id: I5ec2214ea4c59e14194f8eaecef422ea19baa35e
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset adds a new severity, "Fatal", and shifts the abort-on-
export feature from using the Error severity to the Fatal severity.
This gives the user (and lint check developers) a bit more control
over which errors should fail a build. You can now leave some issues
as "error", but not have it block export. This can be useful for
checks which are extremely slow, or for checks that generally
represent errors but where the rule cannot know for sure (such as
attempts to figure out reflection calls in Java).
Change-Id: Ie44d5efcb605091ba8c1c67aa720edbbde416ca5
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This changeset adds a new lint detector which looks for typos in the
namespace declaration for Android. If it sees the prefix "android" it
ensures that the URI matches exactly (and case-sensitively)
http://schemas.android.com/apk/res/android
If the prefix is "a", it also checks for the above prefix, but only
warns if the difference is "close" (edit distance <= 3) such that
it belives it's a typo, not some unrelated prefix bound to "a".
(This was requested in http://b.android.com/25449)
Change-Id: Ic6dee77a300fc048cb9bee3e455f533b858ef6bb
|
|\ \ \
| | |/
| |/| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This changeset adds a preprocessing state to the class handling.
Instead of processing each class sequentially, all the class byte
arrays are read in first, and then a lightweight class visitor
(skipping methods and debug symbols) skims through all the classes to
build up a superclass map up front.
The byte arrays are then processed sequentially as before, but the
detectors can now query the lint driver for class hierarchies.
A couple of lint checks are now taking advantage of this. For
eexample, the API checker can properly handle virtual methods where a
local class extends some other local (or library) class which
eventually extends an Android API class. (Until this checkin, only
classes directly extending an Android API class were supported).
Change-Id: I972172a61268dd2530979a93b2f289c1dcf94d63
|
|\ \ \
| |/ / |
|
| |/
| |
| |
| |
| |
| |
| | |
This changeset makes lint properly handle the jar dependency scope for
issues. It also tweaks the API in a few minor ways.
Change-Id: Ibd7b943c9d3ce361e091af8f1e990709bb94d183
|
|/
|
|
| |
Change-Id: I52662287ff86925629ea8f6f5bc13855d403b3e8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Ic08e20bf6d729362fae7d82c84e664e05b6ba843
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Ic49dc60284820ed01841a8fdbf09c4668e285169
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
The @ApiTarget annotation lets you annotate classes, constructors
and methods with a temporary local version of a min sdk.
Change-Id: Ic9d166d45fde45f1c97e503cebf07d5ae0635c73
|
|
|
|
|
|
|
| |
This changeset adds support for suppressing lint warnings by
annotatating variable declarations, fields, methods and classes.
Change-Id: If274d65bccdc5c7d6426566c635245d6b3aae147
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
This changeset makes the lint driver able to process .jar files and
run the detectors on the classes inside.
Change-Id: Iaf7303197b953d6c6f925cdf83ad33a8ecd581a5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Lint API specifies that columns should be 0-based (like line
numbers), but in a number of places this was not the case; it was
1-based instead (both in the detector code and in the output code,
which is why things looked okay). This changeset cleans this up such
that the columns are properly 0-based (and adds unit tests for it).
The Location API has a mechanism to search in the source code for
tokens, which is useful for bytecode detectors where we only have line
numbers. This changeset adds tokens to the API detectors such that it
identifies the corresponding method, class or field reference in the
source, not just the corresponding line. It also improves the pattern
search to also look backwards a few lines, since some bytecode
references appear a few lines later than the source code reference (at
the nearest executable code; this is the case for parameter local
variables for example).
Change-Id: I3adac20d5f0075e0a919be15dfb68658d5b7bb11
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This checkin hooks up the API check to lint, such that class
references, method calls and field access are checked with the
database and generates warnings if the project min SDK is lower than
that required by the API. It also checks layout references to ensure
that the widgets are supported by the minimum API.
NOTE: There's no flow analysis to avoid classes that are deliberately
accessing later APIs (and where the referencing class is loaded
conditionally). Therefore, for now the lint check is disabled by
default; enable with "lint --check NewApi".
Change-Id: Ia3160f81b45b5baed3caa46cdffe56735ebedd44
|
|
|
|
| |
Change-Id: I671fe960fe61afc80ec305e05f7ffe7cbb5933c5
|
|
|
|
|
|
|
| |
This allows lint detector code to load file resources bundled with the
tools (such as a permissions database file).
Change-Id: If740206e8e0c5feeaf0e908bf823135114c9bd0d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset adds support for multi-pass lint checking. A detector
can indicate that it is interested in a second pass through the source
code.
A good example of where this is needed is the Unused Resource
detector. In the first pass, it tracks declarations and references,
and at the end of the first pass it knows which resources are
unused. However, at this point it's too late to compute detailed
location information about each unused resource. Without multi-pass
checks, it would have to track detailed location information for *all*
resources, and computing locations can be costly.
With multi-pass support, it just computes the unused resource names in
the first pass, and then in the second pass it computes details about
the locations of those resources found to be unused.
This now includes *chained locations*. For example, for an unused
string, all the different translations of the unused string are
marked. These do not generate separate unused messages, it simply adds
to the location chain for the original unused warning.
This changeset also updates all the error reporters (text, HTML and
XML) to include all the locations, not just the ones with messages.
This changeset also cleans up the API a little: context classes now
track the lint runner instead of the lint client (which can point to
the lint client), and the SDK info lives with the project rather than
with the context.
Change-Id: I14ca3310bd1165b7dff655486157d770a36c4eff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lint check which suggests replacing root <FrameLayout>'s with a
<merge> tag was a bit simplistic. When the layout is used in a
ListView etc the replacement doesn't work.
This changeset limits the scenarios where the <FrameLayout> to <merge>
conversion suggestion is made to:
- Layouts that are <include>'ed from other layouts
- Layouts that are directly named in a setContentView() call
(This changeset also moves some code around to reuse the layout name
method from the DuplicateIdDetector and cleans up some constants)
Change-Id: Ic365f5ab2dc3cc7749ccab79f188a44829415802
|
|
|
|
| |
Change-Id: I2409950f2c8618148f2b7cfaf693672021b09633
|
|
|
|
| |
Change-Id: I6222f3ef2909174d9111dcfc037a2e74ad093acd
|