docstring_linter: Fix #151692 and other issues (#156596)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156596
Approved by: https://github.com/eellison
This commit is contained in:
Tom Ritchford
2025-08-25 12:01:29 +00:00
committed by PyTorch MergeBot
parent ab8d60f4c8
commit 83283ce7f5
17 changed files with 409 additions and 429 deletions

View File

@ -14,6 +14,9 @@ if TYPE_CHECKING:
from tokenize import TokenInfo
_OVERRIDES = {"@override", "@typing_extensions.override", "@typing.override"}
@total_ordering
@dc.dataclass
class Block:
@ -68,11 +71,20 @@ class Block:
@property
def start_line(self) -> int:
return self.tokens[max(self.indent, self.index)].start[0]
"""The line number for the def or class statement"""
return self.tokens[self.begin].start[0]
@property
def end_line(self) -> int:
return self.tokens[max(self.dedent, self.index)].start[0]
if 0 <= self.dedent < len(self.tokens):
return self.tokens[self.dedent].start[0] - 1
else:
return self.tokens[-1].start[0]
# Only happens in one case so far: a file whose last line was
#
# def function(): ...
#
# and the dedent correctly pointed to one past the end of self.tokens
@property
def line_count(self) -> int:
@ -99,9 +111,7 @@ class Block:
@cached_property
def is_override(self) -> bool:
return not self.is_class and any(
d.rpartition(".")[2] == "override" for d in self.decorators
)
return not self.is_class and bool(_OVERRIDES.intersection(self.decorators))
DATA_FIELDS = (
"category",
@ -149,9 +159,9 @@ def _get_decorators(tokens: Sequence[TokenInfo], block_start: int) -> list[str]:
def decorators() -> Iterator[str]:
rev = reversed(range(block_start))
newlines = (i for i in rev if tokens[i].type == token.NEWLINE)
newlines = itertools.chain(newlines, [-1]) # To account for the first line
it = iter(itertools.chain(newlines, [-1]))
# The -1 accounts for the very first line in the file
it = iter(newlines)
end = next(it, -1) # Like itertools.pairwise in Python 3.10
for begin in it:
for i in range(begin + 1, end):

View File

@ -1,150 +1,112 @@
{
"torch/_inductor/async_compile.py": {
"class AsyncCompile": 281
},
"torch/_inductor/autoheuristic/artifacts/_MMRankingA100.py": {
"class MMRankingA100": 278,
"class MMRankingA100": 279,
"def MMRankingA100.fill_choices()": 199
},
"torch/_inductor/autoheuristic/artifacts/_MMRankingH100.py": {
"class MMRankingH100": 303,
"class MMRankingH100": 304,
"def MMRankingH100.fill_choices()": 203
},
"torch/_inductor/autoheuristic/artifacts/_MixedMMA100.py": {
"class MixedMMA100": 132,
"class MixedMMA100": 133,
"def MixedMMA100.get_best_choices()": 85
},
"torch/_inductor/autoheuristic/artifacts/_MixedMMH100.py": {
"class MixedMMH100": 131,
"class MixedMMH100": 132,
"def MixedMMH100.get_best_choices()": 85
},
"torch/_inductor/autotune_process.py": {
"class CUDABenchmarkRequest": 115,
"class TritonBenchmarkRequest": 121,
"def TritonBenchmarkRequest.make_run_fn()": 81
},
"torch/_inductor/bounds.py": {
"class ValueRangeAnalysis": 107
},
"torch/_inductor/codecache.py": {
"class AotCodeCompiler": 516,
"class CUDACodeCache": 107,
"class CppCodeCache": 125,
"class CppPythonBindingsCodeCache": 168,
"class HalideCodeCache": 350
"class CppPythonBindingsCodeCache": 179,
"class HalideCodeCache": 357,
"class PyCodeCache": 102
},
"torch/_inductor/codegen/common.py": {
"class CSE": 167,
"class CSEProxy": 310,
"class CSEProxy": 316,
"class Kernel": 286,
"class KernelArgs": 325,
"class OpOverrides": 227
"class KernelArgs": 332,
"class OpOverrides": 198
},
"torch/_inductor/codegen/cpp.py": {
"class CppKernel": 572,
"class CppKernelProxy": 601,
"class CppKernelProxy": 617,
"class CppOverrides": 429,
"class CppScheduling": 777,
"class CppVecKernel": 857,
"class CppScheduling": 786,
"class CppVecKernel": 865,
"class OuterLoopFusedSchedulerNode": 159,
"def CppKernel.codegen_loops_impl()": 144,
"def CppKernelProxy.codegen_functions()": 183,
"def CppKernelProxy.legalize_lowp_fp_dtype_loopbody()": 224,
"def CppScheduling.fuse()": 81,
"def CppVecKernel.reduction()": 193,
"def CppVecKernel.reduction_combine_vec()": 87,
"def TilingSelect.select_tiling()": 165
"def CppVecKernel.reduction_combine_vec()": 100,
"def OuterLoopFusedSchedulerNode.check_outer_fusion_loop_level_attr()": 85,
"def TilingSelect.select_tiling()": 170
},
"torch/_inductor/codegen/cpp_flex_attention_template.py": {
"class CppFlexAttentionTemplate": 374,
"def CppFlexAttentionTemplate.modification()": 94
"class CppFlexAttentionTemplate": 403,
"def CppFlexAttentionTemplate.modification()": 102
},
"torch/_inductor/codegen/cpp_gemm_template.py": {
"class CppGemmTemplate": 998,
"def CppGemmTemplate.add_choices()": 163,
"def CppGemmTemplate.get_options()": 243
"def CppGemmTemplate.get_options()": 249
},
"torch/_inductor/codegen/cpp_grouped_gemm_template.py": {
"def CppGroupedGemmTemplate.add_choices()": 141,
"def CppGroupedGemmTemplate.render()": 146
},
"torch/_inductor/codegen/cpp_micro_gemm.py": {
"def create_micro_gemm()": 94
"def CppGroupedGemmTemplate.add_choices()": 154,
"def CppGroupedGemmTemplate.render()": 153
},
"torch/_inductor/codegen/cpp_template.py": {
"class CppTemplate": 114
},
"torch/_inductor/codegen/cpp_template_kernel.py": {
"class CppTemplateKernel": 469,
"def CppTemplateKernel.store_outputs()": 102
"class CppTemplateKernel": 499,
"def CppTemplateKernel.store_outputs()": 111
},
"torch/_inductor/codegen/cpp_utils.py": {
"def create_epilogue_with_attr()": 165
},
"torch/_inductor/codegen/cpp_wrapper_cpu.py": {
"def CppWrapperCpu.generate_extern_kernel_args_decl_if_needed()": 152,
"def CppWrapperCpu.generate_input_output_runtime_checks()": 115,
"def CppWrapperCpu.generate_py_arg()": 96,
"def CppWrapperCpu.val_to_arg_str()": 88,
"def CppWrapperCpu.write_wrapper_decl()": 140
},
"torch/_inductor/codegen/cpp_wrapper_cpu_array_ref.py": {
"def CppWrapperCpuArrayRef.generate_return()": 127,
"def CppWrapperCpuArrayRef.generate_return()": 128,
"def CppWrapperCpuArrayRef.write_wrapper_decl()": 208
},
"torch/_inductor/codegen/cuda/cutlass_lib_extensions/gemm_operation_extensions.py": {
"def EmitGemmUniversal3xInstanceWithEVT.emit()": 98
},
"torch/_inductor/codegen/cuda/device_op_overrides.py": {
"class CUDADeviceOpOverrides": 222,
"def CUDADeviceOpOverrides.tma_descriptor_helpers()": 102
},
"torch/_inductor/codegen/cuda/gemm_template.py": {
"class CUTLASS2xGemmTemplate": 265,
"class CUTLASS3xGemmTemplate": 326
"class CUTLASS2xGemmTemplate": 267
},
"torch/_inductor/codegen/debug_utils.py": {
"class DebugPrinterManager": 228
"class DebugPrinterManager": 229
},
"torch/_inductor/codegen/halide.py": {
"class HalideKernel": 982,
"class HalideOverrides": 329,
"class HalideKernel": 984,
"class HalideOverrides": 325,
"class HalidePrinter": 129,
"def HalideKernel.halide_kernel_meta()": 82
},
"torch/_inductor/codegen/mps.py": {
"class MetalKernel": 354,
"class MetalOverrides": 335,
"def MetalKernel.reduction()": 109
"def HalideKernel.halide_kernel_meta()": 82,
"def HalideKernel.scan()": 82
},
"torch/_inductor/codegen/rocm/ck_conv_template.py": {
"class CKGroupedConvFwdTemplate": 531,
"def CKGroupedConvFwdTemplate.globals()": 143
"class CKGroupedConvFwdTemplate": 544,
"def CKGroupedConvFwdTemplate.globals()": 145
},
"torch/_inductor/codegen/rocm/ck_universal_gemm_template.py": {
"class CKGemmTemplate": 947
"class CKGemmTemplate": 950
},
"torch/_inductor/codegen/rocm/rocm_benchmark_request.py": {
"class ROCmBenchmarkRequest": 117
},
"torch/_inductor/codegen/simd.py": {
"class IterationRangesRoot": 122,
"class SIMDScheduling": 1054,
"def SIMDScheduling.candidate_tilings()": 126,
"def SIMDScheduling.generate_node_schedule()": 95
},
"torch/_inductor/codegen/triton.py": {
"class BlockPtrOptions": 272,
"class TritonKernel": 2455,
"class TritonOverrides": 505,
"class TritonKernel": 2562,
"class TritonOverrides": 469,
"class TritonPrinter": 172,
"class TritonScheduling": 396,
"def TritonKernel.codegen_kernel()": 222,
"def TritonKernel.codegen_kernel()": 233,
"def TritonKernel.codegen_kernel_benchmark()": 89,
"def TritonKernel.load()": 134,
"def TritonKernel.reduction()": 383,
"def TritonKernel.scan()": 103,
"def TritonScheduling.benchmark_codegened_module()": 83,
"def TritonKernel.load()": 145,
"def TritonKernel.reduction()": 396,
"def TritonKernel.scan()": 110,
"def TritonScheduling.benchmark_codegened_module()": 85,
"def TritonScheduling.benchmark_combo_kernel()": 91
},
"torch/_inductor/codegen/triton_combo_kernel.py": {
@ -156,49 +118,42 @@
},
"torch/_inductor/codegen/wrapper.py": {
"def PythonWrapperCodegen.benchmark_compiled_module()": 92,
"def PythonWrapperCodegen.define_user_defined_triton_kernel()": 249,
"def PythonWrapperCodegen.generate_example_arg_value()": 83,
"def user_defined_kernel_grid_fn_code()": 96
"def PythonWrapperCodegen.define_user_defined_triton_kernel()": 266,
"def PythonWrapperCodegen.generate_example_arg_value()": 84,
"def user_defined_kernel_grid_fn_code()": 102
},
"torch/_inductor/comm_lowering.py": {
"def register_comm_lowerings()": 189
"def register_comm_lowerings()": 192
},
"torch/_inductor/comms.py": {
"def enforce_comm_ordering_for_fsdp()": 170,
"def reinplace_fsdp_all_gather()": 110
"def enforce_comm_ordering_for_fsdp()": 174,
"def reinplace_fsdp_all_gather()": 106
},
"torch/_inductor/compile_fx.py": {
"def _InProcessFxCompile.codegen_and_compile()": 379,
"def fw_compiler_freezing()": 93
},
"torch/_inductor/config.py": {
"class cpp": 107,
"class triton": 182
"def fw_compiler_freezing()": 101
},
"torch/_inductor/constant_folding.py": {
"class ConstantFolder": 223,
"class ConstantFolder": 226,
"def ConstantFolder.run_node()": 94
},
"torch/_inductor/cpu_vec_isa.py": {
"class VecISA": 120
"class VecISA": 125
},
"torch/_inductor/debug.py": {
"class DebugContext": 158,
"class DebugFormatter": 189,
"def DebugFormatter.log_autotuning_results()": 81
"class DebugContext": 155,
"class DebugFormatter": 172,
"def DebugFormatter.log_autotuning_results()": 90,
"def aot_inductor_minifier_wrapper()": 81
},
"torch/_inductor/dependencies.py": {
"class MemoryDep": 225
"class MemoryDep": 234
},
"torch/_inductor/fx_passes/b2b_gemm.py": {
"def b2b_gemm_handler()": 180
"def b2b_gemm_handler()": 182
},
"torch/_inductor/fx_passes/binary_folding.py": {
"def binary_folding_init()": 416
},
"torch/_inductor/fx_passes/freezing_patterns.py": {
"def addmm_patterns_init()": 94
},
"torch/_inductor/fx_passes/group_batch_fusion.py": {
"def BatchLayernormFusion.fuse()": 131,
"def PostGradBatchLinearFusion.fuse()": 83,
@ -206,134 +161,107 @@
},
"torch/_inductor/fx_passes/joint_graph.py": {
"def constant_fold_uniform_value()": 109,
"def remove_no_ops()": 93
"def remove_no_ops()": 97
},
"torch/_inductor/fx_passes/micro_pipeline_tp.py": {
"def find_all_gather_patterns()": 116,
"def find_reduce_scatter_patterns()": 125
},
"torch/_inductor/fx_passes/post_grad.py": {
"def lower_scan_to_while_loop()": 154
},
"torch/_inductor/fx_passes/split_cat.py": {
"def SplitCatSimplifier.replace_cat()": 145,
"def SplitCatSimplifier.replace_cat()": 152,
"def merge_getitem_cat()": 97,
"def merge_split_cat_aten()": 87,
"def merge_split_cat_aten()": 91,
"def move_reshape_out_of_split_stack()": 110
},
"torch/_inductor/fx_utils.py": {
"def FakeTensorUpdater.incremental_update()": 100
},
"torch/_inductor/graph.py": {
"class GraphLowering": 2032,
"def GraphLowering.call_function()": 116,
"def GraphLowering.extract_autotune_inputs()": 90,
"def GraphLowering.output()": 87,
"def GraphLowering.placeholder()": 92,
"def GraphLowering.run_node()": 380
"class GraphLowering": 2144,
"def GraphLowering.call_function()": 112,
"def GraphLowering.create_deferred_runtime_asserts()": 84,
"def GraphLowering.extract_autotune_inputs()": 93,
"def GraphLowering.output()": 92,
"def GraphLowering.placeholder()": 102,
"def GraphLowering.run_node()": 361
},
"torch/_inductor/ir.py": {
"class Buffer": 122,
"class ComputedBuffer": 329,
"class Conditional": 138,
"class ExternKernel": 793,
"class FallbackKernel": 439,
"class FlexibleLayout": 139,
"class IRNode": 244,
"class Layout": 202,
"class Loops": 128,
"class Reduction": 737,
"class Buffer": 131,
"class ComputedBuffer": 350,
"class Conditional": 144,
"class ExternKernel": 866,
"class Layout": 214,
"class Loops": 130,
"class Reduction": 745,
"class Scan": 199,
"class Sort": 150,
"class UserDefinedTritonKernel": 183,
"class View": 174,
"class Sort": 151,
"class UserDefinedTritonKernel": 198,
"class View": 180,
"class WelfordReduction": 221,
"class WhileLoop": 203,
"def ConcatKernel.create()": 95,
"def ExternKernel.process_kernel()": 110,
"def ExternKernel.require_strides()": 149,
"def FallbackKernel.create()": 81,
"def FallbackKernel.export_extern_kernel_node()": 82,
"def Reduction.create()": 136,
"def Reduction.num_splits()": 152,
"def Scan.create()": 83,
"def WelfordReduction.create()": 110,
"def WhileLoop.create()": 161
"class WhileLoop": 212,
"def ConcatKernel.create()": 101,
"def ExternKernel.process_kernel()": 120,
"def ExternKernel.require_strides()": 162,
"def Reduction.create()": 159,
"def Reduction.num_splits()": 161,
"def Scan.create()": 96,
"def WelfordReduction.create()": 119,
"def WhileLoop.create()": 174
},
"torch/_inductor/jagged_lowerings.py": {
"def register_jagged_ops()": 156
},
"torch/_inductor/kernel/bmm.py": {
"def tuned_bmm()": 91
"def register_jagged_ops()": 160
},
"torch/_inductor/kernel/conv.py": {
"def convolution()": 231
"def convolution()": 239
},
"torch/_inductor/kernel/mm.py": {
"def tuned_addmm()": 169,
"def tuned_mm()": 127,
"def tuned_scaled_mm()": 130
"def tuned_addmm()": 151
},
"torch/_inductor/loop_body.py": {
"class CaptureIndexing": 174
},
"torch/_inductor/lowering.py": {
"def avg_pool2d_backward()": 155,
"def avg_pool3d_backward()": 189,
"def avg_pool2d_backward()": 164,
"def avg_pool3d_backward()": 198,
"def cat()": 123,
"def index_put_impl_()": 125,
"def index_put_impl_()": 127,
"def make_pointwise()": 85,
"def max_pool2d_with_indices_backward()": 140,
"def scatter_reduce_()": 111,
"def sdpa_constraint()": 132,
"def searchsorted()": 84
"def max_pool2d_with_indices_backward()": 144,
"def scatter_reduce_()": 114,
"def sdpa_constraint()": 135,
"def searchsorted()": 96
},
"torch/_inductor/mkldnn_ir.py": {
"class MkldnnRnnLayer": 114
"class MkldnnRnnLayer": 116,
"def MkldnnRnnLayer.create()": 94,
"def QConvPointWiseBinaryPT2E.create()": 81
},
"torch/_inductor/mkldnn_lowerings.py": {
"def register_onednn_fusion_ops()": 1152
"def register_onednn_fusion_ops()": 1156
},
"torch/_inductor/mock_cache.py": {
"class PatchCaches": 108
},
"torch/_inductor/pattern_matcher.py": {
"class ReplacementPatternEntry": 196,
"def ReplacementPatternEntry.replace_with_graph()": 177
"class ReplacementPatternEntry": 202,
"def ReplacementPatternEntry.replace_with_graph()": 188
},
"torch/_inductor/quantized_lowerings.py": {
"def register_woq_mm_ops()": 136
"def register_woq_mm_ops()": 116
},
"torch/_inductor/runtime/autotune_cache.py": {
"class AutotuneCache": 190
"class AutotuneCache": 201
},
"torch/_inductor/runtime/benchmarking.py": {
"class InductorBenchmarker": 111
},
"torch/_inductor/scheduler.py": {
"class BaseSchedulerNode": 697,
"class BaseScheduling": 139,
"class Scheduler": 2568,
"class SchedulerBuffer": 103,
"class SchedulerNode": 256
"class BaseSchedulerNode": 695,
"class BaseScheduling": 142,
"class SchedulerBuffer": 106,
"class SchedulerNode": 268
},
"torch/_inductor/select_algorithm.py": {
"class AlgorithmSelectorCache": 694,
"class TritonTemplate": 224,
"class TritonTemplateKernel": 770,
"def AlgorithmSelectorCache.log_results()": 92,
"def AlgorithmSelectorCache.make_benchmark_fn[2]()": 145
},
"torch/_inductor/sizevars.py": {
"class SizeVarAllocator": 780
},
"torch/_inductor/template_heuristics.py": {
"class ROCmConfigHeuristic": 212
"def AlgorithmSelectorCache.log_results()": 108
},
"torch/_inductor/utils.py": {
"class IndentedBuffer": 136
},
"torch/_inductor/wrapper_benchmark.py": {
"def parse_profile_event_list()": 119
"class IndentedBuffer": 145
}
}
}

