File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,18 +13,13 @@ program
1313 . option ( '-c, --config [path]' , 'configuration file path' )
1414 . parse ( process . argv ) ;
1515
16- var configPath = program . config || ( process . cwd ( ) + '/.csscomb.json' ) ;
16+ var Comb = require ( './csscomb' ) ,
17+ comb = new Comb ( ) ,
18+ configPath = program . config || ( process . cwd ( ) + '/.csscomb.json' ) ;
1719
18- /**
19- * Trying to load config.
20- * Custom config path can be specified using '-c' option.
21- */
2220if ( fs . existsSync ( configPath ) ) {
23- var config = require ( configPath ) ;
21+ comb . configure ( require ( configPath ) ) ;
2422} else {
2523 console . log ( 'Configuration file ' + configPath + ' was not found.' ) ;
26- /**
27- * Quitting with 1 error code.
28- */
2924 process . exit ( 1 ) ;
3025}
Original file line number Diff line number Diff line change 1+ /**
2+ * Starts Code Style checking process.
3+ *
4+ * @name Comb
5+ */
6+ var Comb = function ( ) {
7+ this . _rules = {
8+ 'colon-space' : { } ,
9+ 'rule-indent' : { } ,
10+ 'stick-brace' : { } ,
11+ 'sort-order' : { }
12+ } ,
13+ this . _config = { } ;
14+ this . _excludes = null ;
15+ } ;
16+
17+ Comb . prototype = {
18+
19+ /**
20+ * Loads configuration from JSON.
21+ *
22+ * @param {Object } config
23+ */
24+ configure : function ( config ) {
25+ for ( var rule in config ) {
26+ if ( config . hasOwnProperty ( rule ) && this . _rules [ rule ] ) {
27+ this . _config [ rule ] = config [ rule ] ;
28+ }
29+ }
30+ }
31+
32+ } ;
33+
34+ module . exports = Comb ;
You can’t perform that action at this time.
0 commit comments