SyncM8/syncm8

View on GitHub

Showing 10 of 75 total issues

File DashboardPage.tsx has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  CalendarOutlined,
  CarryOutOutlined,
  CheckOutlined,
  CloseOutlined,
Severity: Minor
Found in client/src/pages/Dashboard/DashboardPage.tsx - About 3 hrs to fix

    Function LoginPage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const LoginPage = ({ loggedIn, setLoggedIn }: LoginPageProps): JSX.Element => {
      const history = useHistory();
      const location = useLocation<LocationState>();
      const [beforeLoginPath, setBeforeLoginPath] = useState("/");
    
    
    Severity: Minor
    Found in client/src/pages/Login/LoginPage.tsx - About 1 hr 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

    Function resolve_assign_mates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def resolve_assign_mates(
        obj: Any, info: GraphQLResolveInfo, mateAssignments: List[MateAssignmentInput]
    ) -> List[str]:
        """
        Assign mates to specified families.
    Severity: Minor
    Found in server/src/gql/resolver.py - About 55 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

    Function get_google_person_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_google_person_list(
        token: str,
        http: Optional[httplib2.Http] = None,
        http2: Optional[httplib2.Http] = None,
    ) -> Tuple[Optional[AppError], Optional[List[GooglePerson]]]:
    Severity: Minor
    Found in server/src/clients/google.py - About 55 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

    Function resolve_add_new_mates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def resolve_add_new_mates(
        obj: Any, info: GraphQLResolveInfo, mates: List[NewMatesInput]
    ) -> List[Mate]:
        """Add new mates to the user's unassigned family."""
        user = User.lookup_user(current_user.get_id())
    Severity: Minor
    Found in server/src/gql/resolver.py - About 35 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

    Function add_google_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_google_user(token: str) -> Tuple[Optional[AppError], Optional[User]]:
            """
            Add or update new google user.
    
            If user with same google id exists, update the store access token.
    Severity: Minor
    Found in server/src/model/user.py - About 35 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

    Function run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def run() -> None:
        """Get all users without family_ids and populate with a starter families."""
        users = User.objects(family_ids__exists=False)
        for user in users:
            family_ids: List[ObjectId] = [user.unassigned_family_id]
    Severity: Minor
    Found in server/src/db/migration_scripts/populate_starter_families.py - About 35 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

    Avoid too many return statements within this function.
    Open

            return (None, newUser)
    Severity: Major
    Found in server/src/model/user.py - About 30 mins to fix

      Function AssignMatesPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const AssignMatesPage = (): JSX.Element => {
        const [groups, setGroups] = useState<Record<string, UnassignedMate[]>>({});
        const [familyMap, setFamilyMap] = useState<Record<string, Family>>({});
        const [unassignedFamilyId, setUnassignedFamilyId] = useState("");
        const [isAllAssigned, setIsAllAssigned] = useState(false);
      Severity: Minor
      Found in client/src/pages/AssignMates/AssignMatesPage.tsx - 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

      Function SyncCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const SyncCard = ({
        sync,
        removeSync,
        editSync,
        style,
      Severity: Minor
      Found in client/src/components/SyncCard/SyncCard.tsx - 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

      Severity
      Category
      Status
      Source
      Language