-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rules: skip line-length rule for URLs and quoted lines (#30)
Fixes: #24
- Loading branch information
1 parent
af88c21
commit 029fc30
Showing
3 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,5 +67,69 @@ ${'aaa'.repeat(30)}` | |
tt.end() | ||
}) | ||
|
||
t.test('quoted lines', (tt) => { | ||
const v = new Validator() | ||
const context = new Commit({ | ||
sha: 'e7c077c610afa371430180fbd447bfef60ebc5ea' | ||
, author: { | ||
name: 'Evan Lucas' | ||
, email: '[email protected]' | ||
, date: '2016-04-12T19:42:23Z' | ||
} | ||
, message: `src: make foo mor foo-ey | ||
Here’s the original code: | ||
${'aaa'.repeat(30)} | ||
That was the original code. | ||
` | ||
}, v) | ||
|
||
context.report = (opts) => { | ||
tt.pass('called report') | ||
tt.equal(opts.id, 'line-length', 'id') | ||
tt.equal(opts.string, '', 'string') | ||
tt.equal(opts.level, 'pass', 'level') | ||
} | ||
|
||
Rule.validate(context, { | ||
options: { | ||
length: 72 | ||
} | ||
}) | ||
tt.end() | ||
}) | ||
|
||
t.test('URLs', (tt) => { | ||
const v = new Validator() | ||
const context = new Commit({ | ||
sha: 'e7c077c610afa371430180fbd447bfef60ebc5ea' | ||
, author: { | ||
name: 'Evan Lucas' | ||
, email: '[email protected]' | ||
, date: '2016-04-12T19:42:23Z' | ||
} | ||
, message: `src: make foo mor foo-ey | ||
https://${'very-'.repeat(80)}-long-url.org/ | ||
` | ||
}, v) | ||
|
||
context.report = (opts) => { | ||
tt.pass('called report') | ||
tt.equal(opts.id, 'line-length', 'id') | ||
tt.equal(opts.string, '', 'string') | ||
tt.equal(opts.level, 'pass', 'level') | ||
} | ||
|
||
Rule.validate(context, { | ||
options: { | ||
length: 72 | ||
} | ||
}) | ||
tt.end() | ||
}) | ||
|
||
t.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters