Parses the given command line parameter for file- and line-specific exclusions. readability/casting:file.cpp readability/casting:file.cpp:43 Args: parameter: The parameter value of --filter Returns: [category, filename, line]. Category is always given. F
(parameter)
| 7767 | |
| 7768 | |
| 7769 | def _ParseFilterSelector(parameter): |
| 7770 | """Parses the given command line parameter for file- and line-specific |
| 7771 | exclusions. |
| 7772 | readability/casting:file.cpp |
| 7773 | readability/casting:file.cpp:43 |
| 7774 | |
| 7775 | Args: |
| 7776 | parameter: The parameter value of --filter |
| 7777 | |
| 7778 | Returns: |
| 7779 | [category, filename, line]. |
| 7780 | Category is always given. |
| 7781 | Filename is either a filename or empty if all files are meant. |
| 7782 | Line is either a line in filename or -1 if all lines are meant. |
| 7783 | """ |
| 7784 | colon_pos = parameter.find(":") |
| 7785 | if colon_pos == -1: |
| 7786 | return parameter, "", -1 |
| 7787 | category = parameter[:colon_pos] |
| 7788 | second_colon_pos = parameter.find(":", colon_pos + 1) |
| 7789 | if second_colon_pos == -1: |
| 7790 | return category, parameter[colon_pos + 1 :], -1 |
| 7791 | return ( |
| 7792 | category, |
| 7793 | parameter[colon_pos + 1 : second_colon_pos], |
| 7794 | int(parameter[second_colon_pos + 1 :]), |
| 7795 | ) |
| 7796 | |
| 7797 | |
| 7798 | def _ExpandDirectories(filenames): |