ethanneff/example

View on GitHub

Showing 49 of 120 total issues

Function Home has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Home = () => {
  const colors = useColors();
  const { onLeftPress } = useAdminNavBack();
  const styles = StyleSheet.create({
    background: {
Severity: Minor
Found in src/apps/Progress/Home.tsx - About 2 hrs to fix

    Function formatRelativeDate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const formatRelativeDate = (date: Date): string => {
      const today = new Date();
      const years = differenceInYears(today, date);
      const weeks = differenceInWeeks(today, date);
      const days = differenceInDays(today, date);
    Severity: Minor
    Found in src/apps/Playground/Features/SwipeFeed/utils.ts - 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 generateButtons has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const generateButtons = () => {
      const today = new Date();
      const laterToday = set(add(today, { minutes: 30 }), { hours: 3, minutes: 0 });
      const yesterday = sub(today, { days: 1 });
      const evening = set(today, { hours: 18, minutes: 0 });
    Severity: Minor
    Found in src/apps/Playground/Components/Modals/Reminders/OneTime.tsx - About 1 hr to fix

      Function LoadingProfile has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const LoadingProfile = () => {
        const colors = useColors();
        const banner = spacing(24);
      
        return (
      Severity: Minor
      Found in src/apps/Playground/Features/SkeletonLoader/LoadingProfile.tsx - About 1 hr to fix

        Function Header has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Header = () => {
          const dispatch = useAppDispatch();
          const delay = useAppSelector((state) => state.gameOfLife.delay);
          const count = useAppSelector((state) => state.gameOfLife.count);
          const onCountSlide = useCallback(
        Severity: Minor
        Found in src/apps/Playground/Games/GameOfLife/Header.tsx - About 1 hr to fix

          Function Home has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Home = () => {
            const [showModal, setShowModal] = useState(initialState);
            const { onLeftPress } = useAdminNavBack();
          
            const handleModalBackgroundPress = useCallback(() => {
          Severity: Minor
          Found in src/apps/CantHurtMe/Home.tsx - About 1 hr to fix

            Function getMatches has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const getMatches = (board: Board): Matches => {
              const matches: Matches = {};
              for (let rowIndex = 0; rowIndex < board.length; rowIndex++)
                for (let colIndex = 0; colIndex < board[rowIndex].length; colIndex++) {
                  const mid = board[rowIndex][colIndex];
            Severity: Minor
            Found in src/apps/Playground/Games/Bejeweled/index.tsx - About 1 hr to fix

              Function Template has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const Template = () => {
                const colors = useColors();
                const { goBack } = useNavigation();
                const [value, setValue] = useState(0);
                const dispatch = useAppDispatch();
              Severity: Minor
              Found in src/apps/Playground/Template/index.tsx - About 1 hr to fix

                Function ForgotPassword has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const ForgotPassword = () => {
                  const [email, setEmail] = useState('');
                  const { goBack } = useNavigation();
                  const handleEmail = useCallback((value: string) => {
                    setEmail(value);
                Severity: Minor
                Found in src/apps/Portfolio/ForgotPassword/index.tsx - About 1 hr to fix

                  Method initializeFlipper has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
                      if (FlipperUtils.shouldEnableFlipper(context)) {
                        final FlipperClient client = AndroidFlipperClient.getInstance(context);
                  
                        client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));

                    Function GameOfLife has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const GameOfLife = () => {
                      const colors = useColors();
                      const [loading, setLoading] = useState(true);
                      const dispatch = useAppDispatch();
                      const { goBack } = useNavigation();
                    Severity: Minor
                    Found in src/apps/Playground/Games/GameOfLife/index.tsx - About 1 hr to fix

                      Function CalendarHeader has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const CalendarHeader = () => {
                        const dispatch = useAppDispatch();
                        const activeMonth = useAppSelector((state) => state.calendar.activeMonth);
                        const month = format(activeMonth, 'MMMM yyyy');
                      
                      
                      Severity: Minor
                      Found in src/components/Calendar/CalendarHeader.tsx - About 1 hr to fix

                        Function Pillar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const Pillar = () => {
                          const colors = useColors();
                          const useNativeDriver = useDriver();
                          const location = useRef(new Animated.ValueXY({ x: 0, y: 0 }));
                          const state = useRef({ direction: 1, x: 0, y: 0 });
                        Severity: Minor
                        Found in src/apps/Playground/Games/FlappyBird/index.tsx - About 1 hr to fix

                          Function Buttons has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const Buttons = () => {
                            const dispatch = useAppDispatch();
                            const run = useAppSelector((state) => state.gameOfLife.run);
                            const onRandom = useCallback(() => dispatch(resetBoard(0.5)), [dispatch]);
                            const onStart = useCallback(() => dispatch(toggleRun()), [dispatch]);
                          Severity: Minor
                          Found in src/apps/Playground/Games/GameOfLife/Buttons.tsx - About 1 hr to fix

                            Function Welcome has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const Welcome = () => {
                              const dispatch = useAppDispatch();
                              const { signInAnonymously } = useAuth();
                            
                              const handleLogin = useCallback(async () => {
                            Severity: Minor
                            Found in src/apps/Complete/screens/Welcome/index.tsx - About 1 hr to fix

                              Function BouncingBalls has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const BouncingBalls = () => {
                                const colors = useColors();
                                const { goBack } = useNavigation();
                                const { layout, onLayout } = useLayout();
                                const styles = StyleSheet.create({
                              Severity: Minor
                              Found in src/apps/Playground/Features/BouncingBalls/index.tsx - About 1 hr to fix

                                Function Colors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const Colors = () => {
                                  const { goBack } = useNavigation();
                                
                                  return (
                                    <Screen
                                Severity: Minor
                                Found in src/apps/Playground/Components/Colors/index.tsx - About 1 hr to fix

                                  Function Chat has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const Chat = () => {
                                    const { goBack } = useNavigation();
                                    const { insets, layout, onLayout } = useLayout();
                                    const keyboardHeight = useAppSelector((s) => s.device.keyboardHeight);
                                    const bottomInset = keyboardHeight > 0 ? insets.bottom : 0;
                                  Severity: Minor
                                  Found in src/apps/Playground/Features/Chat/index.tsx - About 1 hr to fix

                                    Function Day has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const Day = () => {
                                      const { goBack } = useNavigation();
                                      const colors = useColors();
                                    
                                      return (
                                    Severity: Minor
                                    Found in src/apps/DeepWork/Day.tsx - About 1 hr to fix

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

                                      export const Crash = () => {
                                        const colors = useColors();
                                        const { goBack } = useNavigation();
                                      
                                        const [playerGame, setPlayerGame] = useState<PlayerGame>({
                                      Severity: Minor
                                      Found in src/apps/Playground/Games/Crash/index.tsx - 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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language