[INCORRECT] I did not attend the rally, which was very unpatriotic of me.
The word which has no single, clear antecedent. Instead, it refers to the entire clause - "I did not attend the rally." However, a pronoun must always refer to a single, clear, unmistakable NOUN ANTECEDENT.
I excerpt this from this webpage. This is kind of what I was taught in school about the proper use of "which." I was told that "which" must be used to refer to only the noun that comes before the comma, like in these sentences:
The science fair, which lasted all day, ended with an awards ceremony.
We drove past my old school, which is celebrating its 100th anniversary this year.
However, these are example sentences in Purdue's article about relative pronouns:
The movie turned out to be a blockbuster hit, which came as a surprise to critics.
My friend eventually decided to get divorced, which upset me a lot.
But the, Purdue OWL also came up with this example:
INCORRECT: Vacation is coming soon, which is nice. (What is nice, the vacation or the fact that it is coming soon?)
Cambridge Dictionary suggests that "which" can refer to the whole sentence before it:
She had to get up and walk all the way to the other side of the room, which isn’t easy with a bad back. (which refers to the whole sentence before it)
Now, also according to Cambridge Dictionary, using a relative clause to refer to a whole clause or a whole sentence is only often used in informal speaking:
Some relative clauses refer to a whole clause, a whole sentence, or a longer stretch of language. We always use which to introduce these clauses.
We often use these clauses in informal speaking to express an opinion or evaluation (In the examples, the relative clause is in bold, and the clause or person that is referred to is underlined.):
I think the other thing that was really good about it as well was that everybody worked really hard and helped tidy up at the end, which I hadn’t expected at all.
So what is the consensus here?