| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
This makes ControlFlowInfo an ADT handling its own join operation, and combines the list of return statements into that structure. This is less error-prone if a new field is added, and helps simplify the logic in visit(IfStatement).
The invariants regarding the cf field are also clarified: It is "transferred" (in dataflow analysis terminology) from the point before the node to the point after the node by the visit() function. It is also undefined (null) outside of a function definition.
There's a cost to this CL in terms of LOC and maybe even memory allocations, but I suspect that's outweighed by sticking to a known paradigm for flow analysis.
RELNOTES: None
PiperOrigin-RevId: 167005045
|
|
|
|
|
|
|
|
| |
Statement expressions without function calls cannot have an effect
and should be removed, e.g. literals like "['a', 'b']".
RELNOTES: none
PiperOrigin-RevId: 166990862
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 166846007
|
|
|
|
|
|
|
|
| |
This lint checks that if a functions returns a value in some execution
paths, it does so in all execution paths.
RELNOTES: None
PiperOrigin-RevId: 166688783
|
|
This commit introduces checking of naming conventions,
i.e. upper and lower snake case.
RELNOTES: None
PiperOrigin-RevId: 166073284
|