aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/skylark
Commit message (Collapse)AuthorAge
...
* Skylint: check that load statements are at the top of the fileGravatar fzaiser2017-09-27
| | | | | RELNOTES: none PiperOrigin-RevId: 170057295
* Skylint: add flag to disable certain checkers.Gravatar fzaiser2017-09-21
| | | | | RELNOTES: none PiperOrigin-RevId: 169518230
* Skylint: be less strict about indentation in docstringsGravatar fzaiser2017-09-21
| | | | | | | | | | | | 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
* Skylint: fix a NullPointerExceptionGravatar fzaiser2017-09-20
| | | | | RELNOTES: none PiperOrigin-RevId: 169363593
* Skylint: report missing documentation for a function's return valueGravatar fzaiser2017-09-14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Skylint: improve the naming conventions checkerGravatar fzaiser2017-09-12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Skylint: add main linter class and clean up BUILD filesGravatar fzaiser2017-09-08
| | | | | RELNOTES: none PiperOrigin-RevId: 167846717
* Replace ad hoc wrapper classes with Equivalence.WrapperGravatar brandjon2017-09-07
| | | | | | | | | 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
* Skylint: add lint for uninitialized variablesGravatar fzaiser2017-09-06
| | | | | RELNOTES: none PiperOrigin-RevId: 167614625
* Skylint: check the documentation of parameters in function docstringsGravatar fzaiser2017-09-04
| | | | | RELNOTES: none PiperOrigin-RevId: 167502103
* Skylint: add lint to check for unreachable statementsGravatar fzaiser2017-09-04
| | | | | RELNOTES: none PiperOrigin-RevId: 167501207
* Remove the Dialect type from the Parser.Gravatar laurentlb2017-09-01
| | | | | | | | Let's use the same parser. Dialect differences are checked in a separate validation pass. RELNOTES: None. PiperOrigin-RevId: 167280201
* Skylint: add a lint that reports unused identifiersGravatar fzaiser2017-08-31
| | | | | RELNOTES: None PiperOrigin-RevId: 167134267
* Skylint: handle for-loops in control flow lint correctlyGravatar fzaiser2017-08-31
| | | | | RELNOTES: none PiperOrigin-RevId: 167113866
* Make ControlFlowChecker follow the dataflow analysis idiom more closelyGravatar brandjon2017-08-31
| | | | | | | | | | | 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
* Skylint: add lint that checks for statements without effectsGravatar fzaiser2017-08-30
| | | | | | | | Statement expressions without function calls cannot have an effect and should be removed, e.g. literals like "['a', 'b']". RELNOTES: none PiperOrigin-RevId: 166990862
* Skylint: add lint for missing docstringsGravatar fzaiser2017-08-29
| | | | | RELNOTES: None PiperOrigin-RevId: 166846007
* Add a lint for missing return statementsGravatar fzaiser2017-08-28
| | | | | | | | 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
* Start work on the Skylark linter (skylint).Gravatar fzaiser2017-08-23
This commit introduces checking of naming conventions, i.e. upper and lower snake case. RELNOTES: None PiperOrigin-RevId: 166073284