-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
Add specs for the linter. Some tests are failling since they test the issues explained in AtomLinter#37
Set the project to private in NPM. Reorder the properties.
- Modify the regex to detect all types of messages that may be returned by the linter. This fixes AtomLinter#37 - Made some improvements like using `generateRange` for the line range.
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.
@lucasdf Looks good, would you mind updating the readme with instructions on running the tests?
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.
A few minor little changes. There are several more things that could be done to later improve how this package works, but they aren't necessary and can be saved for later 😉.
lib/init.js
Outdated
const patterns = [ | ||
{ | ||
// regex for "ERROR: ENV invalid format ENV_VARIABLE on line 2" | ||
regex: /(WARN|ERROR):(.*) on line (\d+)/, |
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.
Shouldn't this be /(WARN|ERROR): (.*) on line (\d+)/
to remove the initial space from the message?
lib/init.js
Outdated
}, | ||
{ | ||
// regex for "ERROR: Multiple CMD instructions found, only line 3 will take effect" | ||
regex: /(WARN|ERROR):(.*), only line (\d+)/, |
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.
Same here, remove the initial space from the captured message.
lib/init.js
Outdated
|
||
messages.push({ | ||
severity: match.severity === 'WARN' ? 'warning' : 'error', | ||
excerpt: match.excerpt.trim(), |
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.
Fixing the regex above should remove the need for .trim()
here.
lib/init.js
Outdated
{ | ||
// regex for "ERROR: ENV invalid format ENV_VARIABLE on line 2" | ||
regex: /(WARN|ERROR):(.*) on line (\d+)/, | ||
cb: m => ({ lineNo: m[3], excerpt: m[2], severity: m[1] }), |
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.
Since we're doing arithmetic on it later, do a Number.parseInt(m[3], 10)
on the lineNo
.
lib/init.js
Outdated
{ | ||
// regex for "ERROR: Multiple CMD instructions found, only line 3 will take effect" | ||
regex: /(WARN|ERROR):(.*), only line (\d+)/, | ||
cb: m => ({ lineNo: m[3], excerpt: m[2], severity: m[1] }), |
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.
Same here, do a Number.parseInt(m[3], 10)
on the lineNo
.
spec/linter-docker-spec.js
Outdated
// https://github.com/AtomLinter/Meta/issues/15 | ||
const activationPromise = atom.packages.activatePackage('linter-docker'); | ||
|
||
// await atom.packages.activatePackage('language-python'); |
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.
Since this package isn't using activationHooks
, this whole block could be replaced with just this:
await atom.packages.activatePackage('linter-docker');
If you do want to use the activationHook
compatible method just in case it gets implemented later then the right way to do it would be to activate the associated language and open a file of that language. Since opening a file adds ~1 second to each specs time, it's probably best to just go with the above version for now.
- Upgrade linter to v2. - Use `atom-package-deps` to check and install dependencies. - Modify tests to check for v2 messages
The package does not check the content on change, so this must be set to False. dockerlint does not provide a way to pass `stdin`, so in order to support on change lint then temporary files would need to be used.
@johnwebbcole thanks for reviewing this! I added instructions in the README for running the tests and linting the project. @Arcanemagus I fixed those issues! |
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.
LGTM, thanks!
Looks like this should be a patch release since it was never actually linting changes in the first place 😛. |
Published in v0.2.1. 🎉 |
Great! |
Now we may setup CircleCI! |
Converted from CoffeeScript to JavaScript
Configured linter and fixed lint issues
Upgraded to API v2
Added specs
Fixed some messages not being displayed
Fixed
lintsOnChange
was set totrue
although the package was not checking the content on change