Armed police were called after two windows of a downstairs flat in School Close, Sharlston, near Wakefield, were damaged during the incident on Thursday at 12.12am.
West Yorkshire Police are asking anyone who saw any suspicious behaviour in the area at the time to come forward as their investigations continue.
Nobody was hurt during the incident although the force helicopter was called to support officers at the scene.
Detective Chief Inspector Nicola Bryar, from West Yorkshire Police’s Homicide and Major Enquiry Team, said firearms discharges are “extremely rare” in the district, and that it is believed to be an isolated incident.
She said: “Police are investigating this incident and a number of enquiries are ongoing.
“We would like to speak to anyone who saw suspicious behaviour in School Close at around midnight or who has any information about what took place to come forwards.
“It must be stressed that firearms discharges such as this are extremely rare for Wakefield and we do believe this was an isolated incident.”
Anyone with information should call police on 101 or Crimestoppers anonymously on 0800 555111.