@@ -46,7 +46,7 @@ export function hash(callback: hashCallback, input: string) {
46
46
const lineNumbers = Array ( BLOCK_SIZE ) . fill ( - 1 ) ;
47
47
48
48
// The current hash value, updated as we read each character
49
- let hash = Long . ZERO ;
49
+ let hashRaw = Long . ZERO ;
50
50
const firstMod = computeFirstMod ( ) ;
51
51
52
52
// The current index in the window, will wrap around to zero when we reach BLOCK_SIZE
@@ -63,7 +63,7 @@ export function hash(callback: hashCallback, input: string) {
63
63
64
64
// Output the current hash and line number to the callback function
65
65
const outputHash = function ( ) {
66
- const hashValue = hash . toUnsigned ( ) . toString ( 16 ) ;
66
+ const hashValue = hashRaw . toUnsigned ( ) . toString ( 16 ) ;
67
67
if ( ! hashCounts [ hashValue ] ) {
68
68
hashCounts [ hashValue ] = 0 ;
69
69
}
@@ -76,7 +76,7 @@ export function hash(callback: hashCallback, input: string) {
76
76
const updateHash = function ( current : number ) {
77
77
const begin = window [ index ] ;
78
78
window [ index ] = current ;
79
- hash = MOD . multiply ( hash )
79
+ hashRaw = MOD . multiply ( hashRaw )
80
80
. add ( Long . fromInt ( current ) )
81
81
. subtract ( firstMod . multiply ( Long . fromInt ( begin ) ) ) ;
82
82
@@ -138,7 +138,7 @@ function locationUpdateCallback(
138
138
// using the hash of the first line of the file.
139
139
locationStartLine = 1 ;
140
140
}
141
- return function ( lineNumber : number , hash : string ) {
141
+ return function ( lineNumber : number , hashValue : string ) {
142
142
// Ignore hashes for lines that don't concern us
143
143
if ( locationStartLine !== lineNumber ) {
144
144
return ;
@@ -153,10 +153,10 @@ function locationUpdateCallback(
153
153
// If the hash doesn't match the existing fingerprint then
154
154
// output a warning and don't overwrite it.
155
155
if ( ! existingFingerprint ) {
156
- result . partialFingerprints . primaryLocationLineHash = hash ;
157
- } else if ( existingFingerprint !== hash ) {
156
+ result . partialFingerprints . primaryLocationLineHash = hashValue ;
157
+ } else if ( existingFingerprint !== hashValue ) {
158
158
logger . warning (
159
- `Calculated fingerprint of ${ hash } for file ${ location . physicalLocation . artifactLocation . uri } line ${ lineNumber } , but found existing inconsistent fingerprint value ${ existingFingerprint } `
159
+ `Calculated fingerprint of ${ hashValue } for file ${ location . physicalLocation . artifactLocation . uri } line ${ lineNumber } , but found existing inconsistent fingerprint value ${ existingFingerprint } `
160
160
) ;
161
161
}
162
162
} ;
@@ -279,9 +279,9 @@ export function addFingerprints(
279
279
// Now hash each file that was found
280
280
for ( const [ filepath , callbacks ] of Object . entries ( callbacksByFile ) ) {
281
281
// A callback that forwards the hash to all other callbacks for that file
282
- const teeCallback = function ( lineNumber : number , hash : string ) {
282
+ const teeCallback = function ( lineNumber : number , hashValue : string ) {
283
283
for ( const c of Object . values ( callbacks ) ) {
284
- c ( lineNumber , hash ) ;
284
+ c ( lineNumber , hashValue ) ;
285
285
}
286
286
} ;
287
287
const fileContents = fs . readFileSync ( filepath ) . toString ( ) ;
0 commit comments