1 | |||
2 | 1 | var fs = require('fs'); |
|
3 | 1 | var glob = require('glob'); |
|
4 | 1 | var globAll = require('glob-all'); |
|
5 | 1 | var path = require('path'); |
|
6 | 1 | var extend = require('util')._extend; |
|
7 | 1 | var format = require('string-template'); |
|
8 | 1 | var frontMatter = require('front-matter'); |
|
9 | 1 | var sanatizeType = require('../util/sanatize-patterntype'); |
|
10 | |||
11 | 1 | module.exports = function(value, config, cb, pl) { |
|
12 | 1 | var data = getPatternSpecs (value, config, pl); |
|
13 | 1 | cb(null, processTree(data)); |
|
14 | } |
||
15 | |||
16 | 1 | module.exports.config = { |
|
17 | verbose: false |
||
18 | } |
||
19 | |||
20 | 1 | module.exports.search = function(items, link) { |
|
0 ignored issues
–
show
|
|||
21 | 1 | 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 | 1 | return results; |
|
31 | } |
||
32 | |||
33 | |||
34 | function getPatternSpecs(value, config, pl) { |
||
0 ignored issues
–
show
|
|||
35 | |||
36 | 1 | var sourceFile = frontMatter(fs.readFileSync(value).toString()); |
|
37 | 4 | if (sourceFile.attributes.pattern && !sourceFile.attributes.pattern.type) { |
|
38 | // 'type' is not set, try to get it from 'name' |
||
39 | 1 | var parts = String(sourceFile.attributes.pattern.name).split('/'); |
|
40 | 2 | if (parts.length > 1) { |
|
41 | 1 | sourceFile.attributes.pattern.type = sanatizeType(parts[0]); |
|
42 | } |
||
43 | } |
||
44 | 1 | return sourceFile.attributes; |
|
45 | } |
||
46 | |||
47 | |||
48 | function processTree(tree) { |
||
49 | |||
50 | // do stuff |
||
51 | |||
52 | 1 | return tree; //my_stuff; |
|
53 | } |
||
54 | |||
55 |
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.