View File

@ -10,6 +10,7 @@ from typing import Any, Callable, TYPE_CHECKING
_FILE = Path(__file__).absolute()
_PATH = [Path(p).absolute() for p in sys.path]
_OVERRIDES = {"@override", "@typing_extensions.override", "@typing.override"}
if TYPE_CHECKING or _FILE.parent not in _PATH:
from . import _linter
@ -154,7 +155,7 @@ class DocstringLinter(_linter.FileLinter):
def _is_bad_block(self, b: _linter.Block, pf: _linter.PythonFile) -> bool:
max_lines = self._max_lines[b.category]
return (
not pf.omitted(pf.tokens, b.begin, b.dedent)
not (b.is_override or pf.omitted(pf.tokens, b.begin, b.dedent))
and b.line_count > max_lines
and len(b.docstring) < self.args.min_docstring
and (self.args.lint_local or not b.is_local)

View File

@ -1,10 +1,12 @@
{
"tools/test/docstring_linter_testdata/more_python_code.py.txt": {
"11": "class LintInit: lines=6, docs=0: (grandfathered)"
" 1": "def a_very_very_long(): lines=8, docs=0: (grandfathered)",
"10": "class LintInit: lines=6, docs=0: (grandfathered)"
},
"tools/test/docstring_linter_testdata/python_code.py.txt": {
"20": "class LongWithoutDocstring: lines=4, docs=0: (grandfathered)",
"25": "class LongWithShortDocstring: lines=6, docs=10: (grandfathered)",
"72": "def ImpossibleCombo.needs_docs(): lines=12, docs=0: (grandfathered)"
"17": "class LongWithoutDocstring: lines=6, docs=0: (grandfathered)",
"24": "class LongWithShortDocstring: lines=6, docs=10: (grandfathered)",
"54": "def long_without_docstring(): lines=7, docs=0: (grandfathered)",
"71": "def ImpossibleCombo.needs_docs(): lines=12, docs=0: (grandfathered)"
}
}

View File

@ -1,10 +1,12 @@
{
"tools/test/docstring_linter_testdata/more_python_code.py.txt": {
"11": "class LintInit: lines=6, docs=0: FAIL"
" 1": "def a_very_very_long(): lines=8, docs=0: FAIL",
"10": "class LintInit: lines=6, docs=0: FAIL"
},
"tools/test/docstring_linter_testdata/python_code.py.txt": {
"20": "class LongWithoutDocstring: lines=4, docs=0: FAIL",
"25": "class LongWithShortDocstring: lines=6, docs=10: FAIL",
"72": "def ImpossibleCombo.needs_docs(): lines=12, docs=0: FAIL"
"17": "class LongWithoutDocstring: lines=6, docs=0: FAIL",
"24": "class LongWithShortDocstring: lines=6, docs=10: FAIL",
"54": "def long_without_docstring(): lines=7, docs=0: FAIL",
"71": "def ImpossibleCombo.needs_docs(): lines=12, docs=0: FAIL"
}
}

View File

@ -1,3 +1,11 @@
tools/test/docstring_linter_testdata/more_python_code.py.txt:1: No docstring found for function 'a_very_very_long' (8 lines)
1 | def a_very_very_long():
^
2 | # Lots of lines!
3 | # Lots of lines!
4 | # Lots of lines!
5 | # Lots of lines!
tools/test/docstring_linter_testdata/more_python_code.py.txt:10: No docstring found for class 'LintInit' (6 lines)
8 |
9 |
@ -6,7 +14,7 @@ tools/test/docstring_linter_testdata/more_python_code.py.txt:10: No docstring fo
11 | def __init__(self) -> None:
12 | # Lots of lines!
tools/test/docstring_linter_testdata/python_code.py.txt:17: No docstring found for class 'LongWithoutDocstring' (4 lines)
tools/test/docstring_linter_testdata/python_code.py.txt:17: No docstring found for class 'LongWithoutDocstring' (6 lines)
15 |
16 |
17 | class LongWithoutDocstring:
@ -22,6 +30,14 @@ tools/test/docstring_linter_testdata/python_code.py.txt:24: docstring found for
25 | """TODO"""
26 |
tools/test/docstring_linter_testdata/python_code.py.txt:54: No docstring found for function 'long_without_docstring' (7 lines)
52 |
53 |
54 | def long_without_docstring():
^
55 | #
56 | #
tools/test/docstring_linter_testdata/python_code.py.txt:71: No docstring found for function 'needs_docs' (12 lines). If the method overrides a method on a parent class, adding the `@typing_extensions.override` decorator will make this error go away.
69 | """This docstring, while short, is enough"""
70 |

View File

@ -1,10 +1,12 @@
{
"tools/test/docstring_linter_testdata/more_python_code.py.txt": {
"class LintInit": 6
"class LintInit": 6,
"def a_very_very_long()": 8
},
"tools/test/docstring_linter_testdata/python_code.py.txt": {
"class LongWithShortDocstring": 6,
"class LongWithoutDocstring": 4,
"def ImpossibleCombo.needs_docs()": 12
"class LongWithoutDocstring": 6,
"def ImpossibleCombo.needs_docs()": 12,
"def long_without_docstring()": 7
}
}

View File

@ -4,7 +4,7 @@
"code": "DOCSTRING_LINTER",
"description": null,
"line": 17,
"name": "No docstring found for class 'LongWithoutDocstring' (4 lines)",
"name": "No docstring found for class 'LongWithoutDocstring' (6 lines)",
"original": null,
"path": "tools/test/docstring_linter_testdata/python_code.py.txt",
"replacement": null,
@ -21,6 +21,17 @@
"replacement": null,
"severity": "error"
},
{
"char": 0,
"code": "DOCSTRING_LINTER",
"description": null,
"line": 54,
"name": "No docstring found for function 'long_without_docstring' (7 lines)",
"original": null,
"path": "tools/test/docstring_linter_testdata/python_code.py.txt",
"replacement": null,
"severity": "error"
},
{
"char": 4,
"code": "DOCSTRING_LINTER",

View File

@ -1,4 +1,4 @@
tools/test/docstring_linter_testdata/python_code.py.txt:17: No docstring found for class 'LongWithoutDocstring' (4 lines)
tools/test/docstring_linter_testdata/python_code.py.txt:17: No docstring found for class 'LongWithoutDocstring' (6 lines)
15 |
16 |
17 | class LongWithoutDocstring:
@ -14,6 +14,14 @@ tools/test/docstring_linter_testdata/python_code.py.txt:24: docstring found for
25 | """TODO"""
26 |
tools/test/docstring_linter_testdata/python_code.py.txt:54: No docstring found for function 'long_without_docstring' (7 lines)
52 |
53 |
54 | def long_without_docstring():
^
55 | #
56 | #
tools/test/docstring_linter_testdata/python_code.py.txt:71: No docstring found for function 'needs_docs' (12 lines). If the method overrides a method on a parent class, adding the `@typing_extensions.override` decorator will make this error go away.
69 | """This docstring, while short, is enough"""
70 |

View File

@ -11,7 +11,7 @@
"is_method": false,
"line_count": 4,
"parent": null,
"start_line": 2
"start_line": 1
},
{
"category": "class",
@ -25,7 +25,7 @@
"is_method": false,
"line_count": 3,
"parent": null,
"start_line": 7
"start_line": 6
},
{
"category": "class",
@ -42,7 +42,7 @@
"is_method": true,
"line_count": 3,
"parent": 2,
"start_line": 14
"start_line": 13
}
],
"decorators": [],
@ -54,7 +54,7 @@
"is_method": false,
"line_count": 6,
"parent": null,
"start_line": 11
"start_line": 10
},
{
"category": "class",
@ -71,7 +71,7 @@
"is_method": true,
"line_count": 3,
"parent": 4,
"start_line": 21
"start_line": 20
}
],
"decorators": [],
@ -81,9 +81,9 @@
"index": 4,
"is_local": false,
"is_method": false,
"line_count": 4,
"line_count": 6,
"parent": null,
"start_line": 20
"start_line": 17
},
{
"category": "class",
@ -100,7 +100,7 @@
"is_method": true,
"line_count": 3,
"parent": 6,
"start_line": 28
"start_line": 27
}
],
"decorators": [],
@ -112,7 +112,7 @@
"is_method": false,
"line_count": 6,
"parent": null,
"start_line": 25
"start_line": 24
},
{
"category": "class",
@ -129,7 +129,7 @@
"is_method": true,
"line_count": 3,
"parent": 8,
"start_line": 35
"start_line": 34
}
],
"decorators": [],
@ -141,7 +141,7 @@
"is_method": false,
"line_count": 6,
"parent": null,
"start_line": 32
"start_line": 31
},
{
"category": "def",
@ -153,9 +153,9 @@
"index": 10,
"is_local": false,
"is_method": false,
"line_count": 3,
"line_count": 6,
"parent": null,
"start_line": 42
"start_line": 38
},
{
"category": "def",
@ -169,7 +169,7 @@
"is_method": false,
"line_count": 8,
"parent": null,
"start_line": 46
"start_line": 45
},
{
"category": "def",
@ -181,9 +181,9 @@
"index": 12,
"is_local": false,
"is_method": false,
"line_count": 3,
"line_count": 7,
"parent": null,
"start_line": 59
"start_line": 54
},
{
"category": "class",
@ -206,7 +206,7 @@
"is_method": false,
"line_count": 6,
"parent": 15,
"start_line": 74
"start_line": 73
},
{
"category": "class",
@ -220,7 +220,7 @@
"is_method": false,
"line_count": 3,
"parent": 15,
"start_line": 81
"start_line": 80
}
],
"decorators": [],
@ -232,7 +232,7 @@
"is_method": false,
"line_count": 11,
"parent": 14,
"start_line": 73
"start_line": 72
},
{
"category": "class",
@ -246,7 +246,7 @@
"is_method": false,
"line_count": 6,
"parent": 15,
"start_line": 74
"start_line": 73
},
{
"category": "class",
@ -260,7 +260,7 @@
"is_method": false,
"line_count": 3,
"parent": 15,
"start_line": 81
"start_line": 80
}
],
"decorators": [],
@ -272,7 +272,7 @@
"is_method": true,
"line_count": 12,
"parent": 13,
"start_line": 72
"start_line": 71
},
{
"category": "def",
@ -289,7 +289,7 @@
"is_method": false,
"line_count": 6,
"parent": 15,
"start_line": 74
"start_line": 73
},
{
"category": "class",
@ -303,7 +303,7 @@
"is_method": false,
"line_count": 3,
"parent": 15,
"start_line": 81
"start_line": 80
}
],
"decorators": [],
@ -315,7 +315,7 @@
"is_method": false,
"line_count": 11,
"parent": 14,
"start_line": 73
"start_line": 72
},
{
"category": "class",
@ -329,7 +329,7 @@
"is_method": false,
"line_count": 6,
"parent": 15,
"start_line": 74
"start_line": 73
},
{
"category": "class",
@ -343,7 +343,7 @@
"is_method": false,
"line_count": 3,
"parent": 15,
"start_line": 81
"start_line": 80
}
],
"decorators": [],
@ -353,9 +353,9 @@
"index": 13,
"is_local": false,
"is_method": false,
"line_count": 15,
"line_count": 21,
"parent": null,
"start_line": 69
"start_line": 62
},
{
"category": "class",
@ -372,7 +372,7 @@
"is_method": true,
"line_count": 2,
"parent": 18,
"start_line": 87
"start_line": 86
},
{
"category": "def",
@ -386,9 +386,9 @@
"index": 20,
"is_local": false,
"is_method": true,
"line_count": 2,
"line_count": 6,
"parent": 18,
"start_line": 97
"start_line": 92
},
{
"category": "def",
@ -402,7 +402,7 @@
"is_method": true,
"line_count": 2,
"parent": 18,
"start_line": 100
"start_line": 99
},
{
"category": "def",
@ -416,7 +416,7 @@
"is_method": true,
"line_count": 4,
"parent": 18,
"start_line": 103
"start_line": 102
}
],
"decorators": [
@ -430,7 +430,7 @@
"is_method": false,
"line_count": 21,
"parent": null,
"start_line": 86
"start_line": 85
},
{
"category": "def",
@ -442,8 +442,8 @@
"index": 23,
"is_local": false,
"is_method": false,
"line_count": 1,
"line_count": 5,
"parent": null,
"start_line": 112
"start_line": 107
}
]

