Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Add configuration file support and exclude option #213

Merged
merged 2 commits into from Jun 5, 2019
Merged

Add configuration file support and exclude option #213

merged 2 commits into from Jun 5, 2019

Conversation

MVrachev
Copy link
Contributor

@MVrachev MVrachev commented Apr 30, 2019

Our users need a way to configure Precaution for their needs.

The first important option to enable will be the "exclude" option.
That way the users can exclude their tests folders and files.

We decided to give globs as a way for the users to be more flexible
when they are creating exclude rules.

Because YAML allows you to use comments and it's more human readable
than JSON we decided to use .precaution.yaml as a config file.

Closes: #179

Signed-off-by: Martin Vrachev mvrachev@vmware.com

@MVrachev MVrachev added work-in-progress Pull request that is still in progress and shouldn't be merged and removed cla-not-required labels Apr 30, 2019
Copy link
Contributor

@joshuagl joshuagl left a comment

Choose a reason for hiding this comment

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

Looks like a good start. We need to fix CI and update the date in the copyright header for index.js

index.js Outdated Show resolved Hide resolved
github_api_helper.js Outdated Show resolved Hide resolved
filter.js Show resolved Hide resolved
filter.js Outdated Show resolved Hide resolved
config.js Outdated Show resolved Hide resolved
filter.js Outdated Show resolved Hide resolved
filter.js Outdated Show resolved Hide resolved
@MVrachev MVrachev requested a review from joshuagl May 2, 2019 17:06
@MVrachev MVrachev removed the work-in-progress Pull request that is still in progress and shouldn't be merged label May 2, 2019
@joshuagl
Copy link
Contributor

joshuagl commented May 3, 2019

Trying to prompt Travis with a close/reopen

@joshuagl joshuagl closed this May 3, 2019
@joshuagl
Copy link
Contributor

joshuagl commented May 3, 2019

Go Travis, go!

@joshuagl joshuagl reopened this May 3, 2019
filter.js Outdated Show resolved Hide resolved
github_api_helper.js Outdated Show resolved Hide resolved
Copy link
Contributor

@joshuagl joshuagl left a comment

Choose a reason for hiding this comment

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

Good progress, a few minor nits and some discussion comments where I make it obvious I'm not a JavaScript developer 😄

test/config.options.test.js Outdated Show resolved Hide resolved
test/config.options.test.js Outdated Show resolved Hide resolved
filter.js Show resolved Hide resolved
github_api_helper.js Show resolved Hide resolved
Copy link
Collaborator

@ericwb ericwb left a comment

Choose a reason for hiding this comment

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

I'd like to see .precaution.yml instead of .precaution.json

config.js Outdated Show resolved Hide resolved
@MVrachev MVrachev requested a review from ericwb May 16, 2019 10:49
joshuagl
joshuagl previously approved these changes May 20, 2019
Copy link
Contributor

@joshuagl joshuagl left a comment

Choose a reason for hiding this comment

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

This PR looks good, thanks. I have a few minor nits about Git workflow but no need to block merge on those, consider them more as items to keep in mind in future.

* @return {Promise<any>} GitHub response
* See https://developer.github.com/v3/repos/contents/#get-contents
*/
async function getConfigFile (context) {
async function getConfigFile (context, customConfigPath = config.configFilePath) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's strange that we introduce a new function in commit one of this PR then immediately change it in commit two of the same PR. That's a perfectly natural way for code to evolve during development but not necessary to expose in the revision control history.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a change was introduced when we added our unit tests and that's why I change it in the commit where I added the unit tests.

github_api_helper.js Show resolved Hide resolved
@joshuagl
Copy link
Contributor

@Browne want to take a last look at this PR before it merges?

@Browne
Copy link

Browne commented May 20, 2019

@Browne want to take a last look at this PR before it merges?

@joshuagl - Definitely tagged the wrong person here 😺

@joshuagl
Copy link
Contributor

My mistake, apologies for the inconvenience @Browne

@joshuagl
Copy link
Contributor

Giving @ericwb a chance for another look before this merges.

Our users need a way to configure Precaution for their needs.

The first important option to enable will be the "exclude" option.
That way the users can exclude their tests folders and files.

We decided to give globs as a way for the users to be more flexible
when they are creating exclude rules.

Because YAML allows you to use comments and it's more human readable
than JSON we decided to use .precaution.yaml as a config file.

Closes: #179

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
When we support the configuration file feature we have to
execute one more step in our workflow - checking if a Precaution
configuration file exists and downloading it from the repository.

Also, when we add new config options we should test them if we
use them correctly in our workflow.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
Copy link
Contributor

@joshuagl joshuagl left a comment

Choose a reason for hiding this comment

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

LGTM

@joshuagl joshuagl merged commit e2314f4 into securesauce:master Jun 5, 2019
@joshuagl joshuagl added the ready-to-merge Mark when pull request is ready to be merged by Mergify label Aug 23, 2019
@MVrachev MVrachev deleted the config-options branch August 23, 2020 16:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-not-required ready-to-merge Mark when pull request is ready to be merged by Mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config options to exclude/include files
5 participants