Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit ea2c3f7

Browse files
committed
Configuration: move hasCorrectExtension to more appropriate place
1 parent 0d027a7 commit ea2c3f7

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

lib/checker.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ var Vow = require('vow');
33
var StringChecker = require('./string-checker');
44
var extractJs = require('./extract-js');
55
var utils = require('util');
6-
var path = require('path');
76

87
var NodeConfiguration = require('./config/node-configuration');
98

@@ -155,7 +154,7 @@ Checker.prototype._processDirectory = function(path, fileHandler) {
155154
return this._processDirectory(fullname, fileHandler);
156155
}
157156

158-
if (!this._hasCorrectExtension(fullname)) {
157+
if (!this._configuration.hasCorrectExtension(fullname)) {
159158
if (!this._configuration.shouldExtractFile(fullname)) {
160159
return [];
161160
}
@@ -242,23 +241,6 @@ Checker.prototype._processStdin = function(stdinHandler) {
242241
return deferred.promise();
243242
};
244243

245-
/**
246-
* Returns true if the file extension matches a file extension to process.
247-
*
248-
* @returns {Boolean}
249-
*/
250-
Checker.prototype._hasCorrectExtension = function(testPath) {
251-
var extension = path.extname(testPath).toLowerCase();
252-
var basename = path.basename(testPath).toLowerCase();
253-
var fileExtensions = this._configuration.getFileExtensions();
254-
255-
return !(
256-
fileExtensions.indexOf(extension) < 0 &&
257-
fileExtensions.indexOf(basename) < 0 &&
258-
fileExtensions.indexOf('*') < 0
259-
);
260-
};
261-
262244
/**
263245
* Returns new configuration instance.
264246
*

lib/config/configuration.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,29 @@ Configuration.prototype.getExcludedFileMasks = function() {
298298
*/
299299
Configuration.prototype.isFileExcluded = function(filePath) {
300300
filePath = path.resolve(filePath);
301+
301302
return this._excludedFileMatchers.some(function(matcher) {
302303
return matcher.match(filePath);
303304
});
304305
};
305306

307+
/**
308+
* Returns true if the file extension matches a file extension to process.
309+
*
310+
* @returns {Boolean}
311+
*/
312+
Configuration.prototype.hasCorrectExtension = function(testPath) {
313+
var extension = path.extname(testPath).toLowerCase();
314+
var basename = path.basename(testPath).toLowerCase();
315+
var fileExtensions = this.getFileExtensions();
316+
317+
return !(
318+
fileExtensions.indexOf(extension) < 0 &&
319+
fileExtensions.indexOf(basename) < 0 &&
320+
fileExtensions.indexOf('*') < 0
321+
);
322+
};
323+
306324
/**
307325
* Returns file extension list.
308326
*

0 commit comments

Comments
 (0)