Total Complexity | 8 |
Complexity/F | 2 |
Lines of Code | 51 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /*! |
||
6 | (function ($) { |
||
7 | "use strict"; // Start of use strict |
||
8 | |||
9 | // Smooth scrolling using jQuery easing |
||
10 | $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function () { |
||
11 | if ( |
||
|
|||
12 | location.pathname.replace(/^\//, "") == |
||
13 | this.pathname.replace(/^\//, "") && |
||
14 | location.hostname == this.hostname |
||
15 | ) { |
||
16 | var target = $(this.hash); |
||
17 | target = target.length |
||
18 | ? target |
||
19 | : $("[name=" + this.hash.slice(1) + "]"); |
||
20 | if (target.length) { |
||
21 | $("html, body").animate( |
||
22 | { |
||
23 | scrollTop: target.offset().top - 70, |
||
24 | }, |
||
25 | 1000, |
||
26 | "easeInOutExpo" |
||
27 | ); |
||
28 | return false; |
||
29 | } |
||
30 | } |
||
31 | }); |
||
32 | |||
33 | // Closes responsive menu when a scroll trigger link is clicked |
||
34 | $(".js-scroll-trigger").click(function () { |
||
35 | $(".navbar-collapse").collapse("hide"); |
||
36 | }); |
||
37 | |||
38 | // Activate scrollspy to add active class to navbar items on scroll |
||
39 | $("body").scrollspy({ |
||
40 | target: "#mainNav", |
||
41 | offset: 100, |
||
42 | }); |
||
43 | |||
44 | // Collapse Navbar |
||
45 | var navbarCollapse = function () { |
||
46 | if ($("#mainNav").offset().top > 100) { |
||
47 | $("#mainNav").addClass("navbar-shrink"); |
||
48 | } else { |
||
49 | $("#mainNav").removeClass("navbar-shrink"); |
||
50 | } |
||
51 | }; |
||
52 | // Collapse now if page is not at top |
||
53 | navbarCollapse(); |
||
54 | // Collapse the navbar when page is scrolled |
||
55 | $(window).scroll(navbarCollapse); |
||
56 | })(jQuery); // End of use strict |
||
57 |
This check looks for functions where a
return
statement is found in some execution paths, but not in all.Consider this little piece of code
The function
isBig
will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly returnundefined
.This behaviour may not be what you had intended. In any case, you can add a
return undefined
to the other execution path to make the return value explicit.