1 | |||
2 | var fs = require('fs'); |
||
3 | var glob = require('glob'); |
||
4 | var globAll = require('glob-all'); |
||
5 | var path = require('path'); |
||
6 | var extend = require('util')._extend; |
||
7 | var format = require('string-template'); |
||
8 | var frontMatter = require('front-matter'); |
||
9 | var sanatizeType = require('../util/sanatize-patterntype'); |
||
10 | |||
11 | module.exports = function(value, config, cb, pl) { |
||
12 | var data = getPatternSpecs (value, config, pl); |
||
13 | cb(null, processTree(data)); |
||
14 | } |
||
15 | |||
16 | module.exports.config = { |
||
17 | verbose: false |
||
18 | } |
||
19 | |||
20 | module.exports.search = function(items, link) { |
||
0 ignored issues
–
show
|
|||
21 | var results = []; |
||
22 | // this => collider |
||
23 | /* results.push({ |
||
24 | name: name, |
||
25 | type: 'sass ' + type, |
||
26 | description: description, |
||
27 | link: link + hash |
||
28 | }); */ |
||
29 | |||
30 | return results; |
||
31 | } |
||
32 | |||
33 | |||
34 | function getPatternSpecs(value, config, pl) { |
||
0 ignored issues
–
show
|
|||
35 | if (!fs.existsSync(value)) return false; |
||
36 | |||
37 | var sourceFile = frontMatter(fs.readFileSync(value).toString()); |
||
38 | if (sourceFile.attributes.pattern && !sourceFile.attributes.pattern.type) { |
||
39 | // 'type' is not set, try to get it from 'name' |
||
40 | var parts = String(sourceFile.attributes.pattern.name).split('/'); |
||
41 | if (parts.length > 1) { |
||
42 | sourceFile.attributes.pattern.type = sanatizeType(parts[0]); |
||
43 | } |
||
44 | } |
||
45 | return sourceFile.attributes; |
||
46 | } |
||
47 | |||
48 | |||
49 | function processTree(tree) { |
||
50 | |||
51 | // do stuff |
||
52 | |||
53 | return tree; //my_stuff; |
||
54 | } |
||
55 | |||
56 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.