Skip to main content

Search and Top Navigation

#8888 closed feature (wontfix)

Opened December 06, 2012 11:35AM UTC

Closed August 20, 2014 04:40PM UTC

Add code metric checks to .jshintrc

Reported by: jzaefferer Owned by:
Priority: minor Milestone: git
Component: [meta] Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:

JSHint supports a few code metric checks that we could adapt. Elijah has details here:

Basically we'd add a variant of these:

"maxparams": 5,
"maxdepth": 5,
"maxstatements": 25,
"maxcomplexity": 10,

If we increase maxcomplexity to 13, its mostly datepicker and sortable left as offenders. We have to figure out which ones to address before adding these, and where to increase the numbers to accept what's there.

Attachments (0)
Change History (5)

Changed December 06, 2012 11:35AM UTC by jzaefferer comment:1

milestone: 1.10.0git
status: newopen

Changed December 06, 2012 01:14PM UTC by scottgonzalez comment:2

The specific metrics need to be decided in conjunction with core.

Changed December 06, 2012 08:05PM UTC by scottgonzalez comment:3

We'll stick with the numbers in the code block from the description. I made some progress on this today. For methods that use switch statements (like keydown event handlers) or independent if statements (like _setOption()) in a logical, we just increase the allowed cyclomatic complexity for those specific functions.

Still need to clean up the interactions and datepicker, plus one failure in the scale effect (too many statements).

Changed December 07, 2012 02:13PM UTC by mikesherov comment:4

I'm not a fan of maxstatements, and I'm not a fan of creating inline concessions for switch statements and independent ifs, as that opens a whole can of worms for inline linting comments. If the cyclomatic complexity is too high due to a switch statement, it's gotta be refactored.

That's just my thoughts.

Changed August 20, 2014 04:40PM UTC by mikesherov comment:5

resolution: → wontfix
status: openclosed

Not doing this for now. May revisit someday in the future.