function needs a blank line above error in drupalcs linter of Atom Editor

While I was refactoring code in D7,my  drupalcs linter in my Atom Editor showed following error – a function needs a blank line above it. When I added a blank line, another error throws up – the function comment needs a blank line below it. How in the world could both of them be true at the same time, like  the status of Schrodinger’s cat?

So, I thought it was some error in the drupalcs linter  and was moving on when I came across another function which didn’t have that error. When I compared it with my function, I found that I had no blank line above the function comment. So the error was about a blank line above the function comment not directly above the function itself. Even though it wasn’t intuitive enough  at first, this should help anyone grappling with this error in future.

Long story short – Add a blank line above the function comment not above the function itself.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s