Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Major cleanup #38

Merged
merged 8 commits into from
Aug 27, 2017
Merged

Major cleanup #38

merged 8 commits into from
Aug 27, 2017

Conversation

lucasdf
Copy link
Member

@lucasdf lucasdf commented Aug 26, 2017

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 to true although the package was not checking the content on change

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.
Copy link
Collaborator

@johnwebbcole johnwebbcole left a 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?

Copy link
Member

@Arcanemagus Arcanemagus left a 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+)/,
Copy link
Member

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+)/,
Copy link
Member

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(),
Copy link
Member

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] }),
Copy link
Member

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] }),
Copy link
Member

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.

// https://github.com/AtomLinter/Meta/issues/15
const activationPromise = atom.packages.activatePackage('linter-docker');

// await atom.packages.activatePackage('language-python');
Copy link
Member

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.
@lucasdf
Copy link
Member Author

lucasdf commented Aug 27, 2017

@johnwebbcole thanks for reviewing this! I added instructions in the README for running the tests and linting the project.

@Arcanemagus I fixed those issues!

Copy link
Member

@Arcanemagus Arcanemagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Arcanemagus Arcanemagus merged commit cbc2ad7 into AtomLinter:master Aug 27, 2017
@Arcanemagus
Copy link
Member

Looks like this should be a patch release since it was never actually linting changes in the first place 😛.

@lucasdf
Copy link
Member Author

lucasdf commented Aug 27, 2017

This should close both #10 and #5

@lucasdf lucasdf deleted the add_specs branch August 27, 2017 00:25
This was referenced Aug 27, 2017
@Arcanemagus
Copy link
Member

Published in v0.2.1. 🎉

@lucasdf
Copy link
Member Author

lucasdf commented Aug 27, 2017

Great!

@lucasdf
Copy link
Member Author

lucasdf commented Aug 27, 2017

Now we may setup CircleCI!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants