19
19
import re
20
20
import logging
21
21
22
- __logger__ = logging .getLogger (__name__ )
22
+ _logger = logging .getLogger (__name__ )
23
23
24
24
_GET_SCOPE = re .compile ('|' .join ([
25
25
r"^\s*entity\s+(?P<entity_name>\w+)\s+is\b" ,
@@ -128,8 +128,7 @@ def _getUnusedObjects(vbuffer, objects):
128
128
yield _object
129
129
130
130
__COMMENT_TAG_SCANNER__ = re .compile ('|' .join ([
131
- r"\s*--\s*(?P<tag>TODO|FIXME|XXX)\s*:\s*(?P<text>.*)" ,
132
- ]))
131
+ r"\s*--\s*(?P<tag>TODO|FIXME|XXX)\s*:\s*(?P<text>.*)" ]))
133
132
134
133
def _getCommentTags (vbuffer ):
135
134
result = []
@@ -160,6 +159,28 @@ def _getCommentTags(vbuffer):
160
159
result += [message ]
161
160
return result
162
161
162
+ def _getMiscChecks (objects ):
163
+ """
164
+ Get generic code hints (or it should do that sometime in the future...)
165
+ """
166
+ if 'library' not in [x ['type' ] for x in objects .values ()]:
167
+ raise StopIteration
168
+
169
+ for library , obj in objects .items ():
170
+ if obj ['type' ] != 'library' :
171
+ continue
172
+ if library == 'work' :
173
+ yield {
174
+ 'checker' : 'HDL Code Checker/static' ,
175
+ 'line_number' : obj ['lnum' ] + 1 ,
176
+ 'column' : obj ['start' ] + 1 ,
177
+ 'filename' : None ,
178
+ 'error_number' : '0' ,
179
+ 'error_type' : 'W' ,
180
+ 'error_subtype' : 'Style' ,
181
+ 'error_message' : "Declaration of library '{library}' can "
182
+ "be omitted" .format (library = library )}
183
+
163
184
def getStaticMessages (vbuffer = None ):
164
185
"VHDL static checking"
165
186
objects = _getObjectsFromText (vbuffer )
@@ -181,7 +202,7 @@ def getStaticMessages(vbuffer=None):
181
202
}
182
203
183
204
result .append (message )
184
- return result + _getCommentTags (vbuffer )
205
+ return result + _getCommentTags (vbuffer ) + list ( _getMiscChecks ( objects ))
185
206
186
207
def standalone (): # pragma: no cover
187
208
import sys
0 commit comments