File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ const Accessibility = (on, config) => {
20
20
readFileIfExists ( filePath ) {
21
21
const fullPath = path . resolve ( filePath ) ;
22
22
if ( fs . existsSync ( fullPath ) ) {
23
- const content = fs . readFileSync ( fullPath , 'utf8' ) ;
24
- return { exists : true , content } ;
23
+ const fileContent = fs . readFileSync ( fullPath , 'utf8' ) ;
24
+ return { exists : true , content : fileContent } ;
25
25
} else {
26
26
return { exists : false , content : null } ; // Return null if the file doesn't exist
27
27
}
Original file line number Diff line number Diff line change @@ -99,11 +99,11 @@ function processAccessibilityReport(win){
99
99
let resultsArray = [ { } ] ;
100
100
console . log ( 'logging report' , res ) ;
101
101
// If the file is not empty, parse the existing content
102
- if ( result . exists && result . fileContent ) {
102
+ if ( result . exists && result . content ) {
103
103
try {
104
- resultsArray = JSON . parse ( JSON . stringify ( result . fileContent ) ) ;
104
+ resultsArray = JSON . parse ( JSON . stringify ( result . content ) ) ;
105
105
} catch ( e ) {
106
- console . log ( "parsing error for content " , result . fileContent )
106
+ console . log ( "parsing error for content " , result . content )
107
107
console . log ( 'Error parsing JSON file:' , e ) ;
108
108
return ;
109
109
}
@@ -115,9 +115,13 @@ function processAccessibilityReport(win){
115
115
}
116
116
117
117
if ( res && res . message == "GET_LATEST_SCAN_DATA" ) {
118
+ try {
118
119
// Append the new result
119
120
resultsArray . push ( res ) ;
120
121
console . log ( 'resultsarray logging' , resultsArray ) ;
122
+ } catch ( e ) {
123
+ console . log ( 'Error pushing issues to array:' , e ) ;
124
+ }
121
125
}
122
126
123
127
// Write the updated content back to the file
You can’t perform that action at this time.
0 commit comments