bastienrobert/la-ferme

View on GitHub

Showing 30 of 214 total issues

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

const editLastRoundTarget = async (skill: Skill) => {
  // get player with related targets and rounds
  const player = await skill.player().fetch({
    withRelated: [
      {
Severity: Minor
Found in packages/server/app/engine/getActionBySkill.ts - About 1 hr to fix

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

        players.map(async p => {
          const player = await p.fetch({ withRelated: ['reports', 'skill'] })
          const name = await getStatisticNameFromPlayer(player, {
            winner,
            mostTargettedPlayer
    Severity: Minor
    Found in packages/server/app/engine/getStatistics.ts - About 1 hr to fix

      Function getStatisticNameFromPlayer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const getStatisticNameFromPlayer = async (
        player: Player,
        { winner, mostTargettedPlayer }: GetStatisticNameFromPlayerOptions
      ): Promise<StatisticName> => {
        if (player.uuid === winner) {
      Severity: Minor
      Found in packages/server/app/engine/getStatistics.ts - About 45 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 PlayerCardStep has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const PlayerCardStep: FC<CardStepProps> = ({
        player,
        onCivilPress,
        onUncivilPress
      }) => {
      Severity: Minor
      Found in packages/mobile/src/components/shared/CardStep/PlayerCardStep.tsx - About 45 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 CardTextContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const CardTextContent: FC<CardTextContentProps> = ({
        self,
        player,
        targets,
        card,
      Severity: Minor
      Found in packages/mobile/src/components/shared/GameCard/CardTextContent.tsx - 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 Home has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const Home: FC<HomeMainProps> = ({ navigation }) => {
        const { setTheme } = useTheme()
        const [QRcode, setQRcode] = useState(false)
        const [androidNfcPopup, setAndroidNfcPopup] = useState(false)
        const isNfcSupported = useRef(false)
      Severity: Minor
      Found in packages/mobile/src/pages/Home/Main/index.tsx - 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 exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = (nextConfig = {}) => {
        return Object.assign({}, nextConfig, {
          webpack(config, options) {
            const { isServer } = options;
            nextConfig = Object.assign({ inlineImageLimit: 8192, assetPrefix: "" }, nextConfig);
      Severity: Minor
      Found in packages/website/scripts/withFiles.js - 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

        else if (player.score > MOST_CIVIL_SCORE) return 'most-civil'
      Severity: Major
      Found in packages/server/app/engine/getStatistics.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return 'moderate'
        Severity: Major
        Found in packages/server/app/engine/getStatistics.ts - About 30 mins to fix

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

          const Skill: FC<PopupProps> = ({ set, player, players }) => {
            const [confirm, setConfirm] = useState<boolean>(false)
            const [skillMutation, skillMutationResponse] = useMutation(USE_SKILL_MUTATION)
            const skillError = skillMutationResponse?.error?.graphQLErrors
            const skillData = skillMutationResponse?.data?.useSkill
          Severity: Minor
          Found in packages/mobile/src/pages/Game/Main/Popup/Skill/index.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