GNUnet 0.22.0
warningfilter Namespace Reference

Functions

def sep_re (field, separator)
 

Variables

string fileclass = r"[\w-]"
 
string filename = rf"{fileclass}+"
 
string filepath = rf"{sep_re(filename, '/')}\.(?:\w+)"
 
string main_match = rf"(?P<path>/{filepath}|\[generated\]):(?P<linenumber>\d+): warning:"
 
string type_name = rf"(?:const )?(?:unsigned (?:long )?|struct |enum )?(?:\w+)(?: \*?const)? \*{{0,3}}"
 
string var_def = rf"{type_name}\w+(?:\[(?:\‍(\d+/\d+\‍))?\])?"
 
string func_params = rf"\‍({sep_re(var_def, ', ')}(?:,\.\.\.)?\‍)"
 
string simple_name = r"\w+"
 
string func_name = simple_name
 
string verbose_name = rf"{sep_re(simple_name, ' ')}"
 
string command_re = "(?:</[^>]+>|\\\w+)"
 
string macro_params = rf"\‍({sep_re(simple_name, ', ')}(?:,\.\.\.)?\‍)"
 
dictionary matches
 
 parser_choices
 
 parser = ap.ArgumentParser()
 
 action
 
 choices
 
 dest
 
 args = parser.parse_args()
 
dictionary sorted_lines = {k:[] for k in matches.keys()}
 
list unsorted_lines = []
 
dictionary processed_lines
 
dictionary counts = {k: len(v) for k, v in processed_lines.items()}
 

Detailed Description

Filters and processes warnings generated by Doxygen, which are
annoyingly inconsistent and verbose, for greater readability.

(Neo)vim commands to go to the file and linenumber listed on a 
line, in the reports this program generates:
    :exe "let linenumber =" split(getline("."))[1]
    :exe "edit" fnameescape(split(getline("."))[0]) "|" linenumber

It's easy to put a workflow together to clear up redundant doc 
comments (which generate "multiple @param docs" warnings), using
simple vim commands to move the cursor and close buffers, Neovim's 
support for the Language Server Protocol or related tooling, and 
the command shown above.

A useful sequence, for rapidly deleting a doc comment from its last
line, is, in normal mode, `$v%ddd`.

For setting up LSP integration in Neovim, refer to the lsp_config
plugin. 

