@@ -17,14 +17,14 @@ export async function main(load, display) {
1717 // Wait for DOM to be ready before displaying
1818 await DOM_READY ;
1919 await display ( data ) ;
20- monitor_options ( ) ;
20+ monitorOptions ( ) ;
2121
2222 // Full workflow, loading then displaying data
2323 // used for following updates
2424 const full = async function ( ) {
2525 const data = await load ( ) ;
2626 await display ( data ) ;
27- monitor_options ( ) ;
27+ monitorOptions ( ) ;
2828 } ;
2929
3030 // React to url changes
@@ -35,13 +35,13 @@ export async function main(load, display) {
3535
3636const COVERAGE_BACKEND_HOST = process . env . BACKEND_URL ;
3737
38- function cache_get ( cache , key ) {
38+ function cacheGet ( cache , key ) {
3939 if ( key in cache ) {
4040 return cache [ key ] . val ;
4141 }
4242}
4343
44- function cache_set ( cache , key , value ) {
44+ function cacheSet ( cache , key , value ) {
4545 const now = new Date ( ) . getTime ( ) / 1000 ;
4646
4747 // If the cache got too big, remove all elements that were added more
@@ -60,10 +60,10 @@ function cache_set(cache, key, value) {
6060 } ;
6161}
6262
63- const path_coverage_cache = { } ;
64- export async function get_path_coverage ( path , changeset , platform , suite ) {
65- const cache_key = `${ changeset } _${ path } _${ platform } _${ suite } ` ;
66- let data = cache_get ( path_coverage_cache , cache_key ) ;
63+ const pathCoverageCache = { } ;
64+ export async function getPathCoverage ( path , changeset , platform , suite ) {
65+ const cacheKey = `${ changeset } _${ path } _${ platform } _${ suite } ` ;
66+ let data = cacheGet ( pathCoverageCache , cacheKey ) ;
6767 if ( data ) {
6868 return data ;
6969 }
@@ -86,20 +86,20 @@ export async function get_path_coverage(path, changeset, platform, suite) {
8686 }
8787 data = await response . json ( ) ;
8888
89- cache_set ( path_coverage_cache , cache_key , data ) ;
89+ cacheSet ( pathCoverageCache , cacheKey , data ) ;
9090
9191 return data ;
9292}
9393
94- const history_cache = { } ;
95- export async function get_history ( path , platform , suite ) {
94+ const historyCache = { } ;
95+ export async function getHistory ( path , platform , suite ) {
9696 // Backend needs path without trailing /
9797 if ( path && path . endsWith ( "/" ) ) {
9898 path = path . substring ( 0 , path . length - 1 ) ;
9999 }
100100
101- const cache_key = `${ path } _${ platform } _${ suite } ` ;
102- let data = cache_get ( history_cache , cache_key ) ;
101+ const cacheKey = `${ path } _${ platform } _${ suite } ` ;
102+ let data = cacheGet ( historyCache , cacheKey ) ;
103103 if ( data ) {
104104 return data ;
105105 }
@@ -114,7 +114,7 @@ export async function get_history(path, platform, suite) {
114114 const response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/history?${ params } ` ) ;
115115 data = await response . json ( ) ;
116116
117- cache_set ( history_cache , cache_key , data ) ;
117+ cacheSet ( historyCache , cacheKey , data ) ;
118118
119119 // Check data has coverage values
120120 // These values are missing when going above 2 levels right now
@@ -129,46 +129,46 @@ export async function get_history(path, platform, suite) {
129129 return data ;
130130}
131131
132- const zero_coverage_cache = { } ;
133- export async function get_zero_coverage_data ( ) {
134- let data = cache_get ( zero_coverage_cache , "" ) ;
132+ const zeroCoverageCache = { } ;
133+ export async function getZeroCoverageData ( ) {
134+ let data = cacheGet ( zeroCoverageCache , "" ) ;
135135 if ( data ) {
136136 return data ;
137137 }
138138
139139 const response = await fetch (
140- "https://index.taskcluster.net/v1/task/project.releng.services.project.production.code_coverage_bot.latest/artifacts/public/zero_coverage_report .json"
140+ "https://index.taskcluster.net/v1/task/project.releng.services.project.production.code_coverage_bot.latest/artifacts/public/zeroCoverage_report .json"
141141 ) ;
142142 data = await response . json ( ) ;
143143
144- cache_set ( zero_coverage_cache , "" , data ) ;
144+ cacheSet ( zeroCoverageCache , "" , data ) ;
145145
146146 return data ;
147147}
148148
149- const filters_cache = { } ;
150- export async function get_filters ( ) {
151- let data = cache_get ( filters_cache , "" ) ;
149+ const filtersCache = { } ;
150+ export async function getFilters ( ) {
151+ let data = cacheGet ( filtersCache , "" ) ;
152152 if ( data ) {
153153 return data ;
154154 }
155155
156156 const response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/filters` ) ;
157157 data = await response . json ( ) ;
158158
159- cache_set ( filters_cache , "" , data ) ;
159+ cacheSet ( filtersCache , "" , data ) ;
160160
161161 return data ;
162162}
163163
164164// Option handling.
165165
166- function is_enabled ( opt ) {
166+ function isEnabled ( opt ) {
167167 const route = readRoute ( ) ;
168168 return route [ opt ] === "on" ;
169169}
170170
171- function monitor_options ( ) {
171+ function monitorOptions ( ) {
172172 // Monitor input & select changes
173173 const fields = document . querySelectorAll ( "input, select" ) ;
174174 for ( const field of fields ) {
@@ -198,7 +198,7 @@ function monitor_options() {
198198
199199// hgmo.
200200
201- export async function get_source ( file ) {
201+ export async function getSource ( file ) {
202202 const response = await fetch (
203203 `https://hg.mozilla.org/mozilla-central/raw-file/tip/${ file } `
204204 ) ;
@@ -207,24 +207,24 @@ export async function get_source(file) {
207207
208208// Filtering.
209209
210- const get_third_party_paths = ( function ( ) {
210+ const getThirdPartyPaths = ( function ( ) {
211211 let paths = null ;
212212 return async function ( ) {
213213 if ( ! paths ) {
214- const response = await get_source ( "tools/rewriting/ThirdPartyPaths.txt" ) ;
214+ const response = await getSource ( "tools/rewriting/ThirdPartyPaths.txt" ) ;
215215 paths = response . split ( "\n" ) . filter ( path => path !== "" ) ;
216216 }
217217
218218 return paths ;
219219 } ;
220220} ) ( ) ;
221221
222- export async function filter_third_party ( files ) {
223- if ( is_enabled ( "third_party" ) ) {
222+ export async function filterThirdParty ( files ) {
223+ if ( isEnabled ( "third_party" ) ) {
224224 return files ;
225225 }
226226
227- const paths = await get_third_party_paths ( ) ;
227+ const paths = await getThirdPartyPaths ( ) ;
228228
229229 return files . filter ( file => {
230230 for ( const path of paths ) {
@@ -237,9 +237,9 @@ export async function filter_third_party(files) {
237237 } ) ;
238238}
239239
240- export function filter_languages ( files ) {
241- const cpp = is_enabled ( "cpp" ) ;
242- const cpp_extensions = [
240+ export function filterLanguages ( files ) {
241+ const cpp = isEnabled ( "cpp" ) ;
242+ const cppExtensions = [
243243 "c" ,
244244 "cpp" ,
245245 "cxx" ,
@@ -251,68 +251,68 @@ export function filter_languages(files) {
251251 "inl" ,
252252 "inc"
253253 ] ;
254- const js = is_enabled ( "js" ) ;
255- const js_extensions = [ "js" , "jsm" , "xml" , "xul" , "xhtml" , "html" ] ;
256- const java = is_enabled ( "java" ) ;
257- const java_extensions = [ "java" ] ;
258- const rust = is_enabled ( "rust" ) ;
259- const rust_extensions = [ "rs" ] ;
254+ const js = isEnabled ( "js" ) ;
255+ const jsExtensions = [ "js" , "jsm" , "xml" , "xul" , "xhtml" , "html" ] ;
256+ const java = isEnabled ( "java" ) ;
257+ const javaExtensions = [ "java" ] ;
258+ const rust = isEnabled ( "rust" ) ;
259+ const rustExtensions = [ "rs" ] ;
260260
261261 return files . filter ( file => {
262262 if ( file . type === "directory" ) {
263263 return true ;
264- } else if ( cpp_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
264+ } else if ( cppExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
265265 return cpp ;
266- } else if ( js_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
266+ } else if ( jsExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
267267 return js ;
268- } else if ( rust_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
268+ } else if ( rustExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
269269 return rust ;
270- } else if ( java_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
270+ } else if ( javaExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
271271 return java ;
272272 }
273273 console . warn ( "Unknown language for " + file . path ) ;
274274 return false ;
275275 } ) ;
276276}
277277
278- export function filter_headers ( files ) {
279- if ( is_enabled ( "headers" ) ) {
278+ export function filterHeaders ( files ) {
279+ if ( isEnabled ( "headers" ) ) {
280280 return files ;
281281 }
282282
283283 return files . filter ( file => ! file . path . endsWith ( ".h" ) ) ;
284284}
285285
286- export function filter_completely_uncovered ( files ) {
287- if ( ! is_enabled ( "completely_uncovered" ) ) {
286+ export function filterCompletelyUncovered ( files ) {
287+ if ( ! isEnabled ( "completely_uncovered" ) ) {
288288 return files ;
289289 }
290290
291291 return files . filter ( file => file . uncovered ) ;
292292}
293293
294- export function filter_last_push_date ( files ) {
294+ export function filterLastPushDate ( files ) {
295295 const elem = document . getElementById ( "last_push" ) ;
296- const upper_limit = new Date ( ) ;
297- let lower_limit = new Date ( ) ;
296+ const upperLimit = new Date ( ) ;
297+ let lowerLimit = new Date ( ) ;
298298
299299 if ( elem . value === "one_year" ) {
300- lower_limit . setFullYear ( upper_limit . getFullYear ( ) - 1 ) ;
300+ lowerLimit . setFullYear ( upperLimit . getFullYear ( ) - 1 ) ;
301301 } else if ( elem . value === "two_years" ) {
302- upper_limit . setFullYear ( upper_limit . getFullYear ( ) - 1 ) ;
303- lower_limit . setFullYear ( lower_limit . getFullYear ( ) - 2 ) ;
302+ upperLimit . setFullYear ( upperLimit . getFullYear ( ) - 1 ) ;
303+ lowerLimit . setFullYear ( lowerLimit . getFullYear ( ) - 2 ) ;
304304 } else if ( elem . value === "older_than_two_years" ) {
305- upper_limit . setFullYear ( upper_limit . getFullYear ( ) - 2 ) ;
306- lower_limit = new Date ( "1970-01-01T00:00:00Z" ) ;
305+ upperLimit . setFullYear ( upperLimit . getFullYear ( ) - 2 ) ;
306+ lowerLimit = new Date ( "1970-01-01T00:00:00Z" ) ;
307307 } else {
308308 return files ;
309309 }
310310
311311 return files . filter ( file => {
312- const last_push_date = new Date ( file . last_push_date ) ;
312+ const lastPushDate = new Date ( file . lastPushDate ) ;
313313 if (
314- last_push_date . getTime ( ) <= upper_limit . getTime ( ) &&
315- last_push_date . getTime ( ) >= lower_limit . getTime ( )
314+ lastPushDate . getTime ( ) <= upperLimit . getTime ( ) &&
315+ lastPushDate . getTime ( ) >= lowerLimit . getTime ( )
316316 ) {
317317 return true ;
318318 }
@@ -321,7 +321,7 @@ export function filter_last_push_date(files) {
321321}
322322
323323// Build the urls for a breadcrumb Navbar from a path
324- export function build_navbar ( path , revision ) {
324+ export function buildNavbar ( path , revision ) {
325325 if ( path . endsWith ( "/" ) ) {
326326 path = path . substring ( 0 , path . length - 1 ) ;
327327 }
0 commit comments