zvovas/20520-six-cities-8

View on GitHub

Showing 11 of 100 total issues

Function Room has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Room(): JSX.Element {
  const dispatch = useDispatch();
  const offer = useSelector(getOffer);
  const nearbyOffers = useSelector(getNearbyOffers).slice(0, 3);
  const offerStatus = useSelector(getOfferStatus);
Severity: Major
Found in project/src/pages/room/room.tsx - About 4 hrs to fix

    Function LoginForm has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function LoginForm (): JSX.Element {
      const dispatch = useDispatch();
      const authorizationRequestStatus = useSelector(getAuthorizationRequestStatus);
    
      const [formState, setFormState] = useState<FormValues>({
    Severity: Major
    Found in project/src/components/login-form/login-form.tsx - About 3 hrs to fix

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

      const offers = createReducer(initialState, (builder) => {
        builder
          .addCase(loadOffersRequest, (state) => {
            state.offersStatus = FetchStatus.Loading;
          })
      Severity: Minor
      Found in project/src/store/offers/offers.ts - About 2 hrs to fix

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

        const user = createReducer(initialState, (builder) => {
          builder
            .addCase(saveCurrentUser, (state, action) => {
              state.currentUser = action.payload;
            })
        Severity: Minor
        Found in project/src/store/user/user.ts - About 1 hr to fix

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

          function App(): JSX.Element {
            const offersStatus = useSelector(getOffersStatus);
            const authorizationStatus = useSelector(getAuthorizationStatus);
          
            if (offersStatus === FetchStatus.Loading) {
          Severity: Minor
          Found in project/src/components/app/app.tsx - About 1 hr to fix

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

            function Favorites(): JSX.Element {
              const dispatch = useDispatch();
              const favoriteOffersStatus = useSelector(getFavoriteOffersStatus);
              const favoritesOffers = useSelector(getFavoriteOffers);
            
            
            Severity: Minor
            Found in project/src/pages/favorites/favorites.tsx - About 1 hr to fix

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

              const reviews = createReducer(initialState, (builder) => {
                builder
                  .addCase(loadReviewsRequest, (state) => {
                    state.reviewsStatus = FetchStatus.Loading;
                  })
              Severity: Minor
              Found in project/src/store/reviews/reviews.ts - About 1 hr to fix

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

                const favorites = createReducer(initialState, (builder) => {
                  builder
                    .addCase(setFavoriteOptionRequest, (state) => {
                      state.favoriteOptionStatus = FetchStatus.Loading;
                    })
                Severity: Minor
                Found in project/src/store/favorites/favorites.ts - About 1 hr to fix

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

                  function BookmarkButton ({buttonType, isFavorite, id}: BookmarkButtonProps): JSX.Element {
                    const dispatch = useDispatch();
                    const authorizationStatus = useSelector(getAuthorizationStatus);
                  
                    const history = useHistory();
                  Severity: Minor
                  Found in project/src/components/bookmark-button/bookmark-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

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

                  function Room(): JSX.Element {
                    const dispatch = useDispatch();
                    const offer = useSelector(getOffer);
                    const nearbyOffers = useSelector(getNearbyOffers).slice(0, 3);
                    const offerStatus = useSelector(getOfferStatus);
                  Severity: Minor
                  Found in project/src/pages/room/room.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 PlaceCard has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function PlaceCard({offer, cardType, onMouseEnterCard, onMouseLeaveCard}: CardProps): JSX.Element {
                    const mouseEnterHandler = () => {
                      if (onMouseEnterCard) {
                        onMouseEnterCard(offer.id);
                      }
                  Severity: Minor
                  Found in project/src/components/place-card/place-card.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

                  Severity
                  Category
                  Status
                  Source
                  Language