1fb460987f7d832adf12290f41448d0c16a95972 |
|
20-Sep-2012 |
Siva Velusamy <vsiva@google.com> |
Move some utility functions from AdtUtils to common Change-Id: Ia6f5c55e07c7f60712472c8e850b7c4595c46671
|
12d4581faa6438941e65a9dc83213be34c6ca970 |
|
13-Sep-2012 |
Tor Norbye <tnorbye@google.com> |
Constants refactoring. This changeset moves most constants into the SdkConstants class, and gets rid of AndroidConstants and LintConstants. It also migrates all non-ADT specific constants from AdtConstants into SdkConstants. It furthermore moves various other constants (such as those in XmlUtils and ValuesDescriptors) into the constants class. It also fixes the modifier order to be the canonical modifier order (JLS 8.x). Finally, it removes redundancy and combines various constant aliases such that we don't have both NAME_ATTR and ATTR_NAME pointing to "name", etc. Change-Id: Ifd1755016f62ce2dd80e5c76130d6de4b0e32161
|
ec0dfbb255330df32eaafb5d785af458ef9a660c |
|
31-Aug-2012 |
Tor Norbye <tnorbye@google.com> |
Close XML editors when files are deleted or projects are closed The existing hooks for closing the editor when the underlying file is deleted was not working correctly, and was inefficient (since each editor added their own global resource listener, so every editor would find out about every other editor's file changes). Instead, this generalizes the single editor listener which was used to initialize editor types such that it also listens for deletion, and then finds any open editor mapped to that file. It also hooks up to the pre-close events for projects and closes all files related to the project as well. This will hopefully fix this issue as well: 20836: Can't delete a layout XML via Package Explorer > Delete if it has an error Finally, it removes a bunch of now obsolete logging code for an issue which seems to be permanently fixed. Change-Id: I90b38984639a605755f2d67ca2413cc925f730d1
|
addbd7110d87e9f48d854e5ba6a729359110ada8 |
|
22-Aug-2012 |
Tor Norbye <tnorbye@google.com> |
Use simple markup for bold and monospace in lint issues The explanation text for issues can now contain some simple markup such as * around sentences for bold and ` for monospace. In the HTML report this is converted to HTML markup using <b> and <code> spans, as well as <a> for http:// links. Change-Id: I875a55a0ab9a61c2e8bb493ad94d5e4d51dd1072
|
b52aeca0f2e150d7e7e8ceffa897a7ae1f938724 |
|
24-Aug-2012 |
Tor Norbye <tnorbye@google.com> |
Warn about non-recent targetSdkVersions This changeset changes the default targetSdkVersion written into new projects from being hardcoded to "15" to being the same level as the build target's API level. It also adds a new lint check which looks at the targetSdkVersion and complains if it's not the same as the highest known version (currently 16). The issue explanation points to the javadocs for the android.os.Build.VERSION_CODES class for details on how to upgrade the app. Change-Id: I00c2bd7cd8fa239b9fd1de9b2d35ff9faf87d25f
|
81cefe2a26dd6db8a878e30874d12cdcbff0e83b |
|
11-Aug-2012 |
Xavier Ducrohet <xav@android.com> |
More refactoring. Move stuff out of sdklib into common and ide_common. Remove androidprefs and move the one class into common. Change-Id: I71d126a13cf2ba413692e29616f4968a37d7b33a
|
85e4a1a9dd133abb879ec211ce8dd385004edf22 |
|
08-Aug-2012 |
Xavier Ducrohet <xav@android.com> |
Refactor common.jar Move resources and com.android.util.Pair into layoutlib_api where they belong since layoutlib depends on them and we need to control the API. Made a copy of Pair to stay in common.jar but moved it to com.android.utils.Pair (the one in com.android.util.Pair is marked as deprecated to prevent usage where applicable). Also moved XmlUtil and PositionXmlParser to com.android.utils to match Pair. Change-Id: I21d7057d3f2ce604f86a3bb1fa3c130948c93b89
|
8dcd0726088eee54368e032e7dc6b31a450b4ee1 |
|
01-Aug-2012 |
Tor Norbye <tnorbye@google.com> |
Fix lint-on-save for .class file detectors in Java files This changeset fixes the lint-on-save behavior in Java files such that the classfile based checks are run after the .class files are up to date. It also makes lint-on-save work when Project > Build Automatically is turned off, by adding a new resource listener, and it modifies the IFileListener interface to make resource listening more efficient; in particular, it passes the flag mask such that listeners can ignore events such as markers getting added or removed from a file without the content changing. It also makes some improvements to the lint infrastructure. First, it adds an indirection in the LintClient such that reading bytes from files can be customized by the client (to for example add caching or to read contents from memory not yet flushed to disk). It also allows inner classes to share the contents of the source file between each context (while debugging the above I noticed that each inner class node had its own class context and therefore would re-read the source file repeatedly.) Change-Id: Ib9572cebe1269fe05c3af1369610525ea3b44061
|
ea7dd912dc8f5b8f3ae8545166657beacb429552 |
|
04-Jul-2012 |
Tor Norbye <tnorbye@google.com> |
Prevent exceptions for invalid project definitions Change-Id: Ie2b5929a87144c77f1ce0d43b2520cc498df5081
|
afb7b2c7b91831381e5f1f096738654dcd1bb82d |
|
01-Jul-2012 |
Tor Norbye <tnorbye@google.com> |
33985: Persistent errors in Java files This CL fixes issue 33985. There reason these error markers were sticky, is that the IssueRegistry.PARSER_ERROR error type is special, and was not handled properly by the Issue.isAdequate(Scope) method which is supposed to return whether the given issue can be fully analyzed in the given context. In addition, I also disabled the Java parser generating PARSER_ERROR issues when running in Eclipse, since Eclipse itself will already provide these errors, so all this achieves is creating "multiple annotations on this line" conflicts when you hover over the icon. Change-Id: Ie91604660a69eb007b851e5a821e629211c29690
|
5e290ab6060c3204be3a3eb6084db6f92c88adee |
|
19-Jun-2012 |
Tor Norbye <tnorbye@google.com> |
Add typo detector This changeset adds a new typo detector. There are also some lint infrastructure fixes to better handle positions within text nodes, and to allow Eclipse lint quickfixes to supply multiple fixes for a single issue (such as multiple misspelling alternative replacements.) Change-Id: Ie26f0bafc571e02ae09ff27a7f4b221fe0c2ea5b
|
7e4b8e9d595e45baa9d87cdb8282f02759e73abc |
|
30-May-2012 |
Tor Norbye <tnorbye@google.com> |
Fix nullness annotations Eclipse 4.2 includes analysis support for @Nullable and @NonNull annotations. However, it requires these annotations to be *repeated* on every single method implementing or overriding a superclass or interface method (!). This changeset basically applies the quickfixes to inline these annotations. It also changes the retention of our nullness annotations from source to class, since without this Eclipse believes that a @NonNull annotation downstream is a redefinition of a @Nullable annotation. Finally, the null analysis revealed a dozen or so places where the nullness annotation was either wrong, or some null checking on parameters or return values needed to be done. Change-Id: I43b4e56e2d025a8a4c92a8873f55c13cdbc4c1cb
|
4ae3297a857c6a0c84511b4c5e727360f6958c89 |
|
29-May-2012 |
Tor Norbye <tnorbye@google.com> |
Lint infrastructure fixes This changeset contains various unrelated fixes to the lint infrastructure: (1) Tweak the way the classpaths are computed in the default lint client method such that rather than reading and parsing the .classpath file 3 times, once for each of source-path, output-path and library-path, it's now processing it once and storing the results for all 3. (2) Override the lookup-classpath method in Eclipse to directly query the Eclipse APIs for obtaining the classpath info. (3) Add in user libraries found in libs/, since these don't necessarily show up in the .classpath file. (4) Fix a couple of bugs related to checking .class files: First, when locating the project for a .class file, lint would search upwards for the surrounding project, which meant looking for the nearest parent containing an AndroidManifest.xml file. However, in the case of .class files, it will first encounter the bin/ directory, which can contain a manifest file, so it would compute a project for the bin/ folder rather than its parent, which meant the source paths would be wrong. Second, the list of class entries to be processed by lint must be sorted prior to processing; the code dealing with innerclasses depends on that. (5) Some minor code cleanup: Move some generic utility code and some string literals out of specific detectors and into the generic utility and constant classes. (6) Cache results of the lint-project to eclipse-project lookup method since that method is called repeatedly with the same (current) project. Change-Id: I33603eed8381ca54314202620cb1bb033e70f775
|
5ae903bf8670f40e9eb40ebbd0a25c15eaac5962 |
|
23-May-2012 |
Tor Norbye <tnorbye@google.com> |
Improved lint integration in the layout editor This changeset improves the lint integration in the layout editor in the following ways: - The outline now shows error or warning indicators in the bottom left corners of the icons for any specific views that have one or more lint warnings associated with them. There is a tooltip if you hover over the icon which displays the lint message. - The layout editor canvas displays little warning indicators in the bottom right corner of the views (provided the views are larger than the icons; e.g. empty layouts, as well as views that are zoomed out very far will not show lint indicators). - There is a tooltip hover in the canvas as well. In order to avoid obscuring content, it shows up at the bottom of the view. It might also show multiple lines: one for each lint warning in a view near the cursor. (This is important if you for example have a warning both on a layout and a widget inside that layout.) - The error indicator in the upper right corner, which used to be a (too small) warning icon is instead an issue count now. Clicking on the issue count opens up the lint file dialog. - The lint file dialog now contains a button to suppress issues by attributes (and fixed some other minor bugs related to keeping expanded categories expanded across refreshes and setting an initial selection). - Lint is run automatically when the layout is opened up (3 seconds after the first successful render). This makes the error indicators show up (until now, it would only run single-file-lint after the first edit operation). Change-Id: I306aca390d70bf025f5e86fc21ae7b6bc0036d8d
|
9105cd9318152b97845ad0255d921e7921715dea |
|
09-May-2012 |
Tor Norbye <tnorbye@google.com> |
Clear lint markers as part of a clean build Change-Id: I6b3c1c7416a4babfa44b83741f697ad3deed4435
|
fd9fe37e806b8f14b2944d29f307cd050ecb419c |
|
28-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Fix configuration information for library projects This changeset fixes one more bug related to lint configurations and library projects (see issue 26029). Some lint checks, such as the MergeRootFrameLayoutDetector, computes the warnings at the end of processing all files. At that point, the context points to the master project, so any errors which were actually found in a library project will instead be using the master project's configuration. That means that any suppress rules applies to the lint.xml in the library project will be ignored. This changeset fixes this by moving the logic which looks up the severity for a warning out of the lint clients and into the context. Now it checks the current projects being scanned and looks up the corresponding project for each file (based on the file prefix), and retrieves the configuration that way. This changeset also makes one more fix: It now consults *both* the library project *and* the master project to see if a rule should be ignored. This means that if you turn off a given check in your master project, you will no longer see those warnings from library projects either, which seems desirable. Change-Id: Icb5cdf7696b4908b0553f86896793515cb06f29c
|
c8093812d52bcb39d74a9674c80f68426ce2c5b7 |
|
27-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Fix 26029: Lint in r17 preview ignores per-project lint.xml Change-Id: Idc1d27a727a24230ae2fcc58dbd2f08673425100
|
0fe590d956435c3c6a2d4c802108f627b173a573 |
|
24-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Lint bug fixes This changeset fixes a couple of Lint bugs: (1) Handle BOMs (byte order marks) in Java files. We already handle this for XML files (where it's common) but these can be present in other file types as well, such as Java. See http://code.google.com/p/android/issues/detail?id=25952 (2) Fix a bug (false positive) in the FloatMath detector; the visitor approach can get confused; do simple ASM node iteration instead (which is how all the other detectors work; this detector was written before we had the ASM DOM model) Change-Id: I65b4e6cd8d8e6c7e591433d8eb5aedf273e2caad
|
c8e42c3bfdef4941696155e5b333dd6d4075bbf0 |
|
23-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Handle nulls from Element.getAttribute (fix for issue 25668) Element.getAttribute isn't supposed to return null, but in Eclipse it sometimes does. It was common in 3.5.2, which we've dropped support for, but issue 25668 shows that it can happen in Eclipse 3.7.1 too though it's rare. This changeset attempts to address the issue in two ways: (1) Spotfix the specific NPE (2) Hold the readlock on the XML document while the detectors are using the DOM nodes (this is in case the nulls are related to this, which is not certain given that the issue is rare and not reproducible) Change-Id: I14727531ea9e08abf45d70013248e702cf5a15eb
|
105dc49ddd885c07b520dd343aa326c306d2c3de |
|
21-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Fix lint library project configuration handling 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
|
5da3610b249d74267a67a6b48acdf4cc95475bc0 |
|
13-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Add Fatal severity 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
|
3e10306ab1812b2c141e75fb36e2f5c92eeefd28 |
|
11-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Make lint process Java jar dependencies 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
|
c4afe8248f8369fa414f863bc0e13cbcdc3e9b90 |
|
04-Feb-2012 |
Tor Norbye <tnorbye@google.com> |
Fix type in Java parser interface Change-Id: Ic08e20bf6d729362fae7d82c84e664e05b6ba843
|
cb3bddedd22155d23f741e764168174c3e223807 |
|
27-Jan-2012 |
Tor Norbye <tnorbye@google.com> |
API check hooked up to lint 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
|
5dc20a5c893caa37deff6b2f9f928e571027a137 |
|
25-Jan-2012 |
Tor Norbye <tnorbye@google.com> |
Add file resource lookup to the Lint Client API This allows lint detector code to load file resources bundled with the tools (such as a permissions database file). Change-Id: If740206e8e0c5feeaf0e908bf823135114c9bd0d
|
a2a7d644db6b742fda413600f62c64c1133a6c21 |
|
27-Jan-2012 |
Tor Norbye <tnorbye@google.com> |
Fix a few misc Lint issues First, stop reporting Java-related parser errors as lint errors. Lombok fails to parse a few files (see http://code.google.com/p/projectlombok/issues/detail?id=311) and even when it fails, the error messages aren't useful (see http://code.google.com/p/projectlombok/issues/detail?id=313). Second, the XML parser could throw an exception in some circumstances, because it passes invalid column numbers at the end of the file. This CL guards against that (and against any other potential errors by wrapping all exceptions during parsing as a SAXEception). Finally, fix the positions reported in text nodes for the ExtraText check such that it points to the line containing the extra text, not the beginning of the text node (which is frequently the previous line). Change-Id: I9630ea49d30d8afdc8bd9cf2c87ca0a0306b8ec5
|
e50549f54810c29bffc681e39d33158ab2a8f26e |
|
10-Jan-2012 |
Raphael <raphael@google.com> |
ADT: Change LayoutEditor to use new editor delegates. Change-Id: I5624d8f5c393a74a808d98e465f0ebc6db91d741
|
37d5a9bbdc2895921cd0f636777efe2d3bad4e5b |
|
09-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
Add lint checks: String format, Casts, Security, Imports, /sdcard This changeset adds several new Java parsetree-based lint detectors: (1) String format checker. This checks several issues related to formatting strings (%1$s), such as - Is the string format valid? - Is the string format consistent between different translations, e.g. if argument #1 is of type "s" in locale A, is it also of type "s" in locale B? - Is the string format being called from Java with arguments of the right type? - Are strings which are not supposed to be formatted (e.g. ends with a %) passed to String.format? (2) View Cast checker. Looks at the views associated with specific id's in layouts, and makes sure that any casts to views returned by findViewById in Java is cast-compatible with the type in the layout. For example, if you have a layout containing a <Button id="foo">, then a cast to an EditText of findViewById(R.id.foo) would be invalid. (3) A security check which flags file creation calls that pass a context of world-writeable. (4) An "import android.R" checker. This looks for "import android.R" in .java files and warns that this is potentially confusing. (5) A hardcoded "/sdcard" string checker which looks for this prefix in string literals and when found warns that the method Environment.getExternalStorageDirectory().getPath() should be used instead. Change-Id: I14a4656f0ff6a58f25cde1b4bb23f6c47c47fdba
|
14312a9603fab9e711639cfc19d5ea1de17250b1 |
|
02-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
Lint Java source support This changeset adds Java AST support to Lint. There are new interfaces for Java parser and specialized Java detectors. Java detectors can either visit a full parse tree, or they can register interest in specific methods, or Android resource references, or specific AST node types -- or a combination of these. They will then be invoked during an AST visit with the relevant info. This changeset also rewrites the existing detectors that were using String-based pattern checking on Java files to using real AST traversal instead (and it removes the custom Eclipse-specific unused resource detector since the plain one now does the same AST-based analysis that the Eclipse one did.) Change-Id: I4d85f8b785bf41a88dbb29e7017b9c0f588880bc
|
4c68f3dc9f10b76f1a32ff9c86587adca385a6d7 |
|
14-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
Lint Library Support This changeset adds support for library projects to lint. Lint now checks all the library projects for errors as well, and projects that depend on global analysis (such as the unused resource detector) will properly handle resource declarations and references across projects. This changeset also cleans up the multi-project handling for the Lint window in Eclipse. The "Run Lint" toolbar action, in addition to operating on multiple selection, now has a dropdown menu for choosing which projects to check (and there are also actions for checking all projects, the current file, and clearing markers). Running lint on a project will also automatically include dependent library projects. Finally, some misc UI improvements: The Lint preference dialog includes buttons for quickly enabling and disabling all the checks; the Lint View includes a Project column which is shown when more than one project is checked, and the file and linenumber columns are now blank when the location does not correspond to a specific file. Change-Id: I733f5258102dfb0aebbc2b75cb02b9ba6ef974e8
|
581ca2e75fd638f6e95570ac54ff9e6b7b7cde84 |
|
06-Jan-2012 |
Tor Norbye <tnorbye@google.com> |
Extract positional XML parser into common and fix encoding issues The XML DOM parser used by the lint CLI driver (which tracks positions) is needed outside of lint, so pull it out of the lint/cli project, and refactor it such that it does not directly reference the lint Position APIs (but can utilize them when subclassed in lint). In addition, handle non-UTF-8 file encodings. XML files can be encoded in other character sets, and can specify this via the encoding attribute in the XML prologue. Until now, the CLI lint runner would just read the XML file contents in using the default encoding and parse this. Now there's a new utility method which takes a byte[] and infers the desired encoding and uses that to convert the byte[] into a string using the correct encoding. (We can't just pass an InputStream and let the SAX parser handle this on its own because the XML parser needs to access the character stream in order to assign correct node offsets.) This code now also handles the byte order mark more cleanly. There are some new unit tests too to check the new encoding, BOM and offset handling. Change-Id: Ib0badbbe72172e3408c6d5af2413be51280a7724
|
02e16b51b3986082e14e6121dde71db1898f6d60 |
|
04-Jan-2012 |
Tor Norbye <tnorbye@google.com> |
Add "Extra Text" lint detector. This new lint check looks for XML text content in resource files where text is not expected, such as layout files. This is typically the result of a typo. This CL also improves the command line XML parser's position handling such that it can handle positions on text nodes (until now it just supported element and attribute positions), and similarly for Eclipse. Change-Id: I6f69a8dc725a5b5b19f8ad5bb889ae25ee82600a
|
ab36f4e7488358dea4ab6b54ee2b7bef3da0232b |
|
21-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
Update SDK codebase to JDK 6 This changeset makes the SDK codebase compile with source=1.6 (which means it also requires JDK 6). This means that methods implementing an interface requires @Override's. It also means we can start using APIs like the ArrayDeque class and methods like String#isEmpty(). This changeset looks big but the change is trivial: it's basically adding @Override in all the places that need it, along with some other automatic Eclipse cleanup in certain files (such as reordering imports where they were incorrectly ordered (because older versions of Eclipse didn't always handle inner classes right)), as well as cleaning up trailing whitespace and removing some $NON-NLS-1$ markers on lines where there aren't any string literals anymore. This changeset also sets the source and target JDK level to 6 in the Eclipse compiler .settings file, and synchronizes this file to all the other Eclipse SDK projects. Change-Id: I6a9585aa44c3dee9a5c00739ab22fbdbcb9f8275
|
402af1286193f536946b36979b259511d6a9bb06 |
|
20-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
Fix 23215: "Run Android Lint" throws errors to Java Error Log Make sure that an IResource is accessible before attempting to add a marker to it. And if it isn't, just add the markers to the original resource (usually the project) instead. Change-Id: I679a249ed6e4280f46f041f15990ab79091c4f39
|
b45957a134d6fd6184348387fd0f0b14ffa7021c |
|
09-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
A few misc lint fixes Change-Id: Idc81f7a2d033675a03209eeabda0216babc35ebe
|
3ce45b249f898697ae82e8c6dd045966227f3438 |
|
02-Dec-2011 |
Tor Norbye <tnorbye@google.com> |
Lint infrastructure improvements This changeset fixes a bunch of issues in the infrastructure: (1) It cleans up the Context class quite a bit. It had some hardcoded XML stuff in it, which is now in a separate XmlContext class (and there will be a JavaContext class in the Java support CL). It also hides a bunch of public fields, cleans up some unused stuff, and introduces a couple of wrapper methods to make detector code cleaner; in particular, rather than calling context.client.report(context, ... you can now just call context.report(... and similarly there are wrappers for logging and checking for disabled issues. (2) The IParser interface is renamed to IDomParser since in the next CL there will also be an IJavaParser. Some other related cleanup. (3) There is now a "Location.Handle" interface. This allows detectors to create light-weight location holders, and later on call handle.resolve() to create a full-fledged Location. This is useful when detectors don't yet know whether they'll need a location for a node, but want to store it for later in case they do. As an example, the unused resource detector creates location handles for declaration and only resolves full locations for those that are found to be unused. Locations can now carry custom messages. For example, for a duplicate id error, the secondary location now contains a "original declaration here" message. And the CLI and HTML reports now include alternate locations in the output. Some other location cleanup too; using factory methods to make the code cleaner, some default implementations that can be shared, etc. (4) There's a new SDK info class intended to provide SDK information from a tool client (such as resource resolution). It currently just contains parent-view information, used for the ObsoleteLayoutParams detector and an upcoming CL for a ViewTypeDetector. (5) The Detector class now provides dummy implementations for the inner-interfaces, so we no longer need the adapter classes. This makes it easy to implement the XmlScanner or JavaScanner interfaces without needing to also stub out a bunch of methods. Change-Id: I4b3aaabe51febb25b000f9086703653bea6cf7c9
|
23f0d6a5e0d332d7a29f8d320b9c33badfae9451 |
|
25-Nov-2011 |
Tor Norbye <tnorbye@google.com> |
Fix a few lint bugs reported by early access users Change-Id: I3f7d64737bdb1205dd147c9e071d56d33fb072c5
|
229581314076be1b6f82fe1efed2bd00da340899 |
|
07-Nov-2011 |
Tor Norbye <tnorbye@google.com> |
Lint Architecture Changes: Configurations, Categories, etc. This changeset makes various architectural changes to lint: (1) Add configurations, which are basically user preferences for lint in a given project, such as providing a custom severity for an issue, or disabling a specific warning in a specific file. In Eclipse, there is a project configuration (stored in lint.xml in each project), as well as a global configuration (stored using Eclipse preference data). Project configurations inherit from the global configuration. The options dialog now shows up both as a project property page (showing the issue state for the project configuration), as well as a normal preference page (showing the global or "fallback" configuraiton). I also changed the Options UI for issues from a Table to a TreeViewer to add in category nodes, and changed the checkbox UI to have a custom severity toggle instead. The lint quickfixes also now have 3 suppression options: * Ignore in this file * Ignore in this project * Disable check (2) Change detectors to be registered by class and instantiated for each lint run rather than having a fixed list of detectors get reused over and over. Turns out that since some detectors store state, this prevented lints from running concurrently since the two runs could stomp each other's state. To do this effectively I've also switched from a DetectorRegistry to an IssueRegistry, which contains the global list of available issues and each issue can point to the class detecting the issue (and these are created on the fly based on parameters like scope.) (3) Explicit Categories. Categories used to just be a string property on issues; now it's an explicit class with both a name and an explanation, with parents to allow nesting (such that for example the Usability category has an Icons sub category), and finally the category class provides sorting. Categories also show up in the HTML Report now as separate sections. (4) Other API changes: * I changed the package containing APIs for lint clients to an explicit "client" package * Moved the LintConstants class up from lint-checks to lint-api and added a LintUtils class which contains many generic methods that were spread around in specific detectors. * The detectors are now talking to a wrapper client rather than directly to lint clients, such that the wrapper client can filter out results on disabled checks etc, which means that tools can assume they always get correct reports and don't have to worry about improperly written detectors. * I renamed ToolContext to LintClient. * I got rid of the "isEnabled" state, which was a bit redundant with the severity since severity has a Severity.IGNORE value. * I added a LintListener interface, which notifies about progress (and the CLI tool will print "."'s for each processed file unless suppressed with -q). * A new dispose method on the parser interface to for example allow IDEs to lock/unlock read models on underlying data. (5) I added a toolbar action for running Lint on the currently selected project. I also added an --xml export option intended for use with CI plugins. Change-Id: Icadd9b2d14d075234d97b31398806111af747b7b
|