Years ago, I encountered a fairly long debate at AVRfreaks.net about whether or not it's OK to directly connect AVR pins that are configured as inputs with internal pullup enabled directly to ground through a button or switch.
From what I recall, the consensus at the time was that it's not (at least, for switches likely to be closed and conducting at reset), because at least some AVR MCUs weren't absolutely guaranteed to have their pins in high-impedance state at reset (at least, not if the chip reset while in brownout state, or something like that).
Thinking back, I'm not sure whether the warnings even applied to the chips I was introduced to at the time (ATtiny2313, ATtiny13, and ATmega162)... I just remember that the others on the site were pretty adamant that I was courting disaster, and I took their word for it.
Fast forward ~15 years.
The current datasheet for the ATmega2560 (at https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega640-1280-1281-2560-2561-Datasheet-DS40002211A.pdf ) does seem to guarantee (on pages 7-9) that the pins used by ports A through L are tri-state high-impedance input pins at reset under all conditions, including when the clock is halted (obviously, any pin Arduino's bootloader subsequently makes use of could behave differently if I tried to hijack it for double-duty reading a button/switch... but the Mega2560 has so many pins, there really isn't any reason to reuse pins Arduino uses for its own purposes).
Offhand, I can think of three potential remaining concerns:
If I screw up and accidentally execute code that configures a pin connected directly to ground through a closed switch as a high output, the pin (and probably the whole chip) is likely to go up in smoke. I can deal with this risk.
If I were powering it with batteries, I might care about the constant power drain wasting battery life. I'm not, and I don't.
I'm not quite sure whether "OK to connect directly to ground through a momentary pushbutton" necessarily equates to "OK to connect directly to ground through a switch that might conceivably be closed and continuously conducting current for the life of the circuit.
So... have I missed anything? And is #3 a legitimate concern, or is it something that's not worth caring about if you're talking about something like 8 pins connected through a DIP switch?
Illustrative circuit:
Ground <-- [switch] --> IO pin (configured for input, internal pullup enabled)