@@ -48,32 +48,35 @@ program.on( "--help", function() {
48
48
// Parse the command line parameters.
49
49
program . parse ( process . argv ) ;
50
50
51
+ // Get the specified options.
52
+ const options = program . opts ( ) ;
53
+
51
54
// Check for required input path option.
52
55
// If missing assume current working directory.
53
- if ( typeof ( program . input ) === "undefined" ) {
54
- program . input = process . cwd ( ) ;
56
+ if ( typeof ( options . input ) === "undefined" ) {
57
+ options . input = process . cwd ( ) ;
55
58
}
56
59
57
60
// Output some useful information.
58
61
log ( chalk . bold ( "RPA Lint - " + appPackage . version ) ) ;
59
62
60
63
// Resolve a relative path if required.
61
- if ( ! path . isAbsolute ( program . input ) ) {
62
- program . input = path . resolve ( process . cwd ( ) . toString ( ) , program . input ) ;
64
+ if ( ! path . isAbsolute ( options . input ) ) {
65
+ options . input = path . resolve ( process . cwd ( ) . toString ( ) , options . input ) ;
63
66
} else {
64
67
65
68
// Normalise the path for sanity.
66
- program . input = path . normalize ( program . input ) ;
69
+ options . input = path . normalize ( options . input ) ;
67
70
}
68
71
69
72
// Get a list of files to process.
70
- if ( program . recursive === true ) {
73
+ if ( options . recursive === true ) {
71
74
log ( "INFO: Searching recursively for XAML files" ) ;
72
75
}
73
76
74
77
let xamlFiles = StyleRuleFactory . getXamlFileList (
75
- program . input ,
76
- program . recursive
78
+ options . input ,
79
+ options . recursive
77
80
) ;
78
81
79
82
// Check to make sure XAML files were found.
@@ -83,15 +86,15 @@ if ( xamlFiles.length === 0 ) {
83
86
}
84
87
85
88
// Get some information about the project.
86
- const projectInfo = new UiPathProject ( program . input ) ;
89
+ const projectInfo = new UiPathProject ( options . input ) ;
87
90
88
91
log ( "INFO: Project name: %s" , projectInfo . getName ( ) ) ;
89
92
log ( "INFO: Project version: %s" , projectInfo . getVersion ( ) ) ;
90
93
91
94
// Output some additional information.
92
- log ( "INFO: Found %d files in %s" , xamlFiles . length , program . input ) ;
95
+ log ( "INFO: Found %d files in %s" , xamlFiles . length , options . input ) ;
93
96
94
- if ( program . quiet === true ) {
97
+ if ( options . quiet === true ) {
95
98
log ( warn ( "WARN:" ) + " Warning messages are being suppressed" ) ;
96
99
}
97
100
@@ -111,7 +114,7 @@ let libraryStyleRules = [];
111
114
let libraryPublicWorkflows = [ ] ;
112
115
113
116
// Build a list of library specific style rules if required.
114
- if ( projectInfo . isLibrary ( ) === false && program . includePrivate === true ) {
117
+ if ( projectInfo . isLibrary ( ) === false && options . includePrivate === true ) {
115
118
log ( warn ( "WARN: " ) + "--include-private option is only applicable to library projects" ) ;
116
119
}
117
120
@@ -129,7 +132,7 @@ if ( projectInfo.isLibrary() ) {
129
132
) ;
130
133
131
134
// Filter out private workflows if required.
132
- if ( program . includePrivate !== true ) {
135
+ if ( options . includePrivate !== true ) {
133
136
log ( "INFO: Ignoring private workflows." ) ;
134
137
xamlFiles = StyleRuleFactory . filterPublicWorkflows (
135
138
xamlFiles ,
@@ -186,7 +189,7 @@ xamlFiles.forEach( function( file ) {
186
189
} ) ;
187
190
188
191
// Suppress warnings if required.
189
- if ( program . quiet === true ) {
192
+ if ( options . quiet === true ) {
190
193
191
194
// Check to see if only warnings have been found.
192
195
if ( haveErrors === false && haveIssues === true ) {
@@ -197,9 +200,9 @@ if ( program.quiet === true ) {
197
200
}
198
201
199
202
// Filter the results list if required.
200
- if ( program . filter !== undefined ) {
203
+ if ( options . filter !== undefined ) {
201
204
log ( warn ( "WARN: " ) + "Results are filtered." ) ;
202
- results = StyleRuleFactory . filterResults ( results , program . filter ) ;
205
+ results = StyleRuleFactory . filterResults ( results , options . filter ) ;
203
206
204
207
if ( results . size === 0 ) {
205
208
haveIssues = false ;
@@ -232,7 +235,7 @@ if ( haveIssues ) {
232
235
}
233
236
234
237
// Check the UiPath project dependencies if required.
235
- if ( program . depCheck ) {
238
+ if ( options . depCheck ) {
236
239
console . log ( "INFO: Checking UiPath project dependencies. This will take some time..." ) ;
237
240
238
241
let depCheck = new NoOutdatedProjectDependencies ( projectInfo ) ;
0 commit comments