@@ -18,14 +18,14 @@ export async function main(load, display) {
1818 // Wait for DOM to be ready before displaying
1919 await DOM_READY ;
2020 await display ( data ) ;
21- monitor_options ( ) ;
21+ monitorOptions ( ) ;
2222
2323 // Full workflow, loading then displaying data
2424 // used for following updates
2525 const full = async function ( ) {
2626 const data = await load ( ) ;
2727 await display ( data ) ;
28- monitor_options ( ) ;
28+ monitorOptions ( ) ;
2929 } ;
3030
3131 // React to url changes
@@ -36,13 +36,13 @@ export async function main(load, display) {
3636
3737const COVERAGE_BACKEND_HOST = process . env . BACKEND_URL ;
3838
39- function cache_get ( cache , key ) {
39+ function cacheGet ( cache , key ) {
4040 if ( key in cache ) {
4141 return cache [ key ] . val ;
4242 }
4343}
4444
45- function cache_set ( cache , key , value ) {
45+ function cacheSet ( cache , key , value ) {
4646 const now = new Date ( ) . getTime ( ) / 1000 ;
4747
4848 // If the cache got too big, remove all elements that were added more
@@ -61,10 +61,10 @@ function cache_set(cache, key, value) {
6161 } ;
6262}
6363
64- const path_coverage_cache = { } ;
65- export async function get_path_coverage ( path , changeset , platform , suite ) {
66- const cache_key = `${ changeset } _${ path } _${ platform } _${ suite } ` ;
67- let data = cache_get ( path_coverage_cache , cache_key ) ;
64+ const pathCoverageCache = { } ;
65+ export async function getPathCoverage ( path , changeset , platform , suite ) {
66+ const cacheKey = `${ changeset } _${ path } _${ platform } _${ suite } ` ;
67+ let data = cacheGet ( pathCoverageCache , cacheKey ) ;
6868 if ( data ) {
6969 return data ;
7070 }
@@ -87,20 +87,20 @@ export async function get_path_coverage(path, changeset, platform, suite) {
8787 }
8888 data = await response . json ( ) ;
8989
90- cache_set ( path_coverage_cache , cache_key , data ) ;
90+ cacheSet ( pathCoverageCache , cacheKey , data ) ;
9191
9292 return data ;
9393}
9494
95- const history_cache = { } ;
96- export async function get_history ( path , platform , suite ) {
95+ const historyCache = { } ;
96+ export async function getHistory ( path , platform , suite ) {
9797 // Backend needs path without trailing /
9898 if ( path && path . endsWith ( "/" ) ) {
9999 path = path . substring ( 0 , path . length - 1 ) ;
100100 }
101101
102- const cache_key = `${ path } _${ platform } _${ suite } ` ;
103- let data = cache_get ( history_cache , cache_key ) ;
102+ const cacheKey = `${ path } _${ platform } _${ suite } ` ;
103+ let data = cacheGet ( historyCache , cacheKey ) ;
104104 if ( data ) {
105105 return data ;
106106 }
@@ -115,7 +115,7 @@ export async function get_history(path, platform, suite) {
115115 const response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/history?${ params } ` ) ;
116116 data = await response . json ( ) ;
117117
118- cache_set ( history_cache , cache_key , data ) ;
118+ cacheSet ( historyCache , cacheKey , data ) ;
119119
120120 // Check data has coverage values
121121 // These values are missing when going above 2 levels right now
@@ -130,41 +130,41 @@ export async function get_history(path, platform, suite) {
130130 return data ;
131131}
132132
133- const zero_coverage_cache = { } ;
134- export async function get_zero_coverage_data ( ) {
135- let data = cache_get ( zero_coverage_cache , "" ) ;
133+ const zeroCoverageCache = { } ;
134+ export async function getZeroCoverageData ( ) {
135+ let data = cacheGet ( zeroCoverageCache , "" ) ;
136136 if ( data ) {
137137 return data ;
138138 }
139139
140140 const response = await fetch (
141- "https://index.taskcluster.net/v1/task/project.releng.services.project.production.code_coverage_bot.latest/artifacts/public/zero_coverage_report .json"
141+ "https://index.taskcluster.net/v1/task/project.releng.services.project.production.code_coverage_bot.latest/artifacts/public/zeroCoverage_report .json"
142142 ) ;
143143 data = await response . json ( ) ;
144144
145- cache_set ( zero_coverage_cache , "" , data ) ;
145+ cacheSet ( zeroCoverageCache , "" , data ) ;
146146
147147 return data ;
148148}
149149
150- const filters_cache = { } ;
151- export async function get_filters ( ) {
152- let data = cache_get ( filters_cache , "" ) ;
150+ const filtersCache = { } ;
151+ export async function getFilters ( ) {
152+ let data = cacheGet ( filtersCache , "" ) ;
153153 if ( data ) {
154154 return data ;
155155 }
156156
157157 const response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/filters` ) ;
158158 data = await response . json ( ) ;
159159
160- cache_set ( filters_cache , "" , data ) ;
160+ cacheSet ( filtersCache , "" , data ) ;
161161
162162 return data ;
163163}
164164
165165// Option handling.
166166
167- export function is_enabled ( opt ) {
167+ export function isEnabled ( opt ) {
168168 const route = readRoute ( ) ;
169169 let value = "off" ;
170170 if ( route [ opt ] ) {
@@ -175,7 +175,7 @@ export function is_enabled(opt) {
175175 return value === "on" ;
176176}
177177
178- function monitor_options ( ) {
178+ function monitorOptions ( ) {
179179 // Monitor input & select changes
180180 const fields = document . querySelectorAll ( "input, select" ) ;
181181 for ( const field of fields ) {
@@ -205,7 +205,7 @@ function monitor_options() {
205205
206206// hgmo.
207207
208- export async function get_source ( file ) {
208+ export async function getSource ( file ) {
209209 const response = await fetch (
210210 `https://hg.mozilla.org/mozilla-central/raw-file/tip/${ file } `
211211 ) ;
@@ -214,24 +214,24 @@ export async function get_source(file) {
214214
215215// Filtering.
216216
217- const get_third_party_paths = ( function ( ) {
217+ const getThirdPartyPaths = ( function ( ) {
218218 let paths = null ;
219219 return async function ( ) {
220220 if ( ! paths ) {
221- const response = await get_source ( "tools/rewriting/ThirdPartyPaths.txt" ) ;
221+ const response = await getSource ( "tools/rewriting/ThirdPartyPaths.txt" ) ;
222222 paths = response . split ( "\n" ) . filter ( path => path !== "" ) ;
223223 }
224224
225225 return paths ;
226226 } ;
227227} ) ( ) ;
228228
229- export async function filter_third_party ( files ) {
230- if ( is_enabled ( "third_party" ) ) {
229+ export async function filterThirdParty ( files ) {
230+ if ( isEnabled ( "third_party" ) ) {
231231 return files ;
232232 }
233233
234- const paths = await get_third_party_paths ( ) ;
234+ const paths = await getThirdPartyPaths ( ) ;
235235
236236 return files . filter ( file => {
237237 for ( const path of paths ) {
@@ -244,9 +244,9 @@ export async function filter_third_party(files) {
244244 } ) ;
245245}
246246
247- export function filter_languages ( files ) {
248- const cpp = is_enabled ( "cpp" ) ;
249- const cpp_extensions = [
247+ export function filterLanguages ( files ) {
248+ const cpp = isEnabled ( "cpp" ) ;
249+ const cppExtensions = [
250250 "c" ,
251251 "cpp" ,
252252 "cxx" ,
@@ -258,68 +258,68 @@ export function filter_languages(files) {
258258 "inl" ,
259259 "inc"
260260 ] ;
261- const js = is_enabled ( "js" ) ;
262- const js_extensions = [ "js" , "jsm" , "xml" , "xul" , "xhtml" , "html" ] ;
263- const java = is_enabled ( "java" ) ;
264- const java_extensions = [ "java" ] ;
265- const rust = is_enabled ( "rust" ) ;
266- const rust_extensions = [ "rs" ] ;
261+ const js = isEnabled ( "js" ) ;
262+ const jsExtensions = [ "js" , "jsm" , "xml" , "xul" , "xhtml" , "html" ] ;
263+ const java = isEnabled ( "java" ) ;
264+ const javaExtensions = [ "java" ] ;
265+ const rust = isEnabled ( "rust" ) ;
266+ const rustExtensions = [ "rs" ] ;
267267
268268 return files . filter ( file => {
269269 if ( file . type === "directory" ) {
270270 return true ;
271- } else if ( cpp_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
271+ } else if ( cppExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
272272 return cpp ;
273- } else if ( js_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
273+ } else if ( jsExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
274274 return js ;
275- } else if ( rust_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
275+ } else if ( rustExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
276276 return rust ;
277- } else if ( java_extensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
277+ } else if ( javaExtensions . find ( ext => file . path . endsWith ( "." + ext ) ) ) {
278278 return java ;
279279 }
280280 console . warn ( "Unknown language for " + file . path ) ;
281281 return false ;
282282 } ) ;
283283}
284284
285- export function filter_headers ( files ) {
286- if ( is_enabled ( "headers" ) ) {
285+ export function filterHeaders ( files ) {
286+ if ( isEnabled ( "headers" ) ) {
287287 return files ;
288288 }
289289
290290 return files . filter ( file => ! file . path . endsWith ( ".h" ) ) ;
291291}
292292
293- export function filter_completely_uncovered ( files ) {
294- if ( ! is_enabled ( "completely_uncovered" ) ) {
293+ export function filterCompletelyUncovered ( files ) {
294+ if ( ! isEnabled ( "completely_uncovered" ) ) {
295295 return files ;
296296 }
297297
298298 return files . filter ( file => file . uncovered ) ;
299299}
300300
301- export function filter_last_push_date ( files ) {
301+ export function filterLastPushDate ( files ) {
302302 const elem = document . getElementById ( "last_push" ) ;
303- const upper_limit = new Date ( ) ;
304- let lower_limit = new Date ( ) ;
303+ const upperLimit = new Date ( ) ;
304+ let lowerLimit = new Date ( ) ;
305305
306306 if ( elem . value === "one_year" ) {
307- lower_limit . setFullYear ( upper_limit . getFullYear ( ) - 1 ) ;
307+ lowerLimit . setFullYear ( upperLimit . getFullYear ( ) - 1 ) ;
308308 } else if ( elem . value === "two_years" ) {
309- upper_limit . setFullYear ( upper_limit . getFullYear ( ) - 1 ) ;
310- lower_limit . setFullYear ( lower_limit . getFullYear ( ) - 2 ) ;
309+ upperLimit . setFullYear ( upperLimit . getFullYear ( ) - 1 ) ;
310+ lowerLimit . setFullYear ( lowerLimit . getFullYear ( ) - 2 ) ;
311311 } else if ( elem . value === "older_than_two_years" ) {
312- upper_limit . setFullYear ( upper_limit . getFullYear ( ) - 2 ) ;
313- lower_limit = new Date ( "1970-01-01T00:00:00Z" ) ;
312+ upperLimit . setFullYear ( upperLimit . getFullYear ( ) - 2 ) ;
313+ lowerLimit = new Date ( "1970-01-01T00:00:00Z" ) ;
314314 } else {
315315 return files ;
316316 }
317317
318318 return files . filter ( file => {
319- const last_push_date = new Date ( file . last_push_date ) ;
319+ const lastPushDate = new Date ( file . lastPushDate ) ;
320320 if (
321- last_push_date . getTime ( ) <= upper_limit . getTime ( ) &&
322- last_push_date . getTime ( ) >= lower_limit . getTime ( )
321+ lastPushDate . getTime ( ) <= upperLimit . getTime ( ) &&
322+ lastPushDate . getTime ( ) >= lowerLimit . getTime ( )
323323 ) {
324324 return true ;
325325 }
@@ -328,7 +328,7 @@ export function filter_last_push_date(files) {
328328}
329329
330330// Build the urls for a breadcrumb Navbar from a path
331- export function build_navbar ( path , revision ) {
331+ export function buildNavbar ( path , revision ) {
332332 if ( path . endsWith ( "/" ) ) {
333333 path = path . substring ( 0 , path . length - 1 ) ;
334334 }
0 commit comments