You may additionally need to generate compile_commands.json in the 
repository root, to allow the language server to find everything. 
This can be done using Bear (found at https://github.com/rizsotto/Bear).

@author: willow <willow@howhill.com>

Function Documentation

◆ sep_re()

def warningfilter.sep_re (   field,
  separator 
)

Definition at line 35 of file warningfilter.py.

35def sep_re(field, separator):
36 "Constructs regex for a list"
37 return rf"{field}(?:{separator}{field})*"
38
39# File names and paths
def sep_re(field, separator)

Variable Documentation

◆ fileclass

string warningfilter.fileclass = r"[\w-]"

Definition at line 40 of file warningfilter.py.

◆ filename

string warningfilter.filename = rf"{fileclass}+"

Definition at line 41 of file warningfilter.py.

◆ filepath

string warningfilter.filepath = rf"{sep_re(filename, '/')}\.(?:\w+)"

Definition at line 43 of file warningfilter.py.

◆ main_match

string warningfilter.main_match = rf"(?P<path>/{filepath}|\[generated\]):(?P<linenumber>\d+): warning:"

Definition at line 44 of file warningfilter.py.

◆ type_name

string warningfilter.type_name = rf"(?:const )?(?:unsigned (?:long )?|struct |enum )?(?:\w+)(?: \*?const)? \*{{0,3}}"

Definition at line 47 of file warningfilter.py.

◆ var_def

string warningfilter.var_def = rf"{type_name}\w+(?:\[(?:\‍(\d+/\d+\‍))?\])?"

Definition at line 48 of file warningfilter.py.

◆ func_params

string warningfilter.func_params = rf"\‍({sep_re(var_def, ', ')}(?:,\.\.\.)?\‍)"

Definition at line 49 of file warningfilter.py.

◆ simple_name

string warningfilter.simple_name = r"\w+"

Definition at line 50 of file warningfilter.py.

◆ func_name

string warningfilter.func_name = simple_name

Definition at line 51 of file warningfilter.py.

◆ verbose_name

string warningfilter.verbose_name = rf"{sep_re(simple_name, ' ')}"

Definition at line 52 of file warningfilter.py.

◆ command_re

string warningfilter.command_re = "(?:</[^>]+>|\\\w+)"

Definition at line 53 of file warningfilter.py.

◆ macro_params

string warningfilter.macro_params = rf"\‍({sep_re(simple_name, ', ')}(?:,\.\.\.)?\‍)"

Definition at line 54 of file warningfilter.py.

◆ matches

dictionary warningfilter.matches
Initial value:
1= {
2 "not an input @file": re.compile(rf"{main_match} the name '(?P<name>{filepath}|{simple_name})' supplied as the argument in the \\file statement is not an input file"),
3 "multiple @param docs": re.compile(rf"{main_match} argument '(?P<arg_name>\w+)' from the argument list of ({func_name}) has multiple @param documentation sections"),
4 "undocumented param": re.compile(rf"{main_match} The following parameters? of ({func_name})(?:{func_params}|{macro_params}) (?:is|are) not documented:"),
5 "undocumented param (name)": re.compile(r" parameter '([\w.]+)'"),
6 "explicit link not resolved": re.compile(rf"{main_match} explicit link request to '(\w+(?:\‍(\‍))?)' could not be resolved"),
7 "unknown command": re.compile(rf"{main_match} Found unknown command '(\\\w+)'"),
8 "missing argument": re.compile(rf"{main_match} argument '(\w+)' of command @param is not found in the argument list of ({func_name})(?:{func_params}|{macro_params})"),
9 "eof inside group": re.compile(rf"{main_match} end of file while inside a group"),
10 "eof inside comment": re.compile(rf"{main_match} Reached end of file while still inside a \‍(nested\‍) comment. Nesting level \d+ \‍(probable line reference: (\d+)\‍)"),
11 "eof inside code block": re.compile(rf"{main_match} reached end of file while inside a 'code' block!"),
12 "eof inside code block (line 2)": re.compile(rf"The command that should end the block seems to be missing!"),
13 "title mismatch": re.compile(rf"{main_match} group (?P<group_id>\w+): ignoring title \"(?P<new_title>{verbose_name})\" that does not match old title \"(?P<old_title>{verbose_name})\""),
14 "end of comment expecting command": re.compile(rf"{main_match} end of comment block while expecting command ({command_re})"),
15 "no matching tag": re.compile(rf"{main_match} found </(?P<tag>[^>]+)> tag without matching <(?P=tag)>"),
16 "documented empty return type": re.compile(rf"{main_match} documented empty return type of {func_name}"),
17 "unsupported tag": re.compile(rf"{main_match} Unsupported xml/html tag <(?P<tag>[^>]+)> found"),
18 "expected whitespace after command": re.compile(rf"{main_match} expected whitespace after \\(?P<command>\w+) command"),
19 "illegal command": re.compile(rf"{main_match} Illegal command (?P<illegal_cmd>(?:@|\\)\w+) as part of a \\(?P<command>\w+) command"),
20 "undeclared symbol": re.compile(rf"{main_match} documented symbol '(\w+)' was not declared or defined\."),
21 "nameless member": re.compile(rf"{main_match} member with no name found."),
22 "end of empty list": re.compile(rf"{main_match} End of list marker found without any preceding list items"),
23 "blank": re.compile(rf"^\s*$"),
24# "": re.compile(rf"{main_match} "),
25}

Definition at line 57 of file warningfilter.py.

Referenced by abd_string_to_value().

◆ parser_choices

warningfilter.parser_choices
Initial value:
1= set(matches.keys()) - {"blank",
2 "eof inside code block (line 2)",
3 "undocumented param (name)"}

Definition at line 83 of file warningfilter.py.

◆ parser

warningfilter.parser = ap.ArgumentParser()

Definition at line 87 of file warningfilter.py.

◆ action

warningfilter.action

Definition at line 89 of file warningfilter.py.

◆ choices

warningfilter.choices

◆ dest

◆ args

warningfilter.args = parser.parse_args()

Definition at line 91 of file warningfilter.py.

◆ sorted_lines

dictionary warningfilter.sorted_lines = {k:[] for k in matches.keys()}

Definition at line 93 of file warningfilter.py.

◆ unsorted_lines

list warningfilter.unsorted_lines = []

Definition at line 94 of file warningfilter.py.

◆ processed_lines

dictionary warningfilter.processed_lines
Initial value:
1= {k: [" ".join(g for g in match.groups())
2 for match in matches]
3 for k, matches in sorted_lines.items()}

Definition at line 106 of file warningfilter.py.

◆ counts

dictionary warningfilter.counts = {k: len(v) for k, v in processed_lines.items()}

Definition at line 122 of file warningfilter.py.