This repository was archived by the owner on Sep 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Initial commit of Analyzer-based Linter. Ported over first linter 'unbalanced-delimiters' #1
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0bb82d2
Initial commit of Analyzer-based Linter. Ported over first linter 'u…
usergenic 2a5a238
Upgraded to polymer-analyzer 2.0.0-alpha.12 and removed the utils mod…
usergenic 95d6cda
Set version to 1.0.0-alpha.1
usergenic 87102ef
Added support for WarningCarryingException handling in Linter.
usergenic 1d9ae8b
Added a Rule to catch WarningCarryingException.
usergenic 8731da5
Address PR comments for unbalanced delimiters rule.
usergenic 7433baf
Bumped analyzer version to 2.0.0-alpha.14
usergenic d192602
Added linter behavior/test to deal with WarningsCarryingException
usergenic 7e32f93
Updated analyzer warnings test for style
usergenic e189edc
Added native attribute binding rule.
usergenic 93a0c41
Added all the old polylint sample fixtures.
usergenic 0a4211d
Updated README ever-so-slightly.
usergenic e45c72a
Updated the bad binding expression messages to be nice like @rictic s…
usergenic 38fea61
Merge branch 'master' into brand-new-linter
rictic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
*/ | ||
import * as assert from 'assert'; | ||
import {Document} from 'polymer-analyzer/lib/model/document'; | ||
import {Severity, Warning, WarningCarryingException} from 'polymer-analyzer/lib/warning/warning'; | ||
import {Linter} from '../linter'; | ||
import {Rule} from '../rule'; | ||
|
||
suite('Linter', () => { | ||
|
||
it('catches exceptions during Analyze and presents as Warnings', async() => { | ||
const explodingLinter = class implements Rule { | ||
public async check(document: Document): Promise<Warning[]> { | ||
throw new WarningCarryingException({ | ||
code: 'exploding-linter-exploded', | ||
message: 'The exploding linter exploded.', | ||
severity: Severity.ERROR, | ||
sourceRange: { | ||
end: {column: 0, line: 0}, | ||
file: document.url, | ||
start: {column: 0, line: 0} | ||
} | ||
}); | ||
} | ||
}; | ||
const linter = new Linter([new explodingLinter()]); | ||
const warnings = | ||
await linter.lint(['test/sample/my-element-collection.html']); | ||
assert.equal(warnings.length, 1); | ||
assert.deepEqual(warnings[0], { | ||
code: 'exploding-linter-exploded', | ||
message: 'The exploding linter exploded.', | ||
severity: Severity.ERROR, | ||
sourceRange: { | ||
end: {column: 0, line: 0}, | ||
file: 'test/sample/my-element-collection.html', | ||
start: {column: 0, line: 0} | ||
} | ||
}); | ||
}); | ||
}); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<link rel="import" href="../../polymer/polymer.html"> | ||
<link rel="import" href="imports/a11y-attributes.html"> | ||
<link rel="import" href="imports/bound-variables-declared.html"> | ||
<link rel="import" href="imports/bind-to-class.html"> | ||
<link rel="import" href="imports/bind-to-data.html"> | ||
<link rel="import" href="imports/compound-binding.html"> | ||
<link rel="import" href="imports/computed-binding.html"> | ||
<link rel="import" href="imports/dom-module-after-polymer.html"> | ||
<link rel="import" href="imports/element-not-defined.html"> | ||
<link rel="import" href="imports/external-script-error.html"> | ||
<link rel="import" href="imports/implicit-properties.html"> | ||
<link rel="import" href="imports/missing-is.html"> | ||
<link rel="import" href="imports/number-literals.html"> | ||
<link rel="import" href="imports/observer-not-function.html"> | ||
<link rel="import" href="imports/string-literals.html"> | ||
<link rel="import" href="imports/unbalanced-delimiters.html"> | ||
<link rel="import" href="imports/whitespace.html"> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used in a later commit?