| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
| |
In many cases, users do:
d = depset()
d += ...
To catch this issue, we use a heuristic to find which variable is a depset
(in theory, it could be reassigned - but it's unlikely and that would be
error-prone anyway)
RELNOTES: None.
PiperOrigin-RevId: 179536463
|
|
|
|
|
|
|
| |
Also, minor fix for the += operator check.
RELNOTES: None.
PiperOrigin-RevId: 177444203
|
|
|
|
|
|
|
| |
Split missing-docstring into missing-module-docstring and missing-function-docstring.
RELNOTES: None.
PiperOrigin-RevId: 176993716
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 176899549
|
|
|
|
|
|
|
|
| |
Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own.
This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually.
PiperOrigin-RevId: 175033526
|
|
|
|
|
|
|
| |
While at it, I added a flag "--single-file" that turns on single file mode. In this mode, only the specified file will be read (there is no dependency analysis).
RELNOTES: none
PiperOrigin-RevId: 174888506
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 174479316
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 174330237
|
|
|
|
|
|
|
| |
quotes
RELNOTES: None
PiperOrigin-RevId: 174319420
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 174318660
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 174310059
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 174305935
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 174305030
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173846739
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173658526
|
|
|
|
|
|
|
| |
Mention the pattern for re-exporting symbols.
RELNOTES: none
PiperOrigin-RevId: 173658431
|
|
|
|
|
|
|
| |
While I was at it, I renamed a "*Tests" class to "*Test" for consistency.
RELNOTES: none
PiperOrigin-RevId: 173657530
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173261316
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173257316
|
|
|
|
|
|
|
| |
This used to be annoying for Skylint.
RELNOTES: none
PiperOrigin-RevId: 173249428
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173140830
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173125138
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173113056
|
|
|
|
|
|
|
| |
In the process, I refactored and extended the line handling and error reporting a little.
RELNOTES: none
PiperOrigin-RevId: 172760285
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 172599144
|
|
|
|
|
|
|
| |
The end location now ends before the first statement of the function.
RELNOTES: none
PiperOrigin-RevId: 172578911
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's good practice to place a "declaration" of a variable in a location that dominates all its uses, especially so if you want to document the variable. Hence we want no warning saying this declaration is unused.
Example:
var = None # don't warn about the unused declaration here
if condition:
var = 0
else:
var = 1
As noted in the code, this also has the undesired side-effect of suppressing the warning here:
var = None # doesn't warn either but ideally should
var = 0
Fixing the latter problem is not worth the increased code complexity, in my opinion.
RELNOTES: none
PiperOrigin-RevId: 172442402
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Global variables can have docstrings that are placed under their initialization.
Example:
variable = 0
"""Documentation for the variable.
Deprecated:
This variable is deprecated.
"""
Note that docstrings are not required, even for public variables. Hence there are no changes to the DocstringChecker.
RELNOTES: none
PiperOrigin-RevId: 172324350
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each docstring should include
1. a summary line
2. a more extensive description (optional)
3. an 'Args' section (if there are parameters)
4. a 'Returns' section (if there is a return value)
5. a 'Deprecated' section (if it is deprecated)
in this order. If the order is different, there will be a warning.
The same order is recommended for Java (http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#orderoftags).
RELNOTES: none
PiperOrigin-RevId: 172313475
|
|
|
|
|
|
|
| |
Having a short canonical name for each kind of finding (the category) makes it easier to document all the lints and for users to find the documentation for each lint.
RELNOTES: none
PiperOrigin-RevId: 171972645
|
|
|
|
|
|
|
| |
Previously, the location of the warning was the whole file. Now it is 1:1-2:1. This doesn't make sense if the file is empty but I think it's good enough since that's an edge case.
RELNOTES: none
PiperOrigin-RevId: 171942703
|
|
|
|
|
|
|
| |
This only covers functions deprecated in the same file. It does not yet recognize load()ed functions that are deprecated in another file.
RELNOTES: none
PiperOrigin-RevId: 171841455
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 171532870
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 171526636
|
|
|
|
|
|
|
|
| |
So far, only checks for usages of '+' on dictionary literals and
comprehensions.
RELNOTES: none
PiperOrigin-RevId: 170336917
|
|
|
|
|
|
|
|
| |
Often the author of a file doesn't have control over the naming in its
dependencies, so we shouldn't warn about these.
RELNOTES: none
PiperOrigin-RevId: 170062766
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 170057295
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 169518230
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of enforcing two spaces of indentation, we now
only enforce a positive number of spaces in indented lines.
Reason: Apparently, a lot of docstrings in Skylark files
are badly indented, so we should only warn about the
worst offenders until a formatting tool is available.
RELNOTES: none
PiperOrigin-RevId: 169429429
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 169363593
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In addition to checking the function parameter documentation,
skylint now also checks whether the return value is documented in a
'Returns:' section in the docstring.
The same restrictions as for parameters apply:
- Private functions need no documentation
- If a function has a single line docstring, it need not document the
return value.
In addition, I improved the docstring parsing:
- Previously, the beginning and end of a section (e.g. 'Args:',
'Returns:') were determined by line breaks. Now, they're determined by
indentation and missing line breaks are reported. This change should
make the docstring parser more robust.
- Additional indentation is not warned against anymore.
There are many situations where it makes sense, like example code.
Both of these changes were motivated by the results of the linter on
Skylark files "in the wild".
RELNOTES: none
PiperOrigin-RevId: 168660248
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes in behavior:
* Local variables are also allowed to be UPPER_SNAKE_CASE.
Upper case means that they're constants but this is not checked yet.
* Providers are required to be UpperCamelCase. A variable FooBar
is considered a provider if it appears in an assignment of the form
"FooBar = provider(...)"
* Shadowing of builtins (e.g. "True = False", "def fail()") is
not allowed
* The single-letter variable names 'O', 'l', 'I' are disallowed
since they're easy to confuse
* Multi-underscore names ('__', '___', etc.) are disallowed
* Single-underscore names may only be written to, as in
a, _ = tuple
They may not be read, as in "f(_)".
In the process, I also moved some code from UsageChecker to
AstVisitorWithNameResolution to prevent duplication in
NamingConventionsChecker.
RELNOTES: none
PiperOrigin-RevId: 168250396
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 167846717
|
|
|
|
|
|
|
|
|
| |
The tradeoff is that it eliminates a class but makes type signatures slightly more complicated. I think it's a net win because we avoid implementing equals/hashCode.
I figured helper methods for wrapping/unwrapping were better than relying on the caller to know what Equivalence to use ("identity").
RELNOTES: None
PiperOrigin-RevId: 167750079
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 167614625
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 167502103
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 167501207
|
|
|
|
|
|
|
|
| |
Let's use the same parser. Dialect differences are checked in a separate
validation pass.
RELNOTES: None.
PiperOrigin-RevId: 167280201
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 167134267
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 167113866
|