MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / misra_3_1

Method misra_3_1

addons/misra.py:1807–1822  ·  view source on GitHub ↗
(self, rawTokens)

Source from the content-addressed store, hash-verified

1805 reported_linenrs.add(linenr)
1806
1807 def misra_3_1(self, rawTokens):
1808 for token in rawTokens:
1809 starts_with_double_slash = token.str.startswith('//')
1810 starts_with_block_comment = token.str.startswith("/*")
1811 s = token.str.lstrip('/')
1812 if (starts_with_double_slash or starts_with_block_comment) and "/*" in s:
1813 # Block comment inside of regular comment, violation
1814 self.reportError(token, 3, 1)
1815 elif starts_with_block_comment and "//" in s:
1816 # "//" in block comment, check if it's a uri
1817 while "//" in s:
1818 possible_uri, s = s.split("//", 1)
1819 if not re.search(r"\w+:$", possible_uri):
1820 # Violation if no uri was found
1821 self.reportError(token, 3, 1)
1822 break
1823
1824 def misra_4_1(self, rawTokens):
1825 for token in rawTokens:

Callers

nothing calls this directly

Calls 1

reportErrorMethod · 0.95

Tested by

no test coverage detected