File tree Expand file tree Collapse file tree
codechecker_analyzer/analyzers/cppcheck Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,12 @@ def parse_version(cppcheck_output) -> Optional[Version]:
6767 version_re = re .compile (r'^Cppcheck(.*?)(?P<version>[\d\.]+)' )
6868 match = version_re .match (cppcheck_output )
6969 if match :
70- return Version .parse (match .group ('version' ))
70+ version = match .group ('version' )
71+ # semver.Version handles only version numbers with 3 sections.
72+ # For example: 2.7.0
73+ if version .count ('.' ) < 2 : # Cppcheck 2.7
74+ version += '.0'
75+ return Version .parse (version )
7176 return None
7277
7378
Original file line number Diff line number Diff line change @@ -28,3 +28,6 @@ def test_cppcheck_version(self):
2828 self .assertEqual (
2929 parse_version ('Cppcheck Premium 1.2.3' ),
3030 Version (1 , 2 , 3 ))
31+ self .assertEqual (
32+ parse_version ('Cppcheck 2.7' ),
33+ Version (2 , 7 , 0 ))
You can’t perform that action at this time.
0 commit comments