tanbro/emoji-data

View on GitHub
src/emoji_data/definitions.py

Summary

Maintainability
B
6 hrs
Test Coverage
D
60%

File definitions.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Regular expressions for Emoji Definitions

ref: http://www.unicode.org/reports/tr51/#Definitions
"""

Severity: Minor
Found in src/emoji_data/definitions.py - About 4 hrs to fix

    Function make_regex_dict has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    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"]"
    Severity: Minor
    Found in src/emoji_data/definitions.py - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

          return False
      Severity: Major
      Found in src/emoji_data/definitions.py - About 30 mins to fix

        Function detect_qualified has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        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
        Severity: Minor
        Found in src/emoji_data/definitions.py - About 25 mins to fix

        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"

        Further reading

        There are no issues that match your filters.

        Category
        Status