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);
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>({
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;
})
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;
})
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) {
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);
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;
})
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;
})
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();
- Read upRead up
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);
- Read upRead up
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);
}
- Read upRead up
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"