say you sell an uncovered call and it's exercised. you are forced to buy the stock to cover the call at the same time the call results in the sale of the stock. the proceeds from the sale of the call is added to the sale proceeds from the stock and your cost basis is what you paid.
say you sell a put and it is exercised forcing you to but the stock. the proceeds from the put reduce the purchase price of the stock. this becomes your new basis.
now if you sold an option and then covered it to close, the purchase date is the closing date and the date of the sale is the date you sold the option. however, certain brokers do it in reverse, one is Schwab which uses the date of sale (the shorting) as the purchase date and the date of purchase as the sales date (the closing)
doesn't really matter as long as the transaction is properly identified as short -term
your broker should be doing the reporting following the above guidelines.