bastienrobert/la-ferme

View on GitHub

Showing 30 of 214 total issues

File uncivil.ts has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Card, CardRewardType } from '../../typings'

const uncivil: Card[] = [
  {
    name: 'not-polite',
Severity: Minor
Found in packages/shared/data/cards/uncivil.ts - About 2 hrs to fix

    Function MiniGame has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    const MiniGame: FC<MiniGameProps> = props => {
      const { uuid, player, winner, type } = props
      const [pending, setPending] = useState<PendingState>(undefined)
      const [ready, setReady] = useState<boolean>(false)
      const { theme, setTheme } = useTheme()
    Severity: Minor
    Found in packages/mobile/src/pages/Game/Main/MiniGame/index.tsx - About 2 hrs 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 CarCounterPoints has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const CarCounterPoints: FC<SvgProps> = props => {
      return (
        <Svg viewBox={`0 0 ${WIDTH} ${HEIGHT}`} fill="none" {...props}>
          <Path
            fill={Colors.beige}
    Severity: Major
    Found in packages/mobile/src/components/svgs/CarCounterPoints.tsx - About 2 hrs to fix

      Function Scan has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Confirmed

      const Scan = () => {
        const fadeAnim = useRef(new Animated.Value(0)).current
      
        useEffect(() => {
          Animated.loop(
      Severity: Minor
      Found in packages/mobile/src/pages/Home/Main/QRCode/Scan.tsx - About 1 hr to fix

        Function PosterSlice has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Confirmed

        const PosterSlice: FC = () => {
          const container = useRef()
          const wrapper = useRef()
        
          const draggable = useDraggable(wrapper, {
        Severity: Minor
        Found in packages/website/src/components/slices/PosterSlice/index.tsx - About 1 hr to fix

          Function panResponder has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Confirmed

            const panResponder = useMemo(() => {
              return PanResponder.create({
                onStartShouldSetPanResponder: () => true,
                onPanResponderMove: (evt, gestureState) => {
                  if (
          Severity: Minor
          Found in packages/mobile/src/components/shared/SlideToAnswer.tsx - About 1 hr to fix

            Function startGame has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Confirmed

                async startGame(_, { playerUUID }) {
                  const player = await Player.findByUUID(playerUUID, {
                    withRelated: [
                      'user',
                      'game',
            Severity: Minor
            Found in packages/server/app/graphql/resolvers/game.ts - About 1 hr to fix

              Function SlideToAnswer has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Confirmed

              const SlideToAnswer: FC<SlideToAnswerProps> = ({
                onHangUp,
                onPickUp,
                touchable
              }) => {
              Severity: Minor
              Found in packages/mobile/src/components/shared/SlideToAnswer.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 MiniGame has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const MiniGame: FC<MiniGameProps> = props => {
                const { uuid, player, winner, type } = props
                const [pending, setPending] = useState<PendingState>(undefined)
                const [ready, setReady] = useState<boolean>(false)
                const { theme, setTheme } = useTheme()
              Severity: Minor
              Found in packages/mobile/src/pages/Game/Main/MiniGame/index.tsx - About 1 hr to fix

                Function NotificationSample has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const NotificationSample = () => {
                  const [notification, setNotification] = useState([])
                  const { setTheme } = useTheme()
                
                  const mock = () => {
                Severity: Minor
                Found in packages/mobile/src/pages/samples/Notification.tsx - About 1 hr to fix

                  Function Pending has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Confirmed

                  const Pending = () => {
                    return (
                      <>
                        <Component>
                          <Container alignSelf="center">
                  Severity: Minor
                  Found in packages/mobile/src/pages/samples/Pending.tsx - About 1 hr to fix

                    Function reportPlayer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Confirmed

                        async reportPlayer(_, { fromUUID, toUUID }) {
                          const [from, to] = await Promise.all(
                            [fromUUID, toUUID].map(uuid =>
                              Player.findByUUID(uuid, {
                                withRelated: ['game']
                    Severity: Minor
                    Found in packages/server/app/graphql/resolvers/report.ts - About 1 hr to fix

                      Function GameOver has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const GameOver: FC<SvgProps> = props => {
                        return (
                          <Svg viewBox={`0 0 ${WIDTH} ${HEIGHT}`} fill="none" {...props}>
                            <Path
                              fill={Colors.red}
                      Severity: Minor
                      Found in packages/mobile/src/components/svgs/GameOver.tsx - About 1 hr to fix

                        Function setCardRound has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async setCardRound(_, { playerUUID, choice, targets }) {
                              const { game, player, players, lastRound } = await getPlayerData(
                                playerUUID
                              )
                        
                        
                        Severity: Minor
                        Found in packages/server/app/graphql/resolvers/round.ts - About 1 hr to fix

                          Function webpack has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              webpack(config, options) {
                                const { isServer } = options;
                                nextConfig = Object.assign({ inlineImageLimit: 8192, assetPrefix: "" }, nextConfig);
                          
                                if (!options.defaultLoaders) {
                          Severity: Minor
                          Found in packages/website/scripts/withFiles.js - About 1 hr to fix

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

                                async readyForRound(_, { playerUUID }) {
                                  const player = await Player.findByUUID(playerUUID, {
                                    withRelated: [
                                      'user',
                                      'game',
                            Severity: Minor
                            Found in packages/server/app/graphql/resolvers/round.ts - About 1 hr to fix

                              Function AlertContainer has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Confirmed

                              const AlertContainer: FC = () => {
                                const [alerts, setAlert] = useState<IdentifiedAlert[]>([])
                              
                                useBus(
                                  'alert',
                              Severity: Minor
                              Found in packages/mobile/src/App/Alert/AlertContainer.tsx - About 1 hr to fix

                                Function ResourceSavingScene has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const ResourceSavingScene: FC<Props> = props => {
                                  // react-native-screens is buggy on web
                                  if (screensEnabled?.() && Platform.OS !== 'web') {
                                    const { isVisible, ...rest } = props
                                
                                

                                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 onPanResponderRelease has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Confirmed

                                      onPanResponderRelease: (_, gestureState) => {
                                        if (answer) return
                                        if (
                                          gestureState.dx + COMPONENT_HEIGHT + RELEASE_OFFSET >
                                          layout.current.width
                                Severity: Minor
                                Found in packages/mobile/src/components/shared/SlideToAnswer.tsx - About 1 hr to fix

                                  Function stopGame has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      async stopGame(_, { winnerUUID }) {
                                        const winner = await Player.findByUUID(winnerUUID, {
                                          withRelated: ['game', 'game.room', 'game.players', 'game.players.user']
                                        })
                                        const game = winner.related('game') as Game
                                  Severity: Minor
                                  Found in packages/server/app/graphql/resolvers/game.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language