parameters: (self)
return_statement: return False
docstring: Check the current macro:entity match to see if it is recognized.
  
          Returns True if there is no need to perform further checks on this match.
  
          Helps avoid duplicate warnings/errors: typically each macro should have at most
          one of this class of errors.
docstring_summary: Check the current macro:entity match to see if it is recognized.
docstring_tokens: Check the current macro : entity match to see if it is recognized .
function: def checkRecognizedEntity(self):
          """Check the current macro:entity match to see if it is recognized.
  
          Returns True if there is no need to perform further checks on this match.
  
          Helps avoid duplicate warnings/errors: typically each macro should have at most
          one of this class of errors.
          """
          entity = self.entity
          macro = self.macro
          if self.checker.findMacroAndEntity(macro, entity) is not None:
              # We know this macro-entity combo
              return True
  
          # We don't know this macro-entity combo.
          possibleCats = self.checker.entity_db.getCategoriesForMacro(macro)
          if possibleCats is None:
              possibleCats = ['???']
          msg = ['Definition of link target {} with macro {} (used for {} {}) does not exist.'.format(
              entity,
              macro,
              _pluralize('category', len(possibleCats)),
              ', '.join(possibleCats))]
  
          data = self.checker.findEntity(entity)
          if data:
              # We found the goof: incorrect macro
              msg.append('Apparently matching entity in category {} found.'.format(
                  data.category))
              self.handleWrongMacro(msg, data)
              return True
  
          see_also = []
          dataArray = self.checker.findEntityCaseInsensitive(entity)
          if dataArray:
              # We might have found the goof...
  
              if len(dataArray) == 1:
                  # Yep, found the goof:
                  # incorrect macro and entity capitalization
                  data = dataArray[0]
                  msg.append('Apparently matching entity in category {} found by searching case-insensitively.'.format(
                      data.category))
                  self.handleWrongMacro(msg, data)
                  return True
              else:
                  # Ugh, more than one resolution
                  msg.append(
                      'More than one apparent match found by searching case-insensitively, cannot auto-fix.')
                  see_also = dataArray[:]
  
          # OK, so we don't recognize this entity (and couldn't auto-fix it).
  
          if self.checker.entity_db.shouldBeRecognized(macro, entity):
              # We should know the target - it's a link macro,
              # or there's some reason the entity DB thinks we should know it.
              if self.checker.likelyRecognizedEntity(entity):
                  # Should be linked and it matches our pattern,
                  # so probably not wrong macro.
                  # Human brains required.
                  if not self.checkText():
                      self.error(MessageId.BAD_ENTITY, msg + ['Might be a misspelling, or, less likely, the wrong macro.'],
                                 see_also=see_also)
              else:
                  # Doesn't match our pattern,
                  # so probably should be name instead of link.
                  newMacro = macro[0] + 'name'
                  if self.checker.entity_db.isValidMacro(newMacro):
                      self.error(MessageId.BAD_ENTITY, msg +
                                 ['Entity name does not fit the pattern for this API, which would mean it should be a "name" macro instead of a "link" macro'],
                                 group='macro', replacement=newMacro, fix=self.makeFix(newMacro=newMacro), see_also=see_also)
                  else:
                      self.error(MessageId.BAD_ENTITY, msg +
                                 ['Entity name does not fit the pattern for this API, which would mean it should be a "name" macro instead of a "link" macro',
                                  'However, {} is not a known macro so cannot auto-fix.'.format(newMacro)], see_also=see_also)
  
          elif macro == 'ename':
              # TODO This might be an ambiguity in the style guide - ename might be a known enumerant value,
              # or it might be an enumerant value in an external library, etc. that we don't know about - so
              # hard to check this.
              if self.checker.likelyRecognizedEntity(entity):
                  if not self.checkText():
                      self.warning(MessageId.BAD_ENUMERANT, msg +
                                   ['Unrecognized ename:{} that we would expect to recognize since it fits the pattern for this API.'.format(entity)], see_also=see_also)
          else:
              # This is fine:
              # it doesn't need to be recognized since it's not linked.
              pass
          # Don't skip other tests.
          return False
function_tokens: def checkRecognizedEntity ( self ) : entity = self . entity macro = self . macro if self . checker . findMacroAndEntity ( macro , entity ) is not None : # We know this macro-entity combo return True # We don't know this macro-entity combo. possibleCats = self . checker . entity_db . getCategoriesForMacro ( macro ) if possibleCats is None : possibleCats = [ '???' ] msg = [ 'Definition of link target {} with macro {} (used for {} {}) does not exist.' . format ( entity , macro , _pluralize ( 'category' , len ( possibleCats ) ) , ', ' . join ( possibleCats ) ) ] data = self . checker . findEntity ( entity ) if data : # We found the goof: incorrect macro msg . append ( 'Apparently matching entity in category {} found.' . format ( data . category ) ) self . handleWrongMacro ( msg , data ) return True see_also = [ ] dataArray = self . checker . findEntityCaseInsensitive ( entity ) if dataArray : # We might have found the goof... if len ( dataArray ) == 1 : # Yep, found the goof: # incorrect macro and entity capitalization data = dataArray [ 0 ] msg . append ( 'Apparently matching entity in category {} found by searching case-insensitively.' . format ( data . category ) ) self . handleWrongMacro ( msg , data ) return True else : # Ugh, more than one resolution msg . append ( 'More than one apparent match found by searching case-insensitively, cannot auto-fix.' ) see_also = dataArray [ : ] # OK, so we don't recognize this entity (and couldn't auto-fix it). if self . checker . entity_db . shouldBeRecognized ( macro , entity ) : # We should know the target - it's a link macro, # or there's some reason the entity DB thinks we should know it. if self . checker . likelyRecognizedEntity ( entity ) : # Should be linked and it matches our pattern, # so probably not wrong macro. # Human brains required. if not self . checkText ( ) : self . error ( MessageId . BAD_ENTITY , msg + [ 'Might be a misspelling, or, less likely, the wrong macro.' ] , see_also = see_also ) else : # Doesn't match our pattern, # so probably should be name instead of link. newMacro = macro [ 0 ] + 'name' if self . checker . entity_db . isValidMacro ( newMacro ) : self . error ( MessageId . BAD_ENTITY , msg + [ 'Entity name does not fit the pattern for this API, which would mean it should be a "name" macro instead of a "link" macro' ] , group = 'macro' , replacement = newMacro , fix = self . makeFix ( newMacro = newMacro ) , see_also = see_also ) else : self . error ( MessageId . BAD_ENTITY , msg + [ 'Entity name does not fit the pattern for this API, which would mean it should be a "name" macro instead of a "link" macro' , 'However, {} is not a known macro so cannot auto-fix.' . format ( newMacro ) ] , see_also = see_also ) elif macro == 'ename' : # TODO This might be an ambiguity in the style guide - ename might be a known enumerant value, # or it might be an enumerant value in an external library, etc. that we don't know about - so # hard to check this. if self . checker . likelyRecognizedEntity ( entity ) : if not self . checkText ( ) : self . warning ( MessageId . BAD_ENUMERANT , msg + [ 'Unrecognized ename:{} that we would expect to recognize since it fits the pattern for this API.' . format ( entity ) ] , see_also = see_also ) else : # This is fine: # it doesn't need to be recognized since it's not linked. pass # Don't skip other tests. return False