Stupid Reasons to fail a Build #1976

Here is a message I saw earlier, from an automated build process.

I can't remember if it was Team City or Jenkins, but that's not important; what is important is what it said. Object names changed to protect the innocent.

Build failed. The method [DoSomething] in class [SomethingDoer] in file [DoNothing.cs] has a Cylcomatic Complexity of 11. Cyclomatic Complexity must be 10 or less

Oh dear. That was at about 17:00 this afternoon, and as of the time of writing, my eye is still twitching angrily.


Don't do this kind of thing, please. It's good to keep Cyclomatic Complexity as low as possible, but you can't beat having great Test Coverage on a piece of code; and if you have Coverage that proves the code works, then the Complexity is something you should flag for future rework, NOT something that brings your CI process to a screeching halt.

In the case above, 10 is an arbitrarily silly number, and not only that but a CC of 10 is horribly complex to begin with, so why not 5? or 9? or 7? 7 is a really cool number! Also cool is 1, 2 or 3, which would be, if I were prone to having stupid rules like this, my preferred upper limit.

But I'm not, so it isn't.

What follows is a highly dramatised account of an Actual Event that really took place at some indeterminable point in the past between some Historical Figures. Everything that you are about to read really did happen, except of course that it didn't.

I suppose you kind of had to be there

I really would love to have been a fly on the wall when the conversation that led to that particular rule being implemented took place. I can just imagine some "Architect" smiling as his henchman reads the latest decree to the huddled,shivering masses of filthy dirty peasants developers

"Hear ye, Hear ye. Henceforth, by Royal Decree of Their Majesty The Architect, bastion of our code, defender of our standards, jewel of all our hearts, without whose munificent designs we should all flounder as though like unto the animals, et cetera, et cetera, it has been decided.

Whereby all methods having a Cylcomatic Complexity, wherein and whereby said Cyclomatic Complexity being greater in order than the numerals of 10 plus one, or Twenty and Two Cleft in Twain shalt be cast unto the Pit of Build Failure whereby It Shall Not Pass The Best In Class Build Process.

And furthermore that those methods, thus girded with a Cyclomatic Complexity of more than the number 14 less three, or Thirty and Three Thrice Cloven, shalt forever and until they mend their unholy ways, remain Undeployed and Unmerged.

Hear me! The devilish fruit of thine filthy keyboards be damned! 10 being the number, and the number of countings of the distinct paths through the method shall be 10 or less. 11 Thou Shalt Not Count, nor 12, and 13 is right out!

So Mote It Be. Long Live the Architect! Now get back to your lowly hovels cubicles and refactor, or by the Gods you'll all rue this day!"

A stranger in our midst

An uneasy silence fell over the crowd, which slowly turned into a confused and angry mutter. The unwashed mass grew restless, and the Architect's smug smile faltered; he rose to leave. He knew they'd never dare to openly oppose him; but when they got angry, they tended to start thinking for themselves. Then they realised rebellion was pointless, got all sullen, and were even more miserable than before.
Best to get back to his office where he didn't have to watch that kind of unsavoury behaviour. With a swirl of his cape, he headed for the door.

Suddenly a dirty hand, attached to an even dirtier arm, which was in turn attached to filthy, gaunt approximation of what we could say, being generous, was a person, raised itself above the back of the crowd.

"Excuse me, your Lordship!" it shouted (the person-thing, not its hand, obviously) loudly in a reedy, obnoxious and stereotypical working-class made-for-TV English accent.

The Consultant

Nobody knew who this person was; he was a stranger to them, a drifter, and clearly not used to How Things Are Done Around Here. When he'd arrived in the town a few weeks earlier, people had whispered that he was an outcast Development "Consultant" from parts foreign. Some said he was on the run from some King or other out East; others said he was a King, come to claim his rightful throne. But all agreed that, born to such a low station that he did not even have A Degree, he was not One Of Us

Thus even the beggars shunned him; they stole all his worldly belongings and left him with but a single, worn shoe to call his own.

"What if, yeah?" - the Consultant paused to pick his nose thoughtfully - "what if, if it were that this here method woz 'aving like, say, loads of Tests? Like, if I says 'Oi! Look thee, my pretty knave, 'ere is this method an' he is, doubtless though he may be having a bit too much in the way of the old Cyclomatical Complexitivities, bit of a geezer innit and all but nonetheless, and never mind how is your father, he is otherwise 100 o-the-percent of bein' unit and integration covered, certified, bang to rights, tuppence each or 3 for a shilling, how's yer granny, give a dog a bone, proven to work. So he's alright by me, nar'mean?. How about that then, eh, Your Guvnorship?"

At once the crowd went deathly silent. Slowly all eyes turned to the Consultant.
An old man hissed under his breath at him.

"I told thee, lad, thou'lt get us all put on the UAT duty! Shut thine trap now for once and for final 'afore we all end up in the Selenium mines!"

But it was too late. The Architect paused his dramatic exit, thought for a moment, and turned to fix his steely glare on the Consultant. Then he bade the young engineer to step forward - which he did, slowly - yet regally - hobbling in his single, worn shoe, towards the head of the crowd.

The mob parted silently as he passed until he stood, face to face, with The Architect.

Who spoke thus:
"If someone were to say this unto me, I would say that this is an extremely well thought out argument to which, under normal circumstances, and given the need to have an actual working Continuous Integration Pipeline that valued working features over abstract technical sensitivities which may - or may not - have been decided upon based on a random ancient tool-vendor-sponsored article found within the Web of the World, that therefore there would be no reasonable counter-argument."

He paused, and took a deep breath.

"And in that case, I would then say that my previous decree should henceforth be deemed Not Cool, and should be stricken down."

The crowd was agog; then slowly a few murmured approval; more heads began to nod in agreement. Slowly the mood shifted from sullen to euphoric; they had won! Someone had finally stood up to the tyrant - and beaten him! The old man, now with tears in his eyes,gave the Consultant a toothless grin of joy. People began to clap, to throw their hats in the air, to dance with glee.

This Consultant was a hero! Dare they hope that he was the one they had often spoken of in hushed tones whilst huddled around their miserable 15" CRT monitors?

Could he be The one who would bring Balance to the CI/CD Process?

Revenge of the Ivory Tower


The Architect's cry split the air like a peal of thunder. Immediately the crowd froze. In the distance, a small child began to cry.

"However...." he continued in a hushed tone, "in this case, the argument does not count because you" - he stabbed a finger at the Consultant - "YOU SIR, ARE A WITCH!!!!"

All hell broke loose. The Architect took his leave; and when the crowd finally dispersed that night, all that was left of the Consultant was a single, worn shoe.

Stephen Byrne

Read more posts by this author.