Showing 49 of 120 total issues
Function Home
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Home = () => {
const colors = useColors();
const { onLeftPress } = useAdminNavBack();
const styles = StyleSheet.create({
background: {
Function formatRelativeDate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
export const formatRelativeDate = (date: Date): string => {
const today = new Date();
const years = differenceInYears(today, date);
const weeks = differenceInWeeks(today, date);
const days = differenceInDays(today, date);
- 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 generateButtons
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const generateButtons = () => {
const today = new Date();
const laterToday = set(add(today, { minutes: 30 }), { hours: 3, minutes: 0 });
const yesterday = sub(today, { days: 1 });
const evening = set(today, { hours: 18, minutes: 0 });
Function LoadingProfile
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const LoadingProfile = () => {
const colors = useColors();
const banner = spacing(24);
return (
Function Header
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Header = () => {
const dispatch = useAppDispatch();
const delay = useAppSelector((state) => state.gameOfLife.delay);
const count = useAppSelector((state) => state.gameOfLife.count);
const onCountSlide = useCallback(
Function Home
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Home = () => {
const [showModal, setShowModal] = useState(initialState);
const { onLeftPress } = useAdminNavBack();
const handleModalBackgroundPress = useCallback(() => {
Function getMatches
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getMatches = (board: Board): Matches => {
const matches: Matches = {};
for (let rowIndex = 0; rowIndex < board.length; rowIndex++)
for (let colIndex = 0; colIndex < board[rowIndex].length; colIndex++) {
const mid = board[rowIndex][colIndex];
Function Template
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Template = () => {
const colors = useColors();
const { goBack } = useNavigation();
const [value, setValue] = useState(0);
const dispatch = useAppDispatch();
Function ForgotPassword
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ForgotPassword = () => {
const [email, setEmail] = useState('');
const { goBack } = useNavigation();
const handleEmail = useCallback((value: string) => {
setEmail(value);
Method initializeFlipper
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
Function GameOfLife
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const GameOfLife = () => {
const colors = useColors();
const [loading, setLoading] = useState(true);
const dispatch = useAppDispatch();
const { goBack } = useNavigation();
Function CalendarHeader
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const CalendarHeader = () => {
const dispatch = useAppDispatch();
const activeMonth = useAppSelector((state) => state.calendar.activeMonth);
const month = format(activeMonth, 'MMMM yyyy');
Function Pillar
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Pillar = () => {
const colors = useColors();
const useNativeDriver = useDriver();
const location = useRef(new Animated.ValueXY({ x: 0, y: 0 }));
const state = useRef({ direction: 1, x: 0, y: 0 });
Function Buttons
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Buttons = () => {
const dispatch = useAppDispatch();
const run = useAppSelector((state) => state.gameOfLife.run);
const onRandom = useCallback(() => dispatch(resetBoard(0.5)), [dispatch]);
const onStart = useCallback(() => dispatch(toggleRun()), [dispatch]);
Function Welcome
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Welcome = () => {
const dispatch = useAppDispatch();
const { signInAnonymously } = useAuth();
const handleLogin = useCallback(async () => {
Function BouncingBalls
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const BouncingBalls = () => {
const colors = useColors();
const { goBack } = useNavigation();
const { layout, onLayout } = useLayout();
const styles = StyleSheet.create({
Function Colors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Colors = () => {
const { goBack } = useNavigation();
return (
<Screen
Function Chat
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Chat = () => {
const { goBack } = useNavigation();
const { insets, layout, onLayout } = useLayout();
const keyboardHeight = useAppSelector((s) => s.device.keyboardHeight);
const bottomInset = keyboardHeight > 0 ? insets.bottom : 0;
Function Day
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Day = () => {
const { goBack } = useNavigation();
const colors = useColors();
return (
Function Crash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
export const Crash = () => {
const colors = useColors();
const { goBack } = useNavigation();
const [playerGame, setPlayerGame] = useState<PlayerGame>({
- 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"