Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrisdias/linting #42

Merged
merged 7 commits into from
Dec 2, 2016
Merged

Chrisdias/linting #42

merged 7 commits into from
Dec 2, 2016

Conversation

chrisdias
Copy link
Member

adds linting for dockerfiles using dockerfile_lint library

Copy link
Member

@lostintangent lostintangent left a comment

Choose a reason for hiding this comment

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

All of my comments are just questions, so feel free to ignore them :) This looks awesome, and will be a nice addition to the extension!

@@ -1,2 +1,3 @@
out
out/**/*.js
out/**/*.map
Copy link
Member

Choose a reason for hiding this comment

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

Can we ignore the yaml files that are in the out directory as well? It seems like the extension doesn't use them.

Copy link
Member Author

Choose a reason for hiding this comment

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

actually it does use the .yaml files, they are the linting rules. i had to change gitignore to persist them. happy if you have another way to do this.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

}
}

diagnosticCollection.set(document.uri, diagnostics);
Copy link
Member

Choose a reason for hiding this comment

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

Should we do anything with the info-level linting messages? It seems like the default rules files include some.

Copy link
Member Author

Choose a reason for hiding this comment

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

also forgot to do this :)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -54,4 +58,16 @@ export function activate(ctx: vscode.ExtensionContext): void {
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.open-shell', openShellContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.compose.up', composeUp));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.compose.down', composeDown));

diagnosticCollection = vscode.languages.createDiagnosticCollection('docker-diagnostics');
Copy link
Member

Choose a reason for hiding this comment

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

Did we want to check whether linting was enabled? I noticed you added a config option to turn it on/off, but didn't see if it was checked before scheduling linting validations.

Copy link
Member Author

Choose a reason for hiding this comment

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

forgot to do this :)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

reference_url:
- "https://docs.docker.com/reference/builder/"
- "#from"
label: "no_tag"
Copy link
Member

Choose a reason for hiding this comment

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

Is this rule and the one below it missing their hyphen delimiter? The rules for the RUN directive below each have one, which I had thought was the correct syntax for lists in yaml.

Copy link
Member Author

Choose a reason for hiding this comment

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

these came with dockerfile_lint so i don't know. but, we can remove all these per the above comments.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

let diagnostics: vscode.Diagnostic[] = [];

let linterRuleFile = configOptions.get('linterRuleFile', 'basic_rules.yaml');

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this lib will actually default to using this exact rules file if you specific a null/empty rules file path, so we could choose not to ship any of these sample rules file, and allow either turning on the default rules or specifying a custom one.

Copy link
Member Author

Choose a reason for hiding this comment

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

interesting... i would rather remove the rules files and go with the defaults. but, i'll keep the ability to create a new rules file and drop into the root of the workspace. or, i'll go with a full path so you could have 1 on the machine...

Copy link
Member Author

Choose a reason for hiding this comment

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

"fixed" by not relying on file...

@chrisdias
Copy link
Member Author

great feedback! i've still got work to do, will make changes and then resubmit.

@lostintangent
Copy link
Member

LGTM!

@chrisdias chrisdias merged commit 4774ee2 into master Dec 2, 2016
@chrisdias chrisdias deleted the chrisdias/linting branch February 10, 2017 17:27
chrisdias added a commit that referenced this pull request Dec 4, 2017
@microsoft microsoft locked and limited conversation to collaborators Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants