src/emoji_data/definitions.py
File definitions.py
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Regular expressions for Emoji Definitions
ref: http://www.unicode.org/reports/tr51/#Definitions
"""
Function make_regex_dict
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def make_regex_dict() -> Mapping[str, str]:
d: MutableMapping[str, str] = {}
d["EMOJI_CHARACTER"] = (
r"[" + "".join(m.regex for m in EmojiCharacter.values() if EmojiCharProperty.EMOJI in m.properties) + r"]"
Avoid too many return
statements within this function. Open
Open
return False
Function detect_qualified
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def detect_qualified(s: str) -> QualifiedType:
"""Detect qualified type of emoji string
- qualified emoji character — An emoji character in a string that
- (a) has default emoji presentation or
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"