• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

putoutjs / redput / 20698960997

04 Jan 2026 08:52PM UTC coverage: 64.348% (-35.7%) from 100.0%
20698960997

push

github

coderaiser
chore: lint

29 of 29 branches covered (100.0%)

Branch coverage included in aggregate %.

119 of 201 relevant lines covered (59.2%)

8.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

19.05
/lib/parse-plugin/parse-plugin.js
1
import {tryCatch} from 'try-catch';
3✔
2
import {
3✔
3
    parse,
3✔
4
    transform,
3✔
5
    print,
3✔
6
} from 'putout';
3✔
7
import * as applyStringsTuple from './apply-strings-tuple/index.js';
3✔
8

3✔
9
export const parsePlugin = (raw) => {
3✔
10
    const [comment, ...lines] = raw.split('\n');
×
11
    const [options, name] = parseComment(comment);
×
12
    
×
13
    return {
×
14
        name,
×
15
        lines,
×
16
        options,
×
17
    };
×
18
};
3✔
19

3✔
20
function parseComment(comment) {
×
21
    const raw = comment
×
22
        .replace('//', '')
×
23
        .trimStart();
×
24
    
×
25
    if (/^[a-z-]+$/.test(raw))
×
26
        return ['', raw];
×
27
    
×
28
    const [error, data] = tryCatch(JSON.parse, raw);
×
29
    
×
30
    if (!error)
×
31
        return data;
×
32
    
×
33
    const [parseError, ast] = tryCatch(parse, raw);
×
34
    
×
35
    if (parseError)
×
36
        return ['', raw];
×
37
    
×
38
    transform(ast, raw, {
×
39
        plugins: [
×
40
            ['apply-strings-tuple', applyStringsTuple],
×
41
        ],
×
42
    });
×
43
    
×
44
    const json = print(ast, {
×
45
        printer: ['putout', {
×
46
            format: {
×
47
                quote: '"',
×
48
            },
×
49
            semantics: {
×
50
                encodeDoubleQuote: false,
×
51
                trailingComma: false,
×
52
            },
×
53
        }],
×
54
    }).slice(0, -2);
×
55
    
×
56
    const [secondError, result] = tryCatch(JSON.parse, json);
×
57
    
×
58
    if (secondError)
×
59
        return ['', raw];
×
60
    
×
61
    return result;
×
62
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc