eduardomoroni/trading-card-manager

View on GitHub

Showing 20 of 244 total issues

File index.ts has 3879 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Code generated by Prisma (prisma@1.30.1). DO NOT EDIT.
// Please don't change this file manually but run `prisma generate` to update it.
// For more information, please read the docs: https://www.prisma.io/docs/prisma-client/

import { DocumentNode } from "graphql";

    File prisma-schema.ts has 2712 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Code generated by Prisma (prisma@1.30.1). DO NOT EDIT.
      // Please don't change this file manually but run `prisma generate` to update it.
      // For more information, please read the docs: https://www.prisma.io/docs/prisma-client/
    
    export const typeDefs = /* GraphQL */ `type AggregateCard {

      Function addCard has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function addCard(card: any, set: any, skipRetry: boolean = false) {
        try {
          console.log(`Adding card ${card.name}`);
          const uuid: string = card.uuid;
          const data: CardCreateInput = {
      Severity: Major
      Found in packages/backend/db-migration/prisma/seed/card.ts - About 4 hrs to fix

        Function ActiveFilters has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const ActiveFilters: React.FC<Props> = (props: Props) => {
          const {
            colors,
            colorIdentities,
            cardName,
        Severity: Major
        Found in packages/frontend/src/presentation/components/ActiveFilters.tsx - About 3 hrs to fix

          Function CardSearchFilterLayout has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const CardSearchFilterLayout: React.FC<Props> = (props: Props) => {
            const {
              onSubmitFilter,
              cardName,
              setCardName,

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

            export const Welcome: React.FC<Props> = (props: Props) => {
              const { navigation } = props;
              const { user } = useSelector(authSelector);
              const { t } = useTranslation();
              const styles = WelcomeStyles;
            Severity: Major
            Found in packages/frontend/src/presentation/screens/Welcome/index.tsx - About 2 hrs to fix

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

              export async function addCard(card: any, set: any, skipRetry: boolean = false) {
                try {
                  console.log(`Adding card ${card.name}`);
                  const uuid: string = card.uuid;
                  const data: CardCreateInput = {
              Severity: Minor
              Found in packages/backend/db-migration/prisma/seed/card.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 CardDetails has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const CardDetails: React.FC<Props> = (props: Props) => {
                const { card } = props.route.params;
                const {
                  name,
                  manaCost,

                Function ManaCheckboxRow has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const ManaCheckboxRow: React.FC<Props> = (props: Props) => {
                  const { colors, setColors } = props;
                  function handleSelectColor(color: Color): void {
                    if (colors.includes(color)) {
                      return setColors(colors.filter(elem => elem != color));
                Severity: Minor
                Found in packages/frontend/src/presentation/components/ManaCheckboxRow.tsx - About 1 hr to fix

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

                  export async function addToken(token: any, set: any) {
                    try {
                      console.log(`Adding Token ${token.name}`);
                      const uuid: string = token.uuid;
                      const data: TokenCreateInput = {
                  Severity: Minor
                  Found in packages/backend/db-migration/prisma/seed/set.ts - About 1 hr to fix

                    Function ActiveFilters has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const ActiveFilters: React.FC<Props> = (props: Props) => {
                      const {
                        colors,
                        colorIdentities,
                        cardName,
                    Severity: Minor
                    Found in packages/frontend/src/presentation/components/ActiveFilters.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 Button has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const Button: React.FC<ButtonProps> = (props: ButtonProps) => {
                      const [state, setState] = useSetStateIfMounted<ButtonState>(ButtonState.IDLE);
                    
                      async function avoidClickingWhenPromiseIsResolving(): Promise<void> {
                        try {
                    Severity: Minor
                    Found in packages/frontend/src/presentation/components/button/Button.tsx - About 1 hr to fix

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

                      export const CardSearchFilter: React.FC<Props> = (props: Props) => {
                        const [cardName, setCardName] = useState('');
                        const [supertype, setSupertype] = useState('');
                        const [subtype, setSubtype] = useState('');
                        const [colors, setColors] = useState<Array<Color>>([]);

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

                        export const Welcome: React.FC = () => {
                          const [
                            email,
                            password,
                            setEmail,
                        Severity: Minor
                        Found in packages/frontend/src/presentation/screens/Welcome/index.web.tsx - About 1 hr to fix

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

                          export function useAuth(): UseAuthType {
                            const dispatch = useDispatch();
                            const [email, setEmail] = useState('');
                            const [password, setPassword] = useState('');
                          
                          
                          Severity: Minor
                          Found in packages/frontend/src/presentation/screens/hooks/useAuth.ts - About 1 hr to fix

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

                            export const ManaCost: React.FC<Props> = ({ manaCost }: Props) => {
                              const curlyBracesRegex = /[{}]+/;
                              const manaStrings = manaCost.split(curlyBracesRegex).filter(mana => !!mana);
                              const manaSymbols = manaStrings.map(
                                (manaString: string): Mana => new Mana(manaString),
                            Severity: Minor
                            Found in packages/frontend/src/presentation/components/ManaCost.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 sampleCardListFiltered has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const sampleCardListFiltered = (_, { filter }) => {
                              const { cardName, supertype, subtype, colors, colorIdentities } = filter
                              const byCardName = (card) => {
                                if (!cardName) {
                                  return true
                            Severity: Minor
                            Found in packages/backend/functions/src/domain/resolvers/cardResolvers.js - 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 Button has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const Button: React.FC<ButtonProps> = (props: ButtonProps) => {
                              const [state, setState] = useSetStateIfMounted<ButtonState>(ButtonState.IDLE);
                            
                              async function avoidClickingWhenPromiseIsResolving(): Promise<void> {
                                try {
                            Severity: Minor
                            Found in packages/frontend/src/presentation/components/button/Button.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

                            Avoid too many return statements within this function.
                            Open

                                return Colors.numberManaBackground;
                            Severity: Major
                            Found in packages/frontend/src/presentation/components/ManaCost.tsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return Colors.greenManaBackground;
                              Severity: Major
                              Found in packages/frontend/src/presentation/components/ManaCost.tsx - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language