MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / Check

Method Check

engine/3rdparty/tinyobjloader/deps/cpplint.py:939–962  ·  view source on GitHub ↗

Report if too many lines in function body. Args: error: The function to call with any errors found. filename: The name of the current file. linenum: The number of the line to check.

(self, error, filename, linenum)

Source from the content-addressed store, hash-verified

937 self.lines_in_function += 1
938
939 def Check(self, error, filename, linenum):
940 """Report if too many lines in function body.
941
942 Args:
943 error: The function to call with any errors found.
944 filename: The name of the current file.
945 linenum: The number of the line to check.
946 """
947 if Match(r'T(EST|est)', self.current_function):
948 base_trigger = self._TEST_TRIGGER
949 else:
950 base_trigger = self._NORMAL_TRIGGER
951 trigger = base_trigger * 2**_VerboseLevel()
952
953 if self.lines_in_function > trigger:
954 error_level = int(math.log(self.lines_in_function / base_trigger, 2))
955 # 50 => 0, 100 => 1, 200 => 2, 400 => 3, 800 => 4, 1600 => 5, ...
956 if error_level > 5:
957 error_level = 5
958 error(filename, linenum, 'readability/fn_size', error_level,
959 'Small and focused functions are preferred:'
960 ' %s has %d non-comment lines'
961 ' (error triggered by exceeding %d lines).' % (
962 self.current_function, self.lines_in_function, trigger))
963
964 def End(self):
965 """Stop analyzing function body."""

Callers 1

CheckForFunctionLengthsFunction · 0.80

Calls 4

MatchFunction · 0.85
_VerboseLevelFunction · 0.85
errorFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected