Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
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 | // Karma configuration |
||
5 | module.exports = function( config ) { |
||
6 | config.set( { |
||
7 | frameworks: [ 'jasmine', 'es6-shim' ], |
||
8 | reporters: [ 'spec', 'coverage' ], |
||
9 | browsers: [ 'PhantomJS' ], |
||
10 | colors: true, |
||
11 | |||
12 | // ... normal karma configuration |
||
13 | files: [ |
||
14 | 'node_modules/babel-polyfill/dist/polyfill.js', |
||
15 | require.resolve( 'jquery' ), |
||
16 | 'https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js', |
||
17 | 'https://code.jquery.com/ui/1.12.1/jquery-ui.min.js', |
||
18 | 'node_modules/Iris/dist/iris.min.js', |
||
19 | |||
20 | // All files ending in "_test" |
||
21 | // { pattern: 'test/*_test.js', watched: false } |
||
22 | |||
23 | { pattern: 'test/**/*_test.js', watched: false } |
||
24 | |||
25 | // Each file acts as entry point for the webpack configuration |
||
26 | ], |
||
27 | |||
28 | preprocessors: { |
||
29 | |||
30 | // Add webpack as preprocessor |
||
31 | 'test/*_test.js': [ 'webpack', 'coverage' ], |
||
32 | 'test/**/*_test.js': [ 'webpack', 'coverage' ] |
||
33 | }, |
||
34 | |||
35 | // optionally, configure the reporter |
||
36 | coverageReporter: { |
||
37 | type: 'html', |
||
38 | dir: 'coverage/', |
||
39 | reporters: [ |
||
40 | |||
41 | // reporters not supporting the `file` property |
||
42 | { type: 'html', subdir: 'report-html' }, |
||
43 | { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' }, |
||
44 | { type: 'lcov', subdir: 'report-lcov' } |
||
45 | ] |
||
46 | }, |
||
47 | |||
48 | webpack: require( './config/webpack.test.js' ), |
||
49 | |||
50 | webpackMiddleware: { |
||
51 | |||
52 | // Webpack-dev-middleware configuration |
||
53 | // i. e. |
||
54 | stats: 'errors-only' |
||
55 | } |
||
56 | } ); |
||
57 | }; |
||
58 |