Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser-common: allow :: in source file paths #213

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/parser-common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
#define RE_CHECKER_NAME_MISRA "(?:MISRA C(?:\\+\\+)?-[0-9]+ (?:Directive|Rule) [0-9.-]+)"
#define RE_CHECKER_NAME RE_CHECKER_NAME_SA "|" RE_CHECKER_NAME_CERT "|" RE_CHECKER_NAME_MISRA

#define RE_PATH_LOCAL "[^:]+"
// the `::` separators are used in file names of perl man pages
#define RE_PATH_LOCAL "[^:]+(?:::[A-Za-z][^:]+)*"
#define RE_PATH_URL "http(?:s)?://[^:]+(?::[0-9]+)?[^:]+"
#define RE_PATH RE_PATH_LOCAL "|" RE_PATH_URL

Expand Down
1 change: 1 addition & 0 deletions tests/csgrep/0131-unicontrol-perl-man-page-args.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--mode=json
39 changes: 39 additions & 0 deletions tests/csgrep/0131-unicontrol-perl-man-page-stdin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod:655: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod:657: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod:658: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod:659: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod:655: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod:657: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod:658: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod:659: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm:952: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm:953: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm:956: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm:957: warning: bidirectional control characters: ['\u202b', '\u202c']

Error: UNICONTROL_WARNING:
/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm:958: warning: bidirectional control characters: ['\u202b', '\u202c']

186 changes: 186 additions & 0 deletions tests/csgrep/0131-unicontrol-perl-man-page-stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"defects": [
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod",
"line": 655,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod",
"line": 657,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod",
"line": 658,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/lib/DateTime/Locale/fa_IR.pod",
"line": 659,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod",
"line": 655,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod",
"line": 657,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod",
"line": 658,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/lib/DateTime/Locale/fa_IR.pod",
"line": 659,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm",
"line": 952,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm",
"line": 953,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm",
"line": 956,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm",
"line": 957,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
},
{
"checker": "UNICONTROL_WARNING",
"tool": "unicontrol",
"key_event_idx": 0,
"events": [
{
"file_name": "/builddir/build/BUILD/DateTime-Locale-1.31/blib/man3/DateTime::Locale::fa_IR.3pm",
"line": 958,
"event": "warning",
"message": "bidirectional control characters: ['\\u202b', '\\u202c']",
"verbosity_level": 0
}
]
}
]
}
1 change: 1 addition & 0 deletions tests/csgrep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ test_csgrep("0125-sarif-parser-bom" )
test_csgrep("0126-cov-parser-imp-flag" )
test_csgrep("0127-cov-writer-noloc" )
test_csgrep("0128-cov-parser-noloc" )
test_csgrep("0131-unicontrol-perl-man-page" )