@@ -80,17 +80,25 @@ def extract_links_from_file(file, link_ignore_regex, link_ignore_list):
80
80
# Unbalanced parenthesis
81
81
(?<!\.)(?<!,) # Exclude trailing `.` or `,` from URL
82
82
""" , re .VERBOSE )
83
-
83
+ file_context = {}
84
84
for line_number , line in enumerate (file ):
85
+ xmlns_regex = re .compile (r'xmlns:?\w*="(.*)"' )
85
86
for match in re .findall (regex , line ):
86
87
link = match [0 ]
87
- context = enum (
88
- pip_vcs_url = False )
89
- if link .startswith (('hg+' , 'bzr+' , 'git+' , 'svn+' )):
90
- context .pip_vcs_url = True
88
+ link_context = file_context .get (link )
89
+ if not link_context :
90
+ link_context = enum (
91
+ xml_namespace = False ,
92
+ pip_vcs_url = False )
93
+ xmlns_match = xmlns_regex .search (line )
94
+ if xmlns_match and link in xmlns_match .groups ():
95
+ link_context .xml_namespace = True
96
+ if link .startswith (('hg+' , 'bzr+' , 'git+' , 'svn+' )):
97
+ link_context .pip_vcs_url = True
98
+ file_context [link ] = link_context
91
99
if not (link_ignore_regex .search (link ) or
92
100
fnmatch (link , link_ignore_list )):
93
- yield link , line_number , context
101
+ yield link , line_number , link_context
94
102
95
103
def analyze_links_in_file (self , file , network_timeout , link_ignore_regex ,
96
104
link_ignore_list ):
@@ -149,7 +157,18 @@ def run(self, filename, file,
149
157
150
158
for line_number , link , code , context in self .analyze_links_in_file (
151
159
file , network_timeout , link_ignore_regex , link_ignore_list ):
152
- if code is None :
160
+ if context .xml_namespace :
161
+ if code and 200 <= code < 300 :
162
+ pass
163
+ else :
164
+ yield Result .from_values (
165
+ origin = self ,
166
+ message = ('XML Namespace - '
167
+ '{url}' ).format (url = link ),
168
+ file = filename ,
169
+ line = line_number ,
170
+ severity = RESULT_SEVERITY .INFO )
171
+ elif code is None :
153
172
yield Result .from_values (
154
173
origin = self ,
155
174
message = ('Broken link - unable to connect to '
0 commit comments