View File

@ -1,17 +1,17 @@
{
"class ImpossibleCombo": {
"children": {
"72": {
"71": {
"children": {
"73": {
"72": {
"children": {
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -23,13 +23,13 @@
"name": "def ImpossibleCombo.needs_docs.not_short",
"status": "good"
},
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -41,15 +41,15 @@
"name": "def ImpossibleCombo.needs_docs",
"status": "good"
},
"73": {
"72": {
"children": {
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -61,13 +61,13 @@
"name": "def ImpossibleCombo.needs_docs.not_short",
"status": "good"
},
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -75,13 +75,13 @@
}
},
"docstring_len": 44,
"line": 69,
"lines": 15,
"line": 62,
"lines": 21,
"status": "good"
},
"class LongWithDocstring": {
"children": {
"14": {
"13": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithDocstring.short1",
@ -89,13 +89,13 @@
}
},
"docstring_len": 44,
"line": 11,
"line": 10,
"lines": 6,
"status": "good"
},
"class LongWithShortDocstring": {
"children": {
"28": {
"27": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithShortDocstring.short1",
@ -103,13 +103,13 @@
}
},
"docstring_len": 10,
"line": 25,
"line": 24,
"lines": 6,
"status": "good"
},
"class LongWithoutDocstring": {
"children": {
"21": {
"20": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithoutDocstring.short1",
@ -117,31 +117,31 @@
}
},
"docstring_len": 0,
"line": 20,
"lines": 4,
"line": 17,
"lines": 6,
"status": "good"
},
"class NotDocstring": {
"children": {
" 87": {
" 86": {
"docstring_len": 0,
"lines": 2,
"name": "def NotDocstring.short1",
"status": "good"
},
" 97": {
" 92": {
"docstring_len": 0,
"lines": 2,
"lines": 6,
"name": "def NotDocstring.long_with_override",
"status": "good"
},
"100": {
" 99": {
"docstring_len": 0,
"lines": 2,
"name": "def NotDocstring.short2",
"status": "good"
},
"103": {
"102": {
"docstring_len": 0,
"lines": 4,
"name": "def NotDocstring.short3",
@ -149,25 +149,25 @@
}
},
"docstring_len": 0,
"line": 86,
"line": 85,
"lines": 21,
"status": "good"
},
"class Short": {
"docstring_len": 0,
"line": 7,
"line": 6,
"lines": 3,
"status": "good"
},
"class ShortWithDocstring": {
"docstring_len": 44,
"line": 2,
"line": 1,
"lines": 4,
"status": "good"
},
"class _Protected": {
"children": {
"35": {
"34": {
"docstring_len": 0,
"lines": 3,
"name": "def _Protected.short1",
@ -175,32 +175,32 @@
}
},
"docstring_len": 10,
"line": 32,
"line": 31,
"lines": 6,
"status": "good"
},
"def long": {
"docstring_len": 44,
"line": 46,
"line": 45,
"lines": 8,
"status": "good"
},
"def long_with_omit": {
"docstring_len": 0,
"line": 112,
"lines": 1,
"line": 107,
"lines": 5,
"status": "good"
},
"def long_without_docstring": {
"docstring_len": 0,
"line": 59,
"lines": 3,
"line": 54,
"lines": 7,
"status": "good"
},
"def short": {
"docstring_len": 0,
"line": 42,
"lines": 3,
"line": 38,
"lines": 6,
"status": "good"
}
}

View File

@ -1,19 +1,19 @@
{
" 2": {
" 1": {
"docstring_len": 44,
"lines": 4,
"name": "class ShortWithDocstring",
"status": "good"
},
" 7": {
" 6": {
"docstring_len": 0,
"lines": 3,
"name": "class Short",
"status": "good"
},
" 11": {
" 10": {
"children": {
"14": {
"13": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithDocstring.short1",
@ -25,9 +25,9 @@
"name": "class LongWithDocstring",
"status": "good"
},
" 20": {
" 17": {
"children": {
"21": {
"20": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithoutDocstring.short1",
@ -35,13 +35,13 @@
}
},
"docstring_len": 0,
"lines": 4,
"lines": 6,
"name": "class LongWithoutDocstring",
"status": "good"
},
" 25": {
" 24": {
"children": {
"28": {
"27": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithShortDocstring.short1",
@ -53,9 +53,9 @@
"name": "class LongWithShortDocstring",
"status": "good"
},
" 32": {
" 31": {
"children": {
"35": {
"34": {
"docstring_len": 0,
"lines": 3,
"name": "def _Protected.short1",
@ -67,37 +67,37 @@
"name": "class _Protected",
"status": "good"
},
" 42": {
" 38": {
"docstring_len": 0,
"lines": 3,
"lines": 6,
"name": "def short",
"status": "good"
},
" 46": {
" 45": {
"docstring_len": 44,
"lines": 8,
"name": "def long",
"status": "good"
},
" 59": {
" 54": {
"docstring_len": 0,
"lines": 3,
"lines": 7,
"name": "def long_without_docstring",
"status": "good"
},
" 69": {
" 62": {
"children": {
"72": {
"71": {
"children": {
"73": {
"72": {
"children": {
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -109,13 +109,13 @@
"name": "def ImpossibleCombo.needs_docs.not_short",
"status": "good"
},
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -127,15 +127,15 @@
"name": "def ImpossibleCombo.needs_docs",
"status": "good"
},
"73": {
"72": {
"children": {
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -147,13 +147,13 @@
"name": "def ImpossibleCombo.needs_docs.not_short",
"status": "good"
},
"74": {
"73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
"81": {
"80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
@ -161,31 +161,31 @@
}
},
"docstring_len": 44,
"lines": 15,
"lines": 21,
"name": "class ImpossibleCombo",
"status": "good"
},
" 86": {
" 85": {
"children": {
" 87": {
" 86": {
"docstring_len": 0,
"lines": 2,
"name": "def NotDocstring.short1",
"status": "good"
},
" 97": {
" 92": {
"docstring_len": 0,
"lines": 2,
"lines": 6,
"name": "def NotDocstring.long_with_override",
"status": "good"
},
"100": {
" 99": {
"docstring_len": 0,
"lines": 2,
"name": "def NotDocstring.short2",
"status": "good"
},
"103": {
"102": {
"docstring_len": 0,
"lines": 4,
"name": "def NotDocstring.short3",
@ -197,9 +197,9 @@
"name": "class NotDocstring",
"status": "good"
},
"112": {
"107": {
"docstring_len": 0,
"lines": 1,
"lines": 5,
"name": "def long_with_omit",
"status": "good"
}

View File

@ -11,7 +11,7 @@
"is_method": false,
"line_count": 4,
"parent": null,
"start_line": 2
"start_line": 1
},
{
"category": "class",
@ -25,7 +25,7 @@
"is_method": false,
"line_count": 3,
"parent": null,
"start_line": 7
"start_line": 6
},
{
"category": "class",
@ -41,7 +41,7 @@
"is_method": false,
"line_count": 6,
"parent": null,
"start_line": 11
"start_line": 10
},
{
"category": "def",
@ -55,7 +55,7 @@
"is_method": true,
"line_count": 3,
"parent": 2,
"start_line": 14
"start_line": 13
},
{
"category": "class",
@ -69,9 +69,9 @@
"index": 4,
"is_local": false,
"is_method": false,
"line_count": 4,
"line_count": 6,
"parent": null,
"start_line": 20
"start_line": 17
},
{
"category": "def",
@ -85,7 +85,7 @@
"is_method": true,
"line_count": 3,
"parent": 4,
"start_line": 21
"start_line": 20
},
{
"category": "class",
@ -101,7 +101,7 @@
"is_method": false,
"line_count": 6,
"parent": null,
"start_line": 25
"start_line": 24
},
{
"category": "def",
@ -115,7 +115,7 @@
"is_method": true,
"line_count": 3,
"parent": 6,
"start_line": 28
"start_line": 27
},
{
"category": "class",
@ -131,7 +131,7 @@
"is_method": false,
"line_count": 6,
"parent": null,
"start_line": 32
"start_line": 31
},
{
"category": "def",
@ -145,7 +145,7 @@
"is_method": true,
"line_count": 3,
"parent": 8,
"start_line": 35
"start_line": 34
},
{
"category": "def",
@ -157,9 +157,9 @@
"index": 10,
"is_local": false,
"is_method": false,
"line_count": 3,
"line_count": 6,
"parent": null,
"start_line": 42
"start_line": 38
},
{
"category": "def",
@ -173,7 +173,7 @@
"is_method": false,
"line_count": 8,
"parent": null,
"start_line": 46
"start_line": 45
},
{
"category": "def",
@ -185,9 +185,9 @@
"index": 12,
"is_local": false,
"is_method": false,
"line_count": 3,
"line_count": 7,
"parent": null,
"start_line": 59
"start_line": 54
},
{
"category": "class",
@ -204,9 +204,9 @@
"index": 13,
"is_local": false,
"is_method": false,
"line_count": 15,
"line_count": 21,
"parent": null,
"start_line": 69
"start_line": 62
},
{
"category": "def",
@ -224,7 +224,7 @@
"is_method": true,
"line_count": 12,
"parent": 13,
"start_line": 72
"start_line": 71
},
{
"category": "def",
@ -241,7 +241,7 @@
"is_method": false,
"line_count": 11,
"parent": 14,
"start_line": 73
"start_line": 72
},
{
"category": "class",
@ -255,7 +255,7 @@
"is_method": false,
"line_count": 6,
"parent": 15,
"start_line": 74
"start_line": 73
},
{
"category": "class",
@ -269,7 +269,7 @@
"is_method": false,
"line_count": 3,
"parent": 15,
"start_line": 81
"start_line": 80
},
{
"category": "class",
@ -290,7 +290,7 @@
"is_method": false,
"line_count": 21,
"parent": null,
"start_line": 86
"start_line": 85
},
{
"category": "def",
@ -304,7 +304,7 @@
"is_method": true,
"line_count": 2,
"parent": 18,
"start_line": 87
"start_line": 86
},
{
"category": "def",
@ -318,9 +318,9 @@
"index": 20,
"is_local": false,
"is_method": true,
"line_count": 2,
"line_count": 6,
"parent": 18,
"start_line": 97
"start_line": 92
},
{
"category": "def",
@ -334,7 +334,7 @@
"is_method": true,
"line_count": 2,
"parent": 18,
"start_line": 100
"start_line": 99
},
{
"category": "def",
@ -348,7 +348,7 @@
"is_method": true,
"line_count": 4,
"parent": 18,
"start_line": 103
"start_line": 102
},
{
"category": "def",
@ -360,8 +360,8 @@
"index": 23,
"is_local": false,
"is_method": false,
"line_count": 1,
"line_count": 5,
"parent": null,
"start_line": 112
"start_line": 107
}
]

View File

@ -1,26 +1,26 @@
{
" 2": "class ShortWithDocstring: lines=4, docs=44",
" 7": "class Short: lines=3, docs=0",
" 11": "class LongWithDocstring: lines=6, docs=44",
" 14": "def LongWithDocstring.short1(): lines=3, docs=0",
" 20": "class LongWithoutDocstring: lines=4, docs=0",
" 21": "def LongWithoutDocstring.short1(): lines=3, docs=0",
" 25": "class LongWithShortDocstring: lines=6, docs=10",
" 28": "def LongWithShortDocstring.short1(): lines=3, docs=0",
" 32": "class _Protected: lines=6, docs=10",
" 35": "def _Protected.short1(): lines=3, docs=0",
" 42": "def short(): lines=3, docs=0",
" 46": "def long(): lines=8, docs=44",
" 59": "def long_without_docstring(): lines=3, docs=0",
" 69": "class ImpossibleCombo: lines=15, docs=44",
" 72": "def ImpossibleCombo.needs_docs(): lines=12, docs=0",
" 73": "def ImpossibleCombo.needs_docs.not_short(): lines=11, docs=0",
" 74": "class ImpossibleCombo.needs_docs.not_short.Long: lines=6, docs=0",
" 81": "class ImpossibleCombo.needs_docs.not_short.Short: lines=3, docs=0",
" 86": "class NotDocstring: lines=21, docs=0",
" 87": "def NotDocstring.short1(): lines=2, docs=0",
" 97": "def NotDocstring.long_with_override(): lines=2, docs=0",
"100": "def NotDocstring.short2(): lines=2, docs=0",
"103": "def NotDocstring.short3(): lines=4, docs=0",
"112": "def long_with_omit(): lines=1, docs=0"
" 1": "class ShortWithDocstring: lines=4, docs=44",
" 6": "class Short: lines=3, docs=0",
" 10": "class LongWithDocstring: lines=6, docs=44",
" 13": "def LongWithDocstring.short1(): lines=3, docs=0",
" 17": "class LongWithoutDocstring: lines=6, docs=0",
" 20": "def LongWithoutDocstring.short1(): lines=3, docs=0",
" 24": "class LongWithShortDocstring: lines=6, docs=10",
" 27": "def LongWithShortDocstring.short1(): lines=3, docs=0",
" 31": "class _Protected: lines=6, docs=10",
" 34": "def _Protected.short1(): lines=3, docs=0",
" 38": "def short(): lines=6, docs=0",
" 45": "def long(): lines=8, docs=44",
" 54": "def long_without_docstring(): lines=7, docs=0",
" 62": "class ImpossibleCombo: lines=21, docs=44",
" 71": "def ImpossibleCombo.needs_docs(): lines=12, docs=0",
" 72": "def ImpossibleCombo.needs_docs.not_short(): lines=11, docs=0",
" 73": "class ImpossibleCombo.needs_docs.not_short.Long: lines=6, docs=0",
" 80": "class ImpossibleCombo.needs_docs.not_short.Short: lines=3, docs=0",
" 85": "class NotDocstring: lines=21, docs=0",
" 86": "def NotDocstring.short1(): lines=2, docs=0",
" 92": "def NotDocstring.long_with_override(): lines=6, docs=0",
" 99": "def NotDocstring.short2(): lines=2, docs=0",
"102": "def NotDocstring.short3(): lines=4, docs=0",
"107": "def long_with_omit(): lines=5, docs=0"
}

View File

@ -1,146 +1,146 @@
{
"class ImpossibleCombo": {
"docstring_len": 44,
"line": 69,
"lines": 15,
"line": 62,
"lines": 21,
"status": "good"
},
"class ImpossibleCombo.needs_docs.not_short.Long": {
"docstring_len": 0,
"line": 74,
"line": 73,
"lines": 6,
"status": "good"
},
"class ImpossibleCombo.needs_docs.not_short.Short": {
"docstring_len": 0,
"line": 81,
"line": 80,
"lines": 3,
"status": "good"
},
"class LongWithDocstring": {
"docstring_len": 44,
"line": 11,
"line": 10,
"lines": 6,
"status": "good"
},
"class LongWithShortDocstring": {
"docstring_len": 10,
"line": 25,
"line": 24,
"lines": 6,
"status": "good"
},
"class LongWithoutDocstring": {
"docstring_len": 0,
"line": 20,
"lines": 4,
"line": 17,
"lines": 6,
"status": "good"
},
"class NotDocstring": {
"docstring_len": 0,
"line": 86,
"line": 85,
"lines": 21,
"status": "good"
},
"class Short": {
"docstring_len": 0,
"line": 7,
"line": 6,
"lines": 3,
"status": "good"
},
"class ShortWithDocstring": {
"docstring_len": 44,
"line": 2,
"line": 1,
"lines": 4,
"status": "good"
},
"class _Protected": {
"docstring_len": 10,
"line": 32,
"line": 31,
"lines": 6,
"status": "good"
},
"def ImpossibleCombo.needs_docs": {
"docstring_len": 0,
"line": 72,
"line": 71,
"lines": 12,
"status": "good"
},
"def ImpossibleCombo.needs_docs.not_short": {
"docstring_len": 0,
"line": 73,
"line": 72,
"lines": 11,
"status": "good"
},
"def LongWithDocstring.short1": {
"docstring_len": 0,
"line": 14,
"line": 13,
"lines": 3,
"status": "good"
},
"def LongWithShortDocstring.short1": {
"docstring_len": 0,
"line": 28,
"line": 27,
"lines": 3,
"status": "good"
},
"def LongWithoutDocstring.short1": {
"docstring_len": 0,
"line": 21,
"line": 20,
"lines": 3,
"status": "good"
},
"def NotDocstring.long_with_override": {
"docstring_len": 0,
"line": 97,
"lines": 2,
"line": 92,
"lines": 6,
"status": "good"
},
"def NotDocstring.short1": {
"docstring_len": 0,
"line": 87,
"line": 86,
"lines": 2,
"status": "good"
},
"def NotDocstring.short2": {
"docstring_len": 0,
"line": 100,
"line": 99,
"lines": 2,
"status": "good"
},
"def NotDocstring.short3": {
"docstring_len": 0,
"line": 103,
"line": 102,
"lines": 4,
"status": "good"
},
"def _Protected.short1": {
"docstring_len": 0,
"line": 35,
"line": 34,
"lines": 3,
"status": "good"
},
"def long": {
"docstring_len": 44,
"line": 46,
"line": 45,
"lines": 8,
"status": "good"
},
"def long_with_omit": {
"docstring_len": 0,
"line": 112,
"lines": 1,
"line": 107,
"lines": 5,
"status": "good"
},
"def long_without_docstring": {
"docstring_len": 0,
"line": 59,
"lines": 3,
"line": 54,
"lines": 7,
"status": "good"
},
"def short": {
"docstring_len": 0,
"line": 42,
"lines": 3,
"line": 38,
"lines": 6,
"status": "good"
}
}

View File

@ -1,145 +1,145 @@
{
" 2": {
" 1": {
"docstring_len": 44,
"lines": 4,
"name": "class ShortWithDocstring",
"status": "good"
},
" 7": {
" 6": {
"docstring_len": 0,
"lines": 3,
"name": "class Short",
"status": "good"
},
" 11": {
" 10": {
"docstring_len": 44,
"lines": 6,
"name": "class LongWithDocstring",
"status": "good"
},
" 14": {
" 13": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithDocstring.short1",
"status": "good"
},
" 20": {
" 17": {
"docstring_len": 0,
"lines": 4,
"lines": 6,
"name": "class LongWithoutDocstring",
"status": "good"
},
" 21": {
" 20": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithoutDocstring.short1",
"status": "good"
},
" 25": {
" 24": {
"docstring_len": 10,
"lines": 6,
"name": "class LongWithShortDocstring",
"status": "good"
},
" 28": {
" 27": {
"docstring_len": 0,
"lines": 3,
"name": "def LongWithShortDocstring.short1",
"status": "good"
},
" 32": {
" 31": {
"docstring_len": 10,
"lines": 6,
"name": "class _Protected",
"status": "good"
},
" 35": {
" 34": {
"docstring_len": 0,
"lines": 3,
"name": "def _Protected.short1",
"status": "good"
},
" 42": {
" 38": {
"docstring_len": 0,
"lines": 3,
"lines": 6,
"name": "def short",
"status": "good"
},
" 46": {
" 45": {
"docstring_len": 44,
"lines": 8,
"name": "def long",
"status": "good"
},
" 59": {
" 54": {
"docstring_len": 0,
"lines": 3,
"lines": 7,
"name": "def long_without_docstring",
"status": "good"
},
" 69": {
" 62": {
"docstring_len": 44,
"lines": 15,
"lines": 21,
"name": "class ImpossibleCombo",
"status": "good"
},
" 72": {
" 71": {
"docstring_len": 0,
"lines": 12,
"name": "def ImpossibleCombo.needs_docs",
"status": "good"
},
" 73": {
" 72": {
"docstring_len": 0,
"lines": 11,
"name": "def ImpossibleCombo.needs_docs.not_short",
"status": "good"
},
" 74": {
" 73": {
"docstring_len": 0,
"lines": 6,
"name": "class ImpossibleCombo.needs_docs.not_short.Long",
"status": "good"
},
" 81": {
" 80": {
"docstring_len": 0,
"lines": 3,
"name": "class ImpossibleCombo.needs_docs.not_short.Short",
"status": "good"
},
" 86": {
" 85": {
"docstring_len": 0,
"lines": 21,
"name": "class NotDocstring",
"status": "good"
},
" 87": {
" 86": {
"docstring_len": 0,
"lines": 2,
"name": "def NotDocstring.short1",
"status": "good"
},
" 97": {
" 92": {
"docstring_len": 0,
"lines": 2,
"lines": 6,
"name": "def NotDocstring.long_with_override",
"status": "good"
},
"100": {
" 99": {
"docstring_len": 0,
"lines": 2,
"name": "def NotDocstring.short2",
"status": "good"
},
"103": {
"102": {
"docstring_len": 0,
"lines": 4,
"name": "def NotDocstring.short3",
"status": "good"
},
"112": {
"107": {
"docstring_len": 0,
"lines": 1,
"lines": 5,
"name": "def long_with_omit",
"status": "good"
}

View File

@ -28,7 +28,7 @@ else:
TEST_FILE = Path("tools/test/docstring_linter_testdata/python_code.py.txt")
TEST_FILE2 = Path("tools/test/docstring_linter_testdata/more_python_code.py.txt")
TEST_BLOCK_NAMES = Path("tools/test/docstring_linter_testdata/block_names.py.txt")
ARGS = "--max-class=3", "--max-def=4", "--min-docstring=16"
ARGS = "--max-class=5", "--max-def=6", "--min-docstring=16"
class TestDocstringLinter(LinterTestCase):