While the broader market has been struggling all year, drugmaker Eli Lilly & Company (LLY -0.43%) has performed better than fine. The company's shares are up by more than 13%, while the S&P 500 is down by nearly 10%. Although Eli Lilly is crushing the broader market, that doesn't mean all is well for the pharma giant as the company's latest financial results were not exactly impressive.

On the other hand, there are still solid reasons to be optimistic regarding the company's future. With that in mind, let's consider why Eli Lilly might be a buy right now and why it might not, starting with the latter.

LLY Chart

LLY data by YCharts.

Red flag: Revenue dropped during the second quarter

Many pharma giants posted solid revenue growth during the second quarter, but Eli Lilly wasn't one of them. The company's top line dropped by 4% year over year to $6.5 billion. Even taking into account the negative impact of foreign exchange dynamics, the company's revenue would have fallen by 1%.

Some of the reasons behind the drop in Eli Lilly's revenue during the period are worth mentioning. For instance, the company's cancer medicine Alimta is facing generic competition, leading to lower sales for the product. During the second quarter, Alimta's revenue declined by 63% year over year to $227.7 million. Pharma companies routinely face patent cliffs, which is one of the major risks associated with investing in a drugmaker like Eli Lilly. Unless the company can replace older medicines such as Alimta with newer successful therapies, things could get worse.

Also, revenue from insulin product Humalog decreased by 26% year over year to $447.1 million due to lower prices and competitive pressures.

Some of Eli Lilly's other products are doing just fine. Diabetes medicine Trulicity remains the company's best-selling asset, with sales that grew by 25% year over year to $1.9 billion in the quarter. Elsewhere, cancer drug Verzenio and immunosuppressant Taltz are also performing well. But that wasn't enough to offset the losses from products such as Humalog, Alimta, and others whose sales are southbound.

Green flag: Solid candidates coming through the pipeline

Although Eli Lilly's revenue dropped in the second quarter, the company looks to be in a solid position to replenish its lineup. That's because its pipeline is deep, and investors should expect some major approvals within the next few years.

To start with, the drugmaker recently scored a critical regulatory win. In May, the U.S. Food and Drug Administration (FDA) gave the green light to Eli Lilly's Mounjaro, a therapy targeting type 2 diabetes. This medicine could also earn a label expansion in treating obesity.  In my view, Mounjaro will eventually reach blockbuster status.

But Eli Lilly does have other promising programs. In diabetes, it is developing a once-weekly insulin option for type 2 patients called Basal Insulin-Fc (BIF). It would be an improvement over the current daily insulin injections some type 2 diabetes patients rely on. BIF is undergoing a phase 3 clinical trial.

In Alzheimer's disease, Eli Lilly initiated a rolling submission to the FDA for donanemab in October of 2021. And in immunology, the company is working on a potential therapy for ulcerative colitis called mirikizumab. The drugmaker is developing more exciting medicines, too, which bodes well for its future.

Is Eli Lilly stock a buy?

Eli Lilly's pipeline carries enough promise to overshadow the challenges some of its treatments, such as Alimta and Humalog, face. The company's portfolio of newer products will continue to take shape, and these therapies should help Eli Lilly grow revenue and earnings at a good clip for many years.

There are more perks involved with investing in this company, too, including its dividend, currently yielding 1.24%. That's why the market continues to send the shares higher. In short, Eli Lilly remains a solid buy for long-term investors.