| Conditions | 7 |
| Paths | 25 |
| Total Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | 'use strict' |
||
| 14 | module.exports = function () { |
||
| 15 | |||
| 16 | /* |
||
| 17 | * Version 1.0 to 1.1 |
||
| 18 | * |
||
| 19 | * move .scholica -> .inc/containers/default.json |
||
| 20 | * move .scholica.dev -> .inc/containers/beta.json |
||
| 21 | * move .phpstorm.meta.php -> .inc/meta/.phpstorm.meta.php |
||
| 22 | * file .inc/version |
||
| 23 | * edit .gitignore |
||
| 24 | */ |
||
| 25 | |||
| 26 | if (!fs.existsSync('.inc')) { |
||
| 27 | fs.mkdirSync('.inc') |
||
| 28 | |||
| 29 | fs.mkdirSync(path.join('.inc', 'containers')) |
||
| 30 | if (fs.existsSync('.scholica')) { |
||
| 31 | fs.renameSync('.scholica', path.join('.inc', 'containers', 'default.json')) |
||
| 32 | } |
||
| 33 | if (fs.existsSync('.scholica.beta')) { |
||
| 34 | fs.renameSync('.scholica.beta', path.join('.inc', 'containers', 'beta.json')) |
||
| 35 | } |
||
| 36 | |||
| 37 | fs.mkdirSync(path.join('.inc', 'meta')) |
||
| 38 | if (fs.existsSync('.phpstorm.meta.php')) { |
||
| 39 | fs.renameSync('.phpstorm.meta.php', path.join('.inc', 'meta', '.phpstorm.meta.php')) |
||
| 40 | } |
||
| 41 | |||
| 42 | if (fs.existsSync('.gitignore')) { |
||
| 43 | var lines = fs.readFileSync('.gitignore', 'utf8') |
||
| 44 | lines = eol.split(lines) |
||
| 45 | lines = removeArrayItem(lines, '/.scholica') |
||
| 46 | lines = removeArrayItem(lines, '/.scholica.beta') |
||
| 47 | lines = removeArrayItem(lines, '.scholica') |
||
| 48 | lines = removeArrayItem(lines, '.scholica.beta') |
||
| 49 | lines = removeArrayItem(lines, '.phpstorm.meta.php') |
||
| 50 | lines = removeArrayItem(lines, '.container') |
||
| 51 | lines = removeArrayItem(lines, '.container.dev') |
||
| 52 | if (!lines[lines.length - 1].length) { |
||
| 53 | lines[lines.length - 1] = '.inc' |
||
| 54 | } else { |
||
| 55 | lines.push('.inc') |
||
| 56 | } |
||
| 57 | lines.push('') |
||
| 58 | fs.writeFileSync('.gitignore', lines.join(eol.auto), 'utf8') |
||
| 59 | } |
||
| 60 | |||
| 61 | fs.writeFileSync(path.join('.inc', 'version'), '11', 'utf8') |
||
| 62 | } |
||
| 63 | |||
| 64 | } |
||
| 